dotty.tools.dotc.core.tasty

TastyFormat

Related Doc: package tasty

object TastyFormat

********************************************************** Notation:

We use BNF notation. Terminal symbols start with at least two consecutive upper case letters. Each terminal is represented as a single byte tag. Non-terminals are mixed case. Prefixes of the form lower case letter*_ are for explanation of semantic content only, they can be dropped without changing the grammar.

Micro-syntax:

LongInt = Digit* StopDigit // big endian 2's complement, value fits in a Long w/o overflow Int = LongInt // big endian 2's complement, fits in an Int w/o overflow Nat = LongInt // non-negative value, fits in an Int without overflow Digit = 0 | ... | 127 StopDigit = 128 | ... | 255 // value = digit - 128

Macro-format:

File = Header majorVersion_Nat minorVersion_Nat UUID nameTable_Length Name* Section* Header = 0x5CA1AB1F UUID = Byte*16 // random UUID

Section = NameRef Length Bytes Length = Nat // length of rest of entry in bytes

Name = UTF8 Length UTF8-CodePoint* QUALIFIED Length qualified_NameRef selector_NameRef SIGNED Length original_NameRef resultSig_NameRef paramSig_NameRef* EXPANDED Length original_NameRef OBJECTCLASS Length module_NameRef SUPERACCESSOR Length accessed_NameRef DEFAULTGETTER Length method_NameRef paramNumber_Nat SHADOWED Length original_NameRef MANGLED Length mangle_NameRef name_NameRef ...

NameRef = Nat // ordinal number of name in name table, starting from 1.

Note: Unqualified names in the name table are strings. The context decides whether a name is a type-name or a term-name. The same string can represent both.

Standard-Section: "ASTs" TopLevelStat*

TopLevelStat = PACKAGE Length Path TopLevelStat* Stat

Stat = Term VALDEF Length NameRef Type rhs_Term? Modifier* DEFDEF Length NameRef TypeParam* Params* return_Type rhs_Term? Modifier* TYPEDEF Length NameRef (Type | Template) Modifier* IMPORT Length qual_Term Selector* Selector = IMPORTED name_NameRef RENAMED to_NameRef

// Imports are for scala.meta, they are not used in the backend

TypeParam = TYPEPARAM Length NameRef Type Modifier* Params = PARAMS Length Param* Param = PARAM Length NameRef Type rhs_Term? Modifier* // rhs_Term is present in the case of an aliased class parameter Template = TEMPLATE Length TypeParam* Param* Parent* Self? Stat* // Stat* always starts with the primary constructor. Parent = Application Type Self = SELFDEF selfName_NameRef selfType_Type

Term = Path Application IDENT NameRef Type // used when ident’s type is not a TermRef SELECT possiblySigned_NameRef qual_Term NEW cls_Type SUPER Length this_Term mixinTrait_Type? TYPED Length expr_Term ascription_Type NAMEDARG Length paramName_NameRef arg_Term ASSIGN Length lhs_Term rhs_Term BLOCK Length expr_Term Stat* INLINED Length call_Term expr_Term Stat* LAMBDA Length meth_Term target_Type IF Length cond_Term then_Term else_Term MATCH Length sel_Term CaseDef* TRY Length expr_Term CaseDef* finalizer_Term? RETURN Length meth_ASTRef expr_Term? REPEATED Length elem_Type elem_Term* BIND Length boundName_NameRef patType_Type pat_Term ALTERNATIVE Length alt_Term* UNAPPLY Length fun_Term ImplicitArg* pat_Type pat_Term* EMPTYTREE SHARED term_ASTRef Application = APPLY Length fn_Term arg_Term*

TYPEAPPLY Length fn_Term arg_Type* CaseDef = CASEDEF Length pat_Term rhs_Tree guard_Tree? ImplicitArg = IMPLICITARG arg_Term ASTRef = Nat // byte position in AST payload

Path = Constant TERMREFdirect sym_ASTRef TERMREFsymbol sym_ASTRef qual_Type TERMREFpkg fullyQualified_NameRef TERMREF possiblySigned_NameRef qual_Type THIS clsRef_Type RECthis recType_ASTRef SHARED path_ASTRef

Constant = UNITconst FALSEconst TRUEconst BYTEconst Int SHORTconst Int CHARconst Nat INTconst Int LONGconst LongInt FLOATconst Int DOUBLEconst LongInt STRINGconst NameRef NULLconst CLASSconst Type ENUMconst Path

Type = Path TYPEREFdirect sym_ASTRef TYPEREFsymbol sym_ASTRef qual_Type TYPEREFpkg fullyQualified_NameRef TYPEREF possiblySigned_NameRef qual_Type RECtype parent_Type SUPERtype Length this_Type underlying_Type REFINEDtype Length underlying_Type refinement_NameRef info_Type APPLIEDtype Length tycon_Type arg_Type* TYPEBOUNDS Length low_Type high_Type TYPEALIAS Length alias_Type (COVARIANT | CONTRAVARIANT)? ANNOTATED Length underlying_Type fullAnnotation_Term ANDtype Length left_Type right_Type ORtype Length left_Type right_Type BIND Length boundName_NameRef bounds_Type // for type-variables defined in a type pattern BYNAMEtype underlying_Type POLYtype Length result_Type NamesTypes // variance encoded in front of name: +/-/= METHODtype Length result_Type NamesTypes // needed for refinements PARAMtype Length binder_ASTref paramNum_Nat // needed for refinements SHARED type_ASTRef NamesTypes = NameType* NameType = paramName_NameRef typeOrBounds_ASTRef

Modifier = PRIVATE INTERNAL // package private PROTECTED PRIVATEqualified qualifier_Type // will be dropped PROTECTEDqualified qualifier_Type // will be dropped ABSTRACT FINAL SEALED CASE IMPLICIT LAZY OVERRIDE INLINE // macro STATIC // mapped to static Java member OBJECT // an object or its class TRAIT // a trait LOCAL // private[this] or protected[this] SYNTHETIC // generated by Scala compiler ARTIFACT // to be tagged Java Synthetic MUTABLE // a var LABEL // method generated as a label FIELDaccessor // getter or setter CASEaccessor // getter for case class param COVARIANT // type param marked “+” CONTRAVARIANT // type param marked “-” SCALA2X // Imported from Scala2.x DEFAULTparameterized // Method with default params INSUPERCALL // defined in the argument of a constructor supercall STABLE // Method that is assumed to be stable Annotation Annotation = ANNOTATION Length tycon_Type fullAnnotation_Term

Note: Tree tags are grouped into 5 categories that determine what follows, and thus allow to compute the size of the tagged tree in a generic way.

Category 1 (tags 0-63) : tag Category 2 (tags 64-95) : tag Nat Category 3 (tags 96-111) : tag AST Category 4 (tags 112-127): tag Nat AST Category 5 (tags 128-255): tag Length <payload>

Standard Section: "Positions" Assoc*

Assoc = Header offset_Delta? offset_Delta? Header = addr_Delta + // in one Nat: difference of address to last recorded node << 2 + hasStartDiff + // one bit indicating whether there follows a start address delta << 1 hasEndDiff // one bit indicating whether there follows an end address delta // Nodes which have the same positions as their parents are omitted. // offset_Deltas give difference of start/end offset wrt to the // same offset in the previously recorded node (or 0 for the first recorded node) Delta = Int // Difference between consecutive offsets,

************************************************************************************

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TastyFormat
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final val ABSTRACT: Int(9)

  5. final val ALTERNATIVE: Int(155)

  6. final val ANDtype: Int(171)

  7. final val ANNOTATED: Int(157)

  8. final val ANNOTATION: Int(177)

  9. final val APPLIEDtype: Int(168)

  10. final val APPLY: Int(139)

  11. final val ARTIFACT: Int(22)

  12. final val ASSIGN: Int(145)

  13. final val BIND: Int(154)

  14. final val BLOCK: Int(146)

  15. final val BYNAMEtype: Int(99)

  16. final val BYTEconst: Int(70)

  17. final val CASE: Int(12)

  18. final val CASEDEF: Int(158)

  19. final val CASEaccessor: Int(26)

  20. final val CHARconst: Int(72)

  21. final val CLASSconst: Int(97)

  22. final val CONTRAVARIANT: Int(28)

  23. final val COVARIANT: Int(27)

  24. final val DEFAULTGETTER: Int(7)

  25. final val DEFAULTparameterized: Int(30)

  26. final val DEFDEF: Int(130)

  27. final val DOUBLEconst: Int(76)

  28. final val ENUMconst: Int(98)

  29. final val EXPANDED: Int(4)

  30. final val FALSEconst: Int(3)

  31. final val FIELDaccessor: Int(25)

  32. final val FINAL: Int(10)

  33. final val FLOATconst: Int(75)

  34. final val IDENT: Int(112)

  35. final val IF: Int(147)

  36. final val IMPLICIT: Int(13)

  37. final val IMPLICITarg: Int(101)

  38. final val IMPORT: Int(132)

  39. final val IMPORTED: Int(78)

  40. final val INLINE: Int(16)

  41. final val INLINED: Int(152)

  42. final val INSUPERCALL: Int(31)

  43. final val INTERNAL: Int(7)

  44. final val INTconst: Int(73)

  45. final val LABEL: Int(24)

  46. final val LAMBDA: Int(148)

  47. final val LAZY: Int(14)

  48. final val LOCAL: Int(20)

  49. final val LONGconst: Int(74)

  50. final val MATCH: Int(149)

  51. final val METHODtype: Int(174)

  52. final val MUTABLE: Int(23)

  53. final val MajorVersion: Int(0)

  54. final val MinorVersion: Int(5)

  55. final val NAMEDARG: Int(144)

  56. final val NEW: Int(100)

  57. final val NULLconst: Int(5)

  58. final val OBJECT: Int(18)

  59. final val OBJECTCLASS: Int(5)

  60. final val ORtype: Int(172)

  61. final val OVERRIDE: Int(15)

  62. final val PACKAGE: Int(128)

  63. final val PARAM: Int(136)

  64. final val PARAMS: Int(134)

  65. final val PARAMtype: Int(176)

  66. final val POLYtype: Int(175)

  67. final val PRIVATE: Int(6)

  68. final val PRIVATEqualified: Int(102)

  69. final val PROTECTED: Int(8)

  70. final val PROTECTEDqualified: Int(103)

  71. final val QUALIFIED: Int(2)

  72. final val RECthis: Int(69)

  73. final val RECtype: Int(104)

  74. final val REFINEDtype: Int(167)

  75. final val RENAMED: Int(79)

  76. final val REPEATED: Int(153)

  77. final val RETURN: Int(150)

  78. final val SCALA2X: Int(29)

  79. final val SEALED: Int(11)

  80. final val SELECT: Int(113)

  81. final val SELFDEF: Int(118)

  82. final val SHADOWED: Int(8)

  83. final val SHARED: Int(64)

  84. final val SHORTconst: Int(71)

  85. final val SIGNED: Int(3)

  86. final val STABLE: Int(32)

  87. final val STATIC: Int(17)

  88. final val STRINGconst: Int(77)

  89. final val SUPER: Int(163)

  90. final val SUPERACCESSOR: Int(6)

  91. final val SUPERtype: Int(166)

  92. final val SYNTHETIC: Int(21)

  93. final val TEMPLATE: Int(160)

  94. final val TERMREF: Int(115)

  95. final val TERMREFdirect: Int(65)

  96. final val TERMREFpkg: Int(67)

  97. final val TERMREFsymbol: Int(114)

  98. final val THIS: Int(96)

  99. final val TRAIT: Int(19)

  100. final val TRUEconst: Int(4)

  101. final val TRY: Int(151)

  102. final val TYPEALIAS: Int(170)

  103. final val TYPEAPPLY: Int(140)

  104. final val TYPEBOUNDS: Int(169)

  105. final val TYPED: Int(143)

  106. final val TYPEDEF: Int(131)

  107. final val TYPEPARAM: Int(133)

  108. final val TYPEREF: Int(117)

  109. final val TYPEREFdirect: Int(66)

  110. final val TYPEREFpkg: Int(68)

  111. final val TYPEREFsymbol: Int(116)

  112. final val UNAPPLY: Int(156)

  113. final val UNITconst: Int(2)

  114. final val UTF8: Int(1)

  115. final val VALDEF: Int(129)

  116. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  117. def astTagToString(tag: Int): String

  118. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  119. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  120. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  121. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  122. final val firstASTTreeTag: Int(96)

  123. final val firstLengthTreeTag: Int(128)

  124. final val firstNatASTTreeTag: Int(112)

  125. final val firstNatTreeTag: Int(64)

  126. final val firstSimpleTreeTag: Int(2)

  127. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  128. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  129. final val header: Array[Int]

  130. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  131. def isModifierTag(tag: Int): Boolean

  132. def isParamTag(tag: Int): Boolean

  133. def nameTagToString(tag: Int): String

  134. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  135. final def notify(): Unit

    Definition Classes
    AnyRef
  136. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  137. def numRefs(tag: Int): Int

    returns

    If non-negative, the number of leading references (represented as nats) of a length/trees entry. If negative, minus the number of leading non-reference trees.

  138. val prefixToVariance: Map[Char, Int]

  139. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  140. def toString(): String

    Definition Classes
    AnyRef → Any
  141. val varianceToPrefix: Map[Int, Char]

    Map between variances and name prefixes

  142. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  143. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  144. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped