JSEncoding

dotty.tools.backend.sjs.JSEncoding$
object JSEncoding

Encoding of symbol names for JavaScript

Some issues that this encoding solves:

  • Overloading: encode the full signature in the JS name
  • Same scope for fields and methods of a class
  • Global access to classes and modules (by their full name)

Attributes

Authors:

Sébastien Doeraene

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def encodeClassNameIdent(sym: Symbol)(implicit ctx: Context, pos: Position): ClassIdent
def encodeFieldSym(sym: Symbol)(implicit ctx: Context, pos: Position): FieldIdent
def encodeLabelSym(sym: Symbol)(implicit ctx: Context, pos: Position, localNames: LocalNameGenerator): LabelIdent
def encodeLocalSym(sym: Symbol)(implicit ctx: Context, pos: Position, localNames: LocalNameGenerator): LocalIdent
def encodeMethodSym(sym: Symbol, reflProxy: Boolean)(implicit ctx: Context, pos: Position): MethodIdent
def originalNameOfLocal(sym: Symbol)(implicit ctx: Context, localNames: LocalNameGenerator): OriginalName

Patches the result type of a method symbol to sanitize it.

Patches the result type of a method symbol to sanitize it.

For some reason, dotc thinks that the info.resultTypeof an isConstructor method (for classes or traits) is the enclosing class or trait, but the bodies and usages act as if the result type was Unit.

This method returns UnitType for constructor methods, and otherwise sym.info.resultType.

Attributes

def toIRType(tp: Type)(using Context): Type

Converts a general TypeRef to a TypeRef to be used in a method signature.

Converts a general TypeRef to a TypeRef to be used in a method signature.

Attributes

def toTypeRef(tp: Type)(using Context): TypeRef

Concrete fields

Name of the capture param storing the JS super class.

Name of the capture param storing the JS super class.

This is used by the dispatchers of exposed JS methods and properties of nested JS classes when they need to perform a super call. Other super calls (in the actual bodies of the methods, not in the dispatchers) do not use this value, since they are implemented as static methods that do not have access to it. Instead, they get the JS super class value through the magic method inserted by ExplicitLocalJS, leveraging lambdalift to ensure that it is properly captured.

Using this identifier is only allowed if it was reserved in the current local name scope using reserveLocalName. Otherwise, this name can clash with another local identifier.

Attributes