abstract class compiler::Expr

sys::Obj
  compiler::Node
    compiler::Expr

Source

Expr

asTableSwitchCase

virtual Int? asTableSwitchCase()

Source

Return this expression as an Int literal usable in a tableswitch, or null if this Expr doesn't represent a constant Int. Expressions which work as table switch cases: int literals and enum constants

assignRequiresTempVar

virtual Bool assignRequiresTempVar()

Source

Assignments to instance fields require a temporary local variable.

assignTarget

virtual Obj? assignTarget()

Source

If this expression performs assignment, then return the target of that assignment. Otherwise return null.

commonType

static CType commonType(CNamespace ns, Expr[] exprs)

Source

Given a list of Expr instances, find the common base type they all share. This method does not take into account the null literal. It is used for type inference for lists and maps.

ctype

CType? ctype

Source

ctypes

static CType[] ctypes(Expr[] exprs)

Source

Map the list of expressions into their list of types

id

const ExprId id

Source

isAlwaysNullable

virtual Bool isAlwaysNullable()

Source

Return if this expression is guaranteed to sometimes return a null result (safe invoke, as, etc)

isAssignable

virtual Bool isAssignable()

Source

Return if this expression can be used as the left hand side of an assignment expression.

isCond

virtual Bool isCond()

Source

Is this a boolean conditional (boolOr/boolAnd)

isDefiniteAssign

virtual Bool isDefiniteAssign(|Expr->Bool| f)

Source

If this an assignment expression, then return the result of calling the given function with the LHS. Otherwise return false.

isStmt

virtual Bool isStmt()

Source

Does this expression make up a complete statement. If you override this to true, then you must make sure the expr is popped in CodeAsm.

leave

Bool leave := true { protected set }

Source

make

new make(Loc loc, ExprId id)

Source

makeForLiteral

static Expr makeForLiteral(Loc loc, CNamespace ns, Obj val)

Source

Make an Expr which will serialize the given literal.

noLeave

Expr noLeave()

Source

Set this expression to not be left on the stack.

print

virtual override Void print(AstWriter out)

Source

sameVarAs

virtual Bool sameVarAs(Expr that)

Source

Return if this expression represents the same variable or field as that. This is used for self assignment checks.

serialize

virtual Str serialize()

Source

Return this expression as serialization text or throw exception if not serializable.

synthetic

virtual Bool synthetic()

Source

Was this expression generated by the compiler (not necessarily everything auto-generated has this flag true, but we set in cases where error checking needs to be handled special)

toDocStr

Str? toDocStr()

Source

Get this expression as a string suitable for documentation. This string must not contain a newline or it will break the DocApiParser.

toStmt

ExprStmt toStmt()

Source

Return this expression as an ExprStmt

toStr

abstract override Str toStr()

Source

toTypeStr

Str toTypeStr()

Source

Get this expression's type as a string for error reporting.

walk

Expr walk(Visitor v)

Source

walkChildren

virtual Void walkChildren(Visitor v)

Source

walkExpr

static Expr? walkExpr(Visitor v, Expr? expr)

Source

walkExprs

static Expr[] walkExprs(Visitor v, Expr?[] exprs)

Source