Skip to content

ExprHelper

ExprHelper assists macro implementations with parser-consistent id allocation and AST creation.

accuIdent(): Expr

Builds the accumulator identifier expression.

Expr


accuIdentName(): string

Returns the accumulator identifier name.

string


call(fn, …args): Expr

Builds a global call expression.

string

…Expr[]

Expr


comprehension(iterRange, iterVar, accuVar, accuInit, condition, step, result): Expr

Builds a comprehension expression.

Expr

string

string

Expr

Expr

Expr

Expr

Expr


comprehensionTwoVar(iterRange, iterVar, iterVar2, accuVar, accuInit, condition, step, result): Expr

Builds a two-variable comprehension expression.

Expr

string

string

string

Expr

Expr

Expr

Expr

Expr


copy(expr): Expr

Copies an expression and assigns fresh ids to the clone tree.

Expr

Expr


error(id, message, anchor?): Error

Builds a parser error value tied to a specific expression id.

number

string

"start" | "stop"

Error


ident(name): Expr

Builds an identifier expression.

string

Expr


list(…elems): Expr

Builds a list literal expression.

…Expr[]

Expr


literal(value): Expr

Builds a literal expression.

ConstantValue

Expr


map(…entries): Expr

Builds a map literal expression.

…EntryExpr[]

Expr


mapEntry(key, value, optional): EntryExpr

Builds a map entry expression.

Expr

Expr

boolean

EntryExpr


memberCall(fn, target, …args): Expr

Builds a receiver-style call expression.

string

Expr

…Expr[]

Expr


presenceTest(operand, field): Expr

Builds a field presence test expression.

Expr

string

Expr


select(operand, field): Expr

Builds an ordinary field selection expression.

Expr

string

Expr


struct(typeName, …fields): Expr

Builds a message construction expression.

string

…EntryExpr[]

Expr


structField(name, value, optional): EntryExpr

Builds a message field initializer expression.

string

Expr

boolean

EntryExpr