Fan

 

abstract class

compiler::Expr

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

Expr

Slots

asTableSwitchCaseSource

virtual Int? asTableSwitchCase()

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

assignRequiresTempVarSource

virtual Bool assignRequiresTempVar()

Assignments to instance fields require a temporary local variable.

commonTypeSource

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

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.

ctypeSource

CType? ctype

ctypesSource

static CType[] ctypes(Expr[] exprs)

Map the list of expressions into their list of types

idSource

readonly ExprId id

isAssignableSource

virtual Bool isAssignable()

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

isCondSource

virtual Bool isCond()

Is this a boolean conditional (boolOr/boolAnd)

isDefiniteAssignSource

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

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

isStmtSource

virtual Bool isStmt()

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.

leaveSource

Bool leave := true { protected set }

makeSource

new make(Location location, ExprId id)

makeForLiteralSource

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

Make an Expr which will serialize the given literal.

noLeaveSource

Expr noLeave()

Set this expression to not be left on the stack.

printSource

override Void print(AstWriter out)

Overrides compiler::Node.print

Doc inherited from compiler::Node.print

Pretty print this node and it's descendants.

sameVarAsSource

virtual Bool sameVarAs(Expr that)

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

serializeSource

virtual Str serialize()

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

syntheticSource

virtual Bool synthetic()

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)

toDocStrSource

Str toDocStr()

Get this expression as a string suitable for documentation.

toStmtSource

ExprStmt toStmt()

Return this expression as an ExprStmt

toStrSource

abstract Str toStr()

Overrides sys::Obj.toStr

Doc inherited from sys::Obj.toStr

Return a string representation of this object.

toTypeStrSource

Str toTypeStr()

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

walkSource

Expr walk(Visitor v)

walkChildrenSource

virtual Void walkChildren(Visitor v)

walkExprSource

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

walkExprsSource

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