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

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 encodeClassName(sym: Symbol)(using Context): ClassName
def encodeClassNameIdent(sym: Symbol)(implicit ctx: Context, pos: Position): ClassIdent
def encodeClassRef(sym: Symbol)(using Context): ClassRef
def encodeClassType(sym: Symbol)(using Context): Type
def encodeDynamicImportForwarderIdent(params: List[Symbol])(using Context, Position): MethodIdent
def encodeFieldSym(sym: Symbol)(implicit ctx: Context, pos: Position): FieldIdent
def encodeFieldSymAsStringLiteral(sym: Symbol)(implicit ctx: Context, pos: Position): StringLiteral
def encodeJSNativeMemberSym(sym: Symbol)(using Context, Position): MethodIdent
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 encodeStaticMemberSym(sym: Symbol)(using Context, Position): MethodIdent
def originalNameOfClass(sym: Symbol)(using Context): OriginalName
def originalNameOfField(sym: Symbol)(using Context): OriginalName
def originalNameOfLocal(sym: Symbol)(implicit ctx: Context, localNames: LocalNameGenerator): OriginalName
def originalNameOfMethod(sym: Symbol)(using Context): 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
def toIRTypeAndTypeRef(tp: Type)(using Context): (Type, TypeRef)
def toParamOrResultTypeRef(typeRef: TypeRef): TypeRef

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

final val JSSuperClassParamName: LocalName

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