logo

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

assignRequiresTempVar

override Bool assignRequiresTempVar()

Assignments to instance fields require a temporary local variable.

Source

isAssign

Bool isAssign()

Source

isAssignable

override Bool isAssignable()

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

Source

isPostfixLeave

Bool isPostfixLeave := false

Source

isStmt

override 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.

Source

isStrConcat

Bool isStrConcat()

Source

makeBinary

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

Source

makeFrom

new makeFrom(ShortcutExpr from)

Source

makeGet

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

Source

makeUnary

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

Source

op

ShortcutOp op

Source

opToken

Token opToken

Source

print

override Void print(AstWriter out)

Pretty print this node and it's descendants.

Source

tempVar

MethodVar tempVar

Source

toStr

override Str toStr()

Return a string representation of this object.

Source