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 Serializable
trait Product
trait Equals
class Tree
class IRNode
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product
def show: String

Attributes

Inherited from:
IRNode

Concrete fields

val tpe: Type

Implicits

Implicits

implicit val pos: Position