Fan

 

class

compiler::ShortcutExpr

sys::Obj
  compiler::Node
    compiler::Expr
      compiler::NameExpr
        compiler::CallExpr
          compiler::ShortcutExpr

ShortcutExpr is used for operator expressions which are a shortcut to a method call:

a + b    => a.plus(b)
a - b    => a.minus(b)
a * b    => a.mult(b)
a / b    => a.div(b)
a % b    => a.mod(b)
a[b]     => a.get(b)
a[b] = c => a.set(b, c)
a[b]     => a.slice(b) if b is Range
a[b] = c => a.splice(b, c) if b is Range
a << b   => a.lshift(b)
a >> b   => a.rshift(b)
a & b    => a.and(b)
a | b    => a.or(b)
a ^ b    => a.xor(b)
~a       => a.inverse()
-a       => a.negate()
++a, a++ => a.increment()
--a, a-- => a.decrement()
a == b   => a.equals(b)
a != b   => ! a.equals(b)
a <=>    => a.compare(b)
a > b    => a.compare(b) > 0
a >= b   => a.compare(b) >= 0
a < b    => a.compare(b) < 0
a <= b   => a.compare(b) <= 0

Slots

assignRequiresTempVarSource

override Bool assignRequiresTempVar()

Overrides compiler::Expr.assignRequiresTempVar

Doc inherited from compiler::Expr.assignRequiresTempVar

Assignments to instance fields require a temporary local variable.

isAssignSource

Bool isAssign()

isAssignableSource

override Bool isAssignable()

Overrides compiler::Expr.isAssignable

Doc inherited from compiler::Expr.isAssignable

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

isCompareSource

override Bool isCompare()

Overrides compiler::CallExpr.isCompare

isPostfixLeaveSource

Bool isPostfixLeave := false

isStmtSource

override Bool isStmt()

Overrides compiler::CallExpr.isStmt

Doc inherited from compiler::Expr.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.

isStrConcatSource

Bool isStrConcat()

makeBinarySource

new makeBinary(Expr lhs, Token opToken, Expr rhs)

makeFromSource

new makeFrom(ShortcutExpr from)

makeGetSource

new makeGet(Location loc, Expr target, Expr index)

makeUnarySource

new makeUnary(Location loc, Token opToken, Expr operand)

opSource

ShortcutOp op

opTokenSource

Token opToken

printSource

override Void print(AstWriter out)

Overrides compiler::CallExpr.print

Doc inherited from compiler::Node.print

Pretty print this node and it's descendants.

tempVarSource

MethodVar tempVar

toStrSource

override Str toStr()

Overrides compiler::CallExpr.toStr

Doc inherited from sys::Obj.toStr

Return a string representation of this object.