JSSuperMethodCall
sealed case class JSSuperMethodCall(superClass: Tree, receiver: Tree, method: Tree, args: List[TreeOrJSSpread])(implicit pos: Position) extends Tree
Calls a method inherited from the given superClass
on receiver
.
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(ClassName("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 be This()
, this is equivalent to the ES6
statement
super[method](...args)
trait Serializable
trait Product
trait Equals
class Tree
trait TreeOrJSSpread
class IRNode
class Object
trait Matchable
class Any