Dotty Documentation

0.13.0-bin-SNAPSHOT

object JSEncoding
extends Object

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)

[-] Constructors

[-] Members

[+] class LocalNameGenerator
[+] private object LocalNameGenerator
[+] final class MyNameOps
[+] object MyNameOps
[+] final class SymOps
[+] object SymOps
[+] private final val ScalaJSEnvironmentName : "ScalaJS"

Name given to the local Scala.js environment variable

[+] private final val SignatureSep : "__"

Signature separator string (between parameter types)

[+] private def allRefClasses ( implicit ctx: Context ) : Set [ Symbol ]
[+] def encodeClassFullName ( sym: Symbol ) ( implicit ctx: Context ) : String
[+] def encodeClassFullNameIdent ( sym: Symbol ) ( implicit ctx: Context , pos: Position ) : Ident
[+] def encodeClassType ( sym: Symbol ) ( implicit ctx: Context ) : Type
[+] def encodeFieldSym ( sym: Symbol ) ( implicit ctx: Context , pos: Position ) : Ident
[+] def encodeLabelSym ( sym: Symbol ) ( implicit ctx: Context , pos: Position , localNames: LocalNameGenerator ) : Ident
[+] def encodeLocalSym ( sym: Symbol ) ( implicit ctx: Context , pos: Position , localNames: LocalNameGenerator ) : Ident
[+] private def encodeMemberNameInternal ( sym: Symbol ) ( implicit ctx: Context ) : String
[+] def encodeMethodName ( sym: Symbol , reflProxy: Boolean ) ( implicit ctx: Context ) : String
[+] def encodeMethodName$default$2 : Boolean
[+] private def encodeMethodNameInternal ( sym: Symbol , reflProxy: Boolean , inRTClass: Boolean ) ( implicit ctx: Context ) : ( String, String )
[+] private def encodeMethodNameInternal$default$2 : Boolean
[+] private def encodeMethodNameInternal$default$3 : Boolean
[+] def encodeMethodSym ( sym: Symbol , reflProxy: Boolean ) ( implicit ctx: Context , pos: Position ) : Ident
[+] def encodeMethodSym$default$2 : Boolean
[+] def encodeStaticMemberSym ( sym: Symbol ) ( implicit ctx: Context , pos: Position ) : Ident
[+] private def encodeTypeRef ( typeRef: TypeRef ) : String

Encodes a [[Types.TypeRef]], such as in an encoded method signature.

[+] def foreignIsImplClass ( sym: Symbol ) ( implicit ctx: Context ) : Boolean
[+] private def internalName ( tpe: Type ) ( implicit ctx: Context ) : String

Computes the internal name for a type.

[+] private def makeParamsString ( sym: Symbol , reflProxy: Boolean , inRTClass: Boolean ) ( implicit ctx: Context ) : String
[+] private def makeParamsString ( paramAndResultTypeNames: List [ String ] ) : String
[+] private def mangleJSName ( name: String ) : String

Mangles names that are illegal in JavaScript by prepending a $. Also mangles names that would collide with these mangled names.

[+] def patchedResultType ( sym: Symbol ) ( implicit ctx: Context ) : Type

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.

[+] def toIRType ( tp: Type ) ( implicit ctx: Context ) : Type
[+] def toTypeRef ( tp: Type ) ( implicit ctx: Context ) : TypeRef
[+] private def toTypeRefInternal ( tp: Type ) ( implicit ctx: Context ) : ( TypeRef, Symbol )