LoadJSConstructor
org.scalajs.ir.Trees.LoadJSConstructor
sealed case class LoadJSConstructor(className: ClassName)(implicit pos: Position) extends Tree
Loads the constructor of a JS class (native or not).
className
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 as
JSNew(LoadJSConstructor(ClassName("Foo")), List(IntLiteral(1)))
This node is also useful to encode o.isInstanceOf[Foo]
:
JSBinaryOp(instanceof, o, LoadJSConstructor(ClassName("Foo")))
If Foo
is non-native, the presence of this node makes it instantiable, and therefore reachable.
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Treetrait TreeOrJSSpreadclass IRNodeclass Objecttrait Matchableclass Any
Members list
In this article