abstract class compiler::Expr
sys::Obj compiler::Node compiler::Expr
Expr
- asTableSwitchCase
-
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
- assignRequiresTempVar
-
virtual Bool assignRequiresTempVar()
Assignments to instance fields require a temporary local variable.
- assignTarget
-
virtual Obj? assignTarget()
If this expression performs assignment, then return the target of that assignment. Otherwise return null.
- commonType
-
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.
- ctype
-
CType? ctype
- ctypes
-
static CType[] ctypes(Expr[] exprs)
Map the list of expressions into their list of types
- id
-
const ExprId id
- isAlwaysNullable
-
virtual Bool isAlwaysNullable()
Return if this expression is guaranteed to sometimes return a null result (safe invoke, as, etc)
- isAssignable
-
virtual Bool isAssignable()
Return if this expression can be used as the left hand side of an assignment expression.
- isCond
-
virtual Bool isCond()
Is this a boolean conditional (boolOr/boolAnd)
- isDefiniteAssign
-
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.
- isStmt
-
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.
- leave
-
Bool leave := true { protected set }
- make
- makeForLiteral
-
static Expr makeForLiteral(Loc loc, CNamespace ns, Obj val)
Make an Expr which will serialize the given literal.
- noLeave
-
Expr noLeave()
Set this expression to not be left on the stack.
- sameVarAs
-
virtual Bool sameVarAs(Expr that)
Return if this expression represents the same variable or field as that. This is used for self assignment checks.
- serialize
-
virtual Str serialize()
Return this expression as serialization text or throw exception if not serializable.
- synthetic
-
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)
- toDocStr
-
Str? toDocStr()
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()
Return this expression as an ExprStmt
- toStr
-
abstract override Str toStr()
- toTypeStr
-
Str toTypeStr()
Get this expression's type as a string for error reporting.
- walk
- walkChildren
- walkExpr
- walkExprs