Main codegen for Scala.js IR.
GenSJSIR creates one instance of JSCodeGen
per compilation unit. The run()
method processes the whole compilation unit and generates .sjsir
files for it.
There are 4 main levels of translation:
genCompilationUnit()
iterates through all the type definitions in the compilation unit. Each generatedjs.ClassDef
is serialized to an.sjsir
file.genScalaClass()
and other similar methods generate the skeleton of classes.genMethod()
and similar methods generate the declarations of methods.genStatOrExpr()
and everything else generate the bodies of methods.
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Boxes a value of the given type before elimErasedValueType
.
Boxes a value of the given type before elimErasedValueType
.
This should be used when sending values to a JavaScript context, which is erased/boxed at the IR level, although it is not erased at the dotty/JVM level.
Value parameters
- expr
-
Tree to be boxed if needed.
- tpeEnteringElimErasedValueType
-
The type of
expr
as it was entering theelimErasedValueType
phase.
Attributes
Returns a new fresh local identifier.
Returns a new fresh local identifier.
Attributes
Gen a call to a non-exposed method of a non-native JS class.
Gen a call to a non-exposed method of a non-native JS class.
Attributes
Gen a dynamically linked call to a Scala method.
Gen a dynamically linked call to a Scala method.
Attributes
Gen a statically linked call to an instance method.
Gen a statically linked call to an instance method.
Attributes
Gen a statically linked call to an instance method.
Gen a statically linked call to an instance method.
Attributes
Gen JS code for a tree in expression position (in the IR) or the global scope.
Gen JS code for a tree in expression position (in the IR) or the global scope.
Attributes
Gen JS code for an isInstanceOf test (for reference types only)
Gen JS code for an isInstanceOf test (for reference types only)
Attributes
Wraps a js.Array
to use as varargs.
Wraps a js.Array
to use as varargs.
Attributes
Generates the JSNativeMemberDef.
Generates the JSNativeMemberDef.
Attributes
Generate loading of a module value.
Generate loading of a module value.
Can be given either the module symbol or its module class symbol.
If the module we load refers to the global scope (i.e., it is annotated with @JSGlobalScope
), report a compile error specifying that a global scope object should only be used as the qualifier of a .
-selection.
Attributes
Generate loading of a module value or the global scope.
Generate loading of a module value or the global scope.
Can be given either the module symbol of its module class symbol.
Unlike genLoadModule
, this method does not fail if the module we load refers to the global scope.
Attributes
Gen JS code for a switch-Match
, which is translated into an IR js.Match
.
Gen JS code for a switch-Match
, which is translated into an IR js.Match
.
Attributes
Gen the static forwarders to the members of a class or interface for methods of its companion object.
Gen the static forwarders to the members of a class or interface for methods of its companion object.
This is only done if there exists a companion object and it is not a JS type.
Precondition: isCandidateForForwarders(sym)
is true
Attributes
Gen the static forwarders for the methods of a module class.
Gen the static forwarders for the methods of a module class.
Precondition: isCandidateForForwarders(moduleClass)
is true
Attributes
Is the given Scala class, interface or module class a candidate for static forwarders?
Is the given Scala class, interface or module class a candidate for static forwarders?
- the flag
-XnoForwarders
is not set to true, and - the symbol is static, and
- either of both of the following is true:
- the flag
-scalajsGenStaticForwardersForNonTopLevelObjects
is set to true, or - the symbol was originally at the package level
- the flag
Other than the Scala.js-specific flag, and the fact that we also consider interfaces, this performs the same tests as the JVM back-end.
Attributes
Unboxes a value typed as Any to the given type before elimErasedValueType
.
Unboxes a value typed as Any to the given type before elimErasedValueType
.
This should be used when receiving values from a JavaScript context, which is erased/boxed at the IR level, although it is not erased at the dotty/JVM level.
Value parameters
- expr
-
Tree to be extracted.
- tpeEnteringElimErasedValueType
-
The type of
expr
as it was entering theelimErasedValueType
phase.
Attributes
Concrete fields
Implicits
Implicits
Implicitly materializes the current local name generator.
Implicitly materializes the current local name generator.