Packages

c

scala.tools.nsc.backend

ScalaPrimitives

abstract class ScalaPrimitives extends AnyRef

Scala primitive operations are represented as methods in Any and AnyVal subclasses. Here we demultiplex them by providing a mapping from their symbols to integers. Different methods exist for different value types, but with the same meaning (like plus, minus, etc.). They will all be mapped to the same int.

Note: The three equal methods have the following semantics:

  • "==" checks for null, and if non-null, calls java.lang.Object.equals (class: Any; modifier: final). Primitive: EQ
  • "eq" usual reference comparison (class: AnyRef; modifier: final). Primitive: ID
  • "equals" user-defined equality (Java semantics) (class: Object; modifier: none). Primitive: EQUALS

Inspired from the scalac compiler.

Source
ScalaPrimitives.scala
Linear Supertypes
AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScalaPrimitives
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ScalaPrimitives()

Abstract Value Members

  1. abstract val global: Global

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to any2stringadd[ScalaPrimitives] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ScalaPrimitives, B)
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to ArrowAssoc[ScalaPrimitives] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final val ADD: Int(10)
  7. final val AND: Int(22)
  8. final val APPLY: Int(71)
  9. final val AS: Int(81)
  10. final val ASR: Int(32)
  11. final val B2B: Int(200)
  12. final val B2C: Int(202)
  13. final val B2D: Int(206)
  14. final val B2F: Int(205)
  15. final val B2I: Int(203)
  16. final val B2L: Int(204)
  17. final val B2S: Int(201)
  18. final val BARRAY_GET: Int(141)
  19. final val BARRAY_LENGTH: Int(132)
  20. final val BARRAY_SET: Int(151)
  21. final val BOX: Int(110)
  22. final val C2B: Int(220)
  23. final val C2C: Int(222)
  24. final val C2D: Int(226)
  25. final val C2F: Int(225)
  26. final val C2I: Int(223)
  27. final val C2L: Int(224)
  28. final val C2S: Int(221)
  29. final val CARRAY_GET: Int(143)
  30. final val CARRAY_LENGTH: Int(134)
  31. final val CARRAY_SET: Int(153)
  32. final val COERCE: Int(101)
  33. final val CONCAT: Int(100)
  34. final val D2B: Int(260)
  35. final val D2C: Int(262)
  36. final val D2D: Int(266)
  37. final val D2F: Int(265)
  38. final val D2I: Int(263)
  39. final val D2L: Int(264)
  40. final val D2S: Int(261)
  41. final val DARRAY_GET: Int(147)
  42. final val DARRAY_LENGTH: Int(138)
  43. final val DARRAY_SET: Int(157)
  44. final val DIV: Int(13)
  45. final val EQ: Int(42)
  46. final val F2B: Int(250)
  47. final val F2C: Int(252)
  48. final val F2D: Int(256)
  49. final val F2F: Int(255)
  50. final val F2I: Int(253)
  51. final val F2L: Int(254)
  52. final val F2S: Int(251)
  53. final val FARRAY_GET: Int(146)
  54. final val FARRAY_LENGTH: Int(137)
  55. final val FARRAY_SET: Int(156)
  56. final val GE: Int(47)
  57. final val GT: Int(46)
  58. final val HASH: Int(87)
  59. final val I2B: Int(230)
  60. final val I2C: Int(232)
  61. final val I2D: Int(236)
  62. final val I2F: Int(235)
  63. final val I2I: Int(233)
  64. final val I2L: Int(234)
  65. final val I2S: Int(231)
  66. final val IARRAY_GET: Int(144)
  67. final val IARRAY_LENGTH: Int(135)
  68. final val IARRAY_SET: Int(154)
  69. final val ID: Int(40)
  70. final val IS: Int(80)
  71. final val L2B: Int(240)
  72. final val L2C: Int(242)
  73. final val L2D: Int(246)
  74. final val L2F: Int(245)
  75. final val L2I: Int(243)
  76. final val L2L: Int(244)
  77. final val L2S: Int(241)
  78. final val LARRAY_GET: Int(145)
  79. final val LARRAY_LENGTH: Int(136)
  80. final val LARRAY_SET: Int(155)
  81. final val LE: Int(45)
  82. final val LENGTH: Int(70)
  83. final val LSL: Int(30)
  84. final val LSR: Int(31)
  85. final val LT: Int(44)
  86. final val MOD: Int(14)
  87. final val MUL: Int(12)
  88. final val NE: Int(43)
  89. final val NEG: Int(2)
  90. final val NEW_BARRAY: Int(113)
  91. final val NEW_CARRAY: Int(115)
  92. final val NEW_DARRAY: Int(119)
  93. final val NEW_FARRAY: Int(118)
  94. final val NEW_IARRAY: Int(116)
  95. final val NEW_LARRAY: Int(117)
  96. final val NEW_OARRAY: Int(120)
  97. final val NEW_SARRAY: Int(114)
  98. final val NEW_ZARRAY: Int(112)
  99. final val NI: Int(41)
  100. final val NOT: Int(3)
  101. final val OARRAY_GET: Int(148)
  102. final val OARRAY_LENGTH: Int(139)
  103. final val OARRAY_SET: Int(158)
  104. final val OR: Int(20)
  105. final val POS: Int(1)
  106. final val S2B: Int(210)
  107. final val S2C: Int(212)
  108. final val S2D: Int(216)
  109. final val S2F: Int(215)
  110. final val S2I: Int(213)
  111. final val S2L: Int(214)
  112. final val S2S: Int(211)
  113. final val SARRAY_GET: Int(142)
  114. final val SARRAY_LENGTH: Int(133)
  115. final val SARRAY_SET: Int(152)
  116. final val SUB: Int(11)
  117. final val SYNCHRONIZED: Int(90)
  118. final val UNBOX: Int(111)
  119. final val UPDATE: Int(72)
  120. final val XOR: Int(21)
  121. final val ZAND: Int(61)
  122. final val ZARRAY_GET: Int(140)
  123. final val ZARRAY_LENGTH: Int(131)
  124. final val ZARRAY_SET: Int(150)
  125. final val ZNOT: Int(50)
  126. final val ZOR: Int(60)
  127. def addPrimitive(s: Global.Symbol, code: Int): Unit

    Add a primitive operation to the map

  128. def addPrimitives(cls: Global.Symbol, method: Global.Name, code: Int): Unit
  129. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  130. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  131. def ensuring(cond: (ScalaPrimitives) ⇒ Boolean, msg: ⇒ Any): ScalaPrimitives
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to Ensuring[ScalaPrimitives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  132. def ensuring(cond: (ScalaPrimitives) ⇒ Boolean): ScalaPrimitives
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to Ensuring[ScalaPrimitives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  133. def ensuring(cond: Boolean, msg: ⇒ Any): ScalaPrimitives
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to Ensuring[ScalaPrimitives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  134. def ensuring(cond: Boolean): ScalaPrimitives
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to Ensuring[ScalaPrimitives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  135. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  136. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  137. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  138. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to StringFormat[ScalaPrimitives] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  139. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  140. def getPrimitive(fun: Global.Symbol, tpe: Global.Type): Int

    Return the primitive code of the given operation.

    Return the primitive code of the given operation. If the operation is an array get/set, we inspect the type of the receiver to demux the operation.

    fun

    The method symbol

    tpe

    The type of the receiver object. It is used only for array operations

  141. def getPrimitive(sym: Global.Symbol): Int

    Return the code for the given symbol.

  142. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  143. def init(): Unit

    Initialize the primitive map

  144. def isArithmeticOp(code: Int): Boolean
  145. def isArrayGet(code: Int): Boolean
  146. def isArrayLength(code: Int): Boolean
  147. def isArrayNew(code: Int): Boolean
  148. def isArrayOp(code: Int): Boolean

    Check whether the given operation code is an array operation.

  149. def isArraySet(code: Int): Boolean
  150. def isBitwiseOp(code: Int): Boolean
  151. def isCoercion(code: Int): Boolean
  152. def isComparisonOp(code: Int): Boolean

    Check whether the given code is a comparison operator

  153. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  154. def isLogicalOp(code: Int): Boolean
  155. def isPrimitive(sym: Global.Symbol): Boolean
  156. def isReferenceEqualityOp(code: Int): Boolean
  157. def isShiftOp(code: Int): Boolean
  158. def isUniversalEqualityOp(code: Int): Boolean
  159. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  160. final def notify(): Unit
    Definition Classes
    AnyRef
  161. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  162. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  163. def toString(): String
    Definition Classes
    AnyRef → Any
  164. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  165. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  166. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  167. def [B](y: B): (ScalaPrimitives, B)
    Implicit
    This member is added by an implicit conversion from ScalaPrimitives to ArrowAssoc[ScalaPrimitives] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ScalaPrimitives to any2stringadd[ScalaPrimitives]

Inherited by implicit conversion StringFormat from ScalaPrimitives to StringFormat[ScalaPrimitives]

Inherited by implicit conversion Ensuring from ScalaPrimitives to Ensuring[ScalaPrimitives]

Inherited by implicit conversion ArrowAssoc from ScalaPrimitives to ArrowAssoc[ScalaPrimitives]

Ungrouped