object Trees
- Alphabetic
- By Inheritance
- Trees
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Apply(receiver: Tree, method: Ident, args: List[Tree])(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
Apply an instance method with dynamic dispatch (the default).
-
case class
ApplyStatic(cls: ClassType, method: Ident, args: List[Tree])(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
Apply a static method.
-
case class
ApplyStatically(receiver: Tree, cls: ClassType, method: Ident, args: List[Tree])(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
Apply an instance method with static dispatch (e.g., super calls).
- case class ArrayLength(array: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class ArraySelect(array: Tree, index: Tree)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class ArrayValue(tpe: ArrayType, elems: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
- case class AsInstanceOf(expr: Tree, typeRef: TypeRef)(implicit pos: Position) extends Tree with Product with Serializable
- case class Assign(lhs: Tree, rhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
-
case class
BinaryOp(op: Code, lhs: Tree, rhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Binary operation (always preserves pureness).
- class Block extends Tree
- case class BooleanLiteral(value: Boolean)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class ByteLiteral(value: Byte)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class CharLiteral(value: Char)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- final class ClassDef extends IRNode
- case class ClassOf(typeRef: TypeRef)(implicit pos: Position) extends Tree with Literal with Product with Serializable
-
case class
Closure(arrow: Boolean, captureParams: List[ParamDef], params: List[ParamDef], body: Tree, captureValues: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
Closure with explicit captures.
Closure with explicit captures.
- arrow
If
true
, the closure is an Arrow Function (=>
), which does not have anthis
parameter, and cannot be constructed (called withnew
). Iffalse
, it is a regular Function (function
).
- case class ComputedName(tree: Tree, logicalName: String) extends IRNode with PropertyName with Product with Serializable
-
case class
CreateJSClass(cls: ClassRef, captureValues: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
Creates a JavaScript class value.
Creates a JavaScript class value.
- cls
Reference to the
ClassDef
for the class definition, which must havejsClassCaptures.nonEmpty
- captureValues
Actual values for the captured parameters (in the
ClassDef
'sjsClassCaptures.get
)
- case class Debugger()(implicit pos: Position) extends Tree with Product with Serializable
- case class DoWhile(body: Tree, cond: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class DoubleLiteral(value: Double)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class FieldDef(static: Boolean, name: PropertyName, ftpe: Type, mutable: Boolean)(implicit pos: Position) extends MemberDef with Product with Serializable
- case class FloatLiteral(value: Float)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class ForIn(obj: Tree, keyVar: Ident, body: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class GetClass(expr: Tree)(implicit pos: Position) extends Tree with Product with Serializable
-
sealed abstract
class
IRNode extends AnyRef
Base class for all nodes in the IR.
Base class for all nodes in the IR.
Usually, one of the direct subclasses of
IRNode
should be used instead. - case class Ident(name: String, originalName: Option[String])(implicit pos: Position) extends IRNode with PropertyName with Product with Serializable
- case class If(cond: Tree, thenp: Tree, elsep: Tree)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class IntLiteral(value: Int)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class IsInstanceOf(expr: Tree, typeRef: TypeRef)(implicit pos: Position) extends Tree with Product with Serializable
- case class JSArrayConstr(items: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
-
case class
JSBinaryOp(op: Code, lhs: Tree, rhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Binary operation (always preserves pureness).
Binary operation (always preserves pureness).
Operations which do not preserve pureness are not allowed in this tree. These are notably +=, -=, *=, /= and %=
- case class JSBracketMethodApply(receiver: Tree, method: Tree, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
- case class JSBracketSelect(qualifier: Tree, item: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class JSDelete(prop: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class JSDotMethodApply(receiver: Tree, method: Ident, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
- case class JSDotSelect(qualifier: Tree, item: Ident)(implicit pos: Position) extends Tree with Product with Serializable
- case class JSFunctionApply(fun: Tree, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
- case class JSGlobalRef(ident: Ident)(implicit pos: Position) extends Tree with Product with Serializable
- case class JSLinkingInfo()(implicit pos: Position) extends Tree with Product with Serializable
-
sealed abstract
class
JSNativeLoadSpec extends AnyRef
Loading specification for a native JS class or object.
- case class JSNew(ctor: Tree, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
- case class JSObjectConstr(fields: List[(PropertyName, Tree)])(implicit pos: Position) extends Tree with Product with Serializable
-
case class
JSSpread(items: Tree)(implicit pos: Position) extends IRNode with TreeOrJSSpread with Product with Serializable
...items
, the "spread" operator of ECMAScript 6....items
, the "spread" operator of ECMAScript 6.It is only valid in the
args
/items
of a JSNew, JSFunctionApply, JSDotMethodApply, JSBracketMethodApply, or JSArrayConstr.- items
An Array whose items will be spread (not an arbitrary iterable)
-
case class
JSSuperBracketCall(superClass: Tree, receiver: Tree, method: Tree, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
Calls a method inherited from the given
superClass
onreceiver
.Calls a method inherited from the given
superClass
onreceiver
.Intuitively, this corresponds to
superClass.prototype[method].call(receiver, ...args)
but retains more structure at the IR level than using an explicit encoding of the above expression.
Given the non-native JS classes
class Bar extends js.Object class Foo extends Bar
The node
JSSuperBrackerCall(LoadJSConstructor(ClassType(Bar)), receiver, method, args)
which is printed as
super(constructorOf[Bar])::receiver[method](...args)
has the following semantics:
Bar.prototype[method].call(receiver, ...args)
If this happens to be located in an instance method of
Foo
, *and*receiver
happens to beThis()
, this is equivalent to the ES6 statementsuper[method](...args)
-
case class
JSSuperBracketSelect(superClass: Tree, receiver: Tree, item: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Selects a property inherited from the given
superClass
onreceiver
.Selects a property inherited from the given
superClass
onreceiver
.Given the non-native JS classes
class Bar extends js.Object class Foo extends Bar
The node
JSSuperBrackerSelect(LoadJSConstructor(ClassType(Bar)), qualifier, item)
which is printed as
super(constructorOf[Bar])::qualifier[item]
has the semantics of an ES6 super reference
super[item]
as if it were in an instance method of
Foo
withqualifier
as thethis
value. -
case class
JSSuperConstructorCall(args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree with Product with Serializable
Super constructor call in the constructor of a non-native JS class.
Super constructor call in the constructor of a non-native JS class.
Exactly one such node must appear in the constructor of a non-native JS class, at the top-level (possibly as a direct child of a top-level
Block
). Any other use of this node is invalid.Statements before this node, as well as the
args
, cannot contain anyThis()
node. Statements after this node can useThis()
.After the execution of this node, it is guaranteed that all fields declared in the current class have been created and initialized. Up to that point, accessing any field declared in this class (e.g., through an overridden method called from the super constructor) is undefined behavior.
All in all, the shape of a constructor is therefore:
{ statementsNotUsingThis(); JSSuperConstructorCall(...argsNotUsingThis); statementsThatMayUseThis() }
which currently translates to something of the following shape:
{ statementsNotUsingThis(); super(...argsNotUsingThis); this.privateField1 = 0; this["publicField2"] = false; statementsThatMayUseThis() }
-
case class
JSUnaryOp(op: Code, lhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Unary operation (always preserves pureness).
Unary operation (always preserves pureness).
Operations which do not preserve pureness are not allowed in this tree. These are notably ++ and --
- case class Labeled(label: Ident, tpe: Type, body: Tree)(implicit pos: Position) extends Tree with Product with Serializable
-
sealed
trait
Literal extends Tree
Marker for literals.
Marker for literals. Literals are always pure.
-
case class
LoadJSConstructor(cls: ClassType)(implicit pos: Position) extends Tree with Product with Serializable
Loads the constructor of a JS class (native or not).
Loads the constructor of a JS class (native or not).
cls
must represent a non-trait JS class (native or not).This is used typically to instantiate a JS class, and most importantly if it is a non-native JS class. Given the class
class Foo(x: Int) extends js.Object
The instantiation
new Foo(1)
would be represented asJSNew(LoadJSConstructor(ClassType("Foo")), List(IntLiteral(1)))
This node is also useful to encode
o.isInstanceOf[Foo]
:JSBinaryOp(instanceof, o, LoadJSConstructor(ClassType("Foo")))
If
Foo
is non-native, the presence of this node makes it instantiable, and therefore reachable. -
case class
LoadJSModule(cls: ClassType)(implicit pos: Position) extends Tree with Product with Serializable
Like LoadModule but for a JS module class.
- case class LoadModule(cls: ClassType)(implicit pos: Position) extends Tree with Product with Serializable
- case class LongLiteral(value: Long)(implicit pos: Position) extends Tree with Literal with Product with Serializable
-
case class
Match(selector: Tree, cases: List[(List[IntLiteral], Tree)], default: Tree)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
A break-free switch (without fallthrough behavior).
A break-free switch (without fallthrough behavior). Unlike a JavaScript switch, it can be used in expression position. It supports alternatives explicitly (hence the
List[IntLiteral]
in cases), whereas in a switch one would use the fallthrough behavior to implement alternatives. (This is not a pattern matching construct like in Scala.) - sealed abstract class MemberDef extends IRNode
- case class MethodDef(static: Boolean, name: PropertyName, args: List[ParamDef], resultType: Type, body: Option[Tree])(optimizerHints: OptimizerHints, hash: Option[TreeHash])(implicit pos: Position) extends MemberDef with Product with Serializable
- case class New(cls: ClassType, ctor: Ident, args: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
- case class NewArray(tpe: ArrayType, lengths: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
- case class Null()(implicit pos: Position) extends Tree with Literal with Product with Serializable
- final class OptimizerHints extends AnyVal
- case class ParamDef(name: Ident, ptpe: Type, mutable: Boolean, rest: Boolean)(implicit pos: Position) extends IRNode with Product with Serializable
- case class PropertyDef(static: Boolean, name: PropertyName, getterBody: Option[Tree], setterArgAndBody: Option[(ParamDef, Tree)])(implicit pos: Position) extends MemberDef with Product with Serializable
- sealed trait PropertyName extends IRNode
- case class RecordValue(tpe: RecordType, elems: List[Tree])(implicit pos: Position) extends Tree with Product with Serializable
- case class Return(expr: Tree, label: Ident)(implicit pos: Position) extends Tree with Product with Serializable
- case class Select(qualifier: Tree, item: Ident)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class SelectStatic(cls: ClassType, item: Ident)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class ShortLiteral(value: Short)(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class Skip()(implicit pos: Position) extends Tree with Product with Serializable
- case class StoreModule(cls: ClassType, value: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class StringLiteral(value: String)(implicit pos: Position) extends Tree with Literal with PropertyName with Product with Serializable
- case class This()(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class Throw(expr: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- sealed abstract class TopLevelExportDef extends IRNode
- case class TopLevelFieldExportDef(fullName: String, field: Ident)(implicit pos: Position) extends TopLevelExportDef with Product with Serializable
- case class TopLevelJSClassExportDef(fullName: String)(implicit pos: Position) extends TopLevelExportDef with Product with Serializable
- case class TopLevelMethodExportDef(methodDef: MethodDef)(implicit pos: Position) extends TopLevelExportDef with Product with Serializable
-
case class
TopLevelModuleExportDef(fullName: String)(implicit pos: Position) extends TopLevelExportDef with Product with Serializable
Export for a top-level object.
Export for a top-level object.
This exports the singleton instance of the containing module class. The instance is initialized during ES module instantiation.
-
case class
Transient(value: Value)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
A transient node for custom purposes.
A transient node for custom purposes.
A transient node is never a valid input to the Serializers nor to the linker, but can be used in a transient state for internal purposes.
- value
The payload of the transient node, without any specified meaning.
-
sealed abstract
class
Tree extends IRNode with TreeOrJSSpread
Node for a statement or expression in the IR.
-
final
class
TreeHash extends AnyRef
A hash of a tree (usually a MethodDef).
A hash of a tree (usually a MethodDef).
Contains a SHA-1 hash.
-
sealed
trait
TreeOrJSSpread extends IRNode
Either a
Tree
or aJSSpread
.Either a
Tree
or aJSSpread
.This is the type of actual arguments to JS applications.
- case class TryCatch(block: Tree, errVar: Ident, handler: Tree)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class TryFinally(block: Tree, finalizer: Tree)(implicit pos: Position) extends Tree with Product with Serializable
-
case class
UnaryOp(op: Code, lhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Unary operation (always preserves pureness).
- case class Unbox(expr: Tree, charCode: Char)(implicit pos: Position) extends Tree with Product with Serializable
- case class Undefined()(implicit pos: Position) extends Tree with Literal with Product with Serializable
- case class VarDef(name: Ident, vtpe: Type, mutable: Boolean, rhs: Tree)(implicit pos: Position) extends Tree with Product with Serializable
- case class VarRef(ident: Ident)(tpe: Type)(implicit pos: Position) extends Tree with Product with Serializable
- case class While(cond: Tree, body: Tree)(implicit pos: Position) extends Tree with Product with Serializable
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final val isKeyword: Set[String]
- final def isValidIdentifier(name: String): Boolean
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
requireValidIdent(name: String): Unit
- Annotations
- @inline()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- object BinaryOp extends Serializable
- object Block
- object ClassDef
- object Ident extends Serializable
- object JSBinaryOp extends Serializable
- object JSNativeLoadSpec
- object JSUnaryOp extends Serializable
- object OptimizerHints
- object Transient extends Serializable
- object UnaryOp extends Serializable