Class

scala.tools.nsc.backend

ScalaPrimitives

Related Doc: package backend

Permalink

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:

Inspired from the scalac compiler.

Source
ScalaPrimitives.scala
Linear Supertypes
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()

    Permalink

Abstract Value Members

  1. abstract val global: Global

    Permalink

Concrete Value Members

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

    Permalink

    Test two objects for inequality.

    Test two objects for inequality.

    returns

    true if !(this == that), false otherwise.

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

    Permalink

    Equivalent to x.hashCode except for boxed numeric types and null.

    Equivalent to x.hashCode except for boxed numeric types and null. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    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)

    Permalink
    Implicit information
    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

    Permalink

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  6. final val ADD: Int(10)

    Permalink
  7. final val AND: Int(22)

    Permalink
  8. final val APPLY: Int(71)

    Permalink
  9. final val AS: Int(81)

    Permalink
  10. final val ASR: Int(32)

    Permalink
  11. final val B2B: Int(200)

    Permalink
  12. final val B2C: Int(202)

    Permalink
  13. final val B2D: Int(206)

    Permalink
  14. final val B2F: Int(205)

    Permalink
  15. final val B2I: Int(203)

    Permalink
  16. final val B2L: Int(204)

    Permalink
  17. final val B2S: Int(201)

    Permalink
  18. final val BARRAY_GET: Int(141)

    Permalink
  19. final val BARRAY_LENGTH: Int(132)

    Permalink
  20. final val BARRAY_SET: Int(151)

    Permalink
  21. final val BOX: Int(110)

    Permalink
  22. final val C2B: Int(220)

    Permalink
  23. final val C2C: Int(222)

    Permalink
  24. final val C2D: Int(226)

    Permalink
  25. final val C2F: Int(225)

    Permalink
  26. final val C2I: Int(223)

    Permalink
  27. final val C2L: Int(224)

    Permalink
  28. final val C2S: Int(221)

    Permalink
  29. final val CARRAY_GET: Int(143)

    Permalink
  30. final val CARRAY_LENGTH: Int(134)

    Permalink
  31. final val CARRAY_SET: Int(153)

    Permalink
  32. final val COERCE: Int(101)

    Permalink
  33. final val CONCAT: Int(100)

    Permalink
  34. final val D2B: Int(260)

    Permalink
  35. final val D2C: Int(262)

    Permalink
  36. final val D2D: Int(266)

    Permalink
  37. final val D2F: Int(265)

    Permalink
  38. final val D2I: Int(263)

    Permalink
  39. final val D2L: Int(264)

    Permalink
  40. final val D2S: Int(261)

    Permalink
  41. final val DARRAY_GET: Int(147)

    Permalink
  42. final val DARRAY_LENGTH: Int(138)

    Permalink
  43. final val DARRAY_SET: Int(157)

    Permalink
  44. final val DIV: Int(13)

    Permalink
  45. final val EQ: Int(42)

    Permalink
  46. final val F2B: Int(250)

    Permalink
  47. final val F2C: Int(252)

    Permalink
  48. final val F2D: Int(256)

    Permalink
  49. final val F2F: Int(255)

    Permalink
  50. final val F2I: Int(253)

    Permalink
  51. final val F2L: Int(254)

    Permalink
  52. final val F2S: Int(251)

    Permalink
  53. final val FARRAY_GET: Int(146)

    Permalink
  54. final val FARRAY_LENGTH: Int(137)

    Permalink
  55. final val FARRAY_SET: Int(156)

    Permalink
  56. final val GE: Int(46)

    Permalink
  57. final val GT: Int(47)

    Permalink
  58. final val HASH: Int(87)

    Permalink
  59. final val I2B: Int(230)

    Permalink
  60. final val I2C: Int(232)

    Permalink
  61. final val I2D: Int(236)

    Permalink
  62. final val I2F: Int(235)

    Permalink
  63. final val I2I: Int(233)

    Permalink
  64. final val I2L: Int(234)

    Permalink
  65. final val I2S: Int(231)

    Permalink
  66. final val IARRAY_GET: Int(144)

    Permalink
  67. final val IARRAY_LENGTH: Int(135)

    Permalink
  68. final val IARRAY_SET: Int(154)

    Permalink
  69. final val ID: Int(40)

    Permalink
  70. final val IS: Int(80)

    Permalink
  71. final val L2B: Int(240)

    Permalink
  72. final val L2C: Int(242)

    Permalink
  73. final val L2D: Int(246)

    Permalink
  74. final val L2F: Int(245)

    Permalink
  75. final val L2I: Int(243)

    Permalink
  76. final val L2L: Int(244)

    Permalink
  77. final val L2S: Int(241)

    Permalink
  78. final val LARRAY_GET: Int(145)

    Permalink
  79. final val LARRAY_LENGTH: Int(136)

    Permalink
  80. final val LARRAY_SET: Int(155)

    Permalink
  81. final val LE: Int(45)

    Permalink
  82. final val LENGTH: Int(70)

    Permalink
  83. final val LSL: Int(30)

    Permalink
  84. final val LSR: Int(31)

    Permalink
  85. final val LT: Int(44)

    Permalink
  86. final val MOD: Int(14)

    Permalink
  87. final val MUL: Int(12)

    Permalink
  88. final val NE: Int(43)

    Permalink
  89. final val NEG: Int(2)

    Permalink
  90. final val NEW_BARRAY: Int(113)

    Permalink
  91. final val NEW_CARRAY: Int(115)

    Permalink
  92. final val NEW_DARRAY: Int(119)

    Permalink
  93. final val NEW_FARRAY: Int(118)

    Permalink
  94. final val NEW_IARRAY: Int(116)

    Permalink
  95. final val NEW_LARRAY: Int(117)

    Permalink
  96. final val NEW_OARRAY: Int(120)

    Permalink
  97. final val NEW_SARRAY: Int(114)

    Permalink
  98. final val NEW_ZARRAY: Int(112)

    Permalink
  99. final val NI: Int(41)

    Permalink
  100. final val NOT: Int(3)

    Permalink
  101. final val OARRAY_GET: Int(148)

    Permalink
  102. final val OARRAY_LENGTH: Int(139)

    Permalink
  103. final val OARRAY_SET: Int(158)

    Permalink
  104. final val OR: Int(20)

    Permalink
  105. final val POS: Int(1)

    Permalink
  106. final val S2B: Int(210)

    Permalink
  107. final val S2C: Int(212)

    Permalink
  108. final val S2D: Int(216)

    Permalink
  109. final val S2F: Int(215)

    Permalink
  110. final val S2I: Int(213)

    Permalink
  111. final val S2L: Int(214)

    Permalink
  112. final val S2S: Int(211)

    Permalink
  113. final val SARRAY_GET: Int(142)

    Permalink
  114. final val SARRAY_LENGTH: Int(133)

    Permalink
  115. final val SARRAY_SET: Int(152)

    Permalink
  116. final val SUB: Int(11)

    Permalink
  117. final val SYNCHRONIZED: Int(90)

    Permalink
  118. final val UNBOX: Int(111)

    Permalink
  119. final val UPDATE: Int(72)

    Permalink
  120. final val XOR: Int(21)

    Permalink
  121. final val ZAND: Int(61)

    Permalink
  122. final val ZARRAY_GET: Int(140)

    Permalink
  123. final val ZARRAY_LENGTH: Int(131)

    Permalink
  124. final val ZARRAY_SET: Int(150)

    Permalink
  125. final val ZNOT: Int(50)

    Permalink
  126. final val ZOR: Int(60)

    Permalink
  127. def addPrimitive(s: Global.Symbol, code: Int): Unit

    Permalink

    Add a primitive operation to the map

  128. def addPrimitives(cls: Global.Symbol, method: Global.Name, code: Int): Unit

    Permalink
  129. final def asInstanceOf[T0]: T0

    Permalink

    Cast the receiver object to be of type T0.

    Cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expression List(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

    the receiver object.

    Definition Classes
    Any
    Exceptions thrown

    ClassCastException if the receiver object is not an instance of the erasure of type T0.

  130. def clone(): AnyRef

    Permalink

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
    Note

    not specified by SLS as a member of AnyRef

  131. def ensuring(cond: (ScalaPrimitives) ⇒ Boolean, msg: ⇒ Any): ScalaPrimitives

    Permalink
    Implicit information
    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

    Permalink
    Implicit information
    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

    Permalink
    Implicit information
    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

    Permalink
    Implicit information
    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

    Permalink

    Tests whether the argument (that) is a reference to the receiver object (this).

    Tests whether the argument (that) is a reference to the receiver object (this).

    The eq method implements an equivalence relation on non-null instances of AnyRef, and has three additional properties:

    • It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false.
    • For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.
    • null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    returns

    true if the argument is a reference to the receiver object; false otherwise.

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

    Permalink

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to eq.

    See also equals in scala.Any.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

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

    Permalink

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the finalize method is invoked, as well as the interaction between finalize and non-local returns and exceptions, are all platform dependent.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
    Note

    not specified by SLS as a member of AnyRef

  138. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    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. def generatedKind(code: Int): Global.icodes.TypeKind

    Permalink

    If code is a coercion primitive, the result type

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

    Permalink

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
    AnyRef → Any
    Note

    not specified by SLS as a member of AnyRef

  141. def getPrimitive(fun: Global.Symbol, tpe: Global.Type): Int

    Permalink

    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

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

    Permalink

    Return the code for the given symbol.

  143. def hashCode(): Int

    Permalink

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in scala.Any.

    returns

    the hash code value for this object.

    Definition Classes
    AnyRef → Any
  144. def init(): Unit

    Permalink

    Initialize the primitive map

  145. def isArithmeticOp(code: Int): Boolean

    Permalink
  146. def isArrayGet(code: Int): Boolean

    Permalink
  147. def isArrayLength(code: Int): Boolean

    Permalink
  148. def isArrayNew(code: Int): Boolean

    Permalink
  149. def isArrayOp(code: Int): Boolean

    Permalink

    Check whether the given operation code is an array operation.

  150. def isArraySet(code: Int): Boolean

    Permalink
  151. def isBitwiseOp(code: Int): Boolean

    Permalink
  152. def isCoercion(code: Int): Boolean

    Permalink
  153. def isComparisonOp(code: Int): Boolean

    Permalink

    Check whether the given code is a comparison operator

  154. final def isInstanceOf[T0]: Boolean

    Permalink

    Test whether the dynamic type of the receiver object is T0.

    Test whether the dynamic type of the receiver object is T0.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression 1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    Definition Classes
    Any
  155. def isLogicalOp(code: Int): Boolean

    Permalink
  156. def isPrimitive(sym: Global.Symbol): Boolean

    Permalink
  157. def isReferenceEqualityOp(code: Int): Boolean

    Permalink
  158. def isShiftOp(code: Int): Boolean

    Permalink
  159. def isUniversalEqualityOp(code: Int): Boolean

    Permalink
  160. final def ne(arg0: AnyRef): Boolean

    Permalink

    Equivalent to !(this eq that).

    Equivalent to !(this eq that).

    returns

    true if the argument is not a reference to the receiver object; false otherwise.

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

    Permalink

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  162. final def notifyAll(): Unit

    Permalink

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

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

    Permalink
    Definition Classes
    AnyRef
  164. def toString(): String

    Permalink

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    AnyRef → Any
  165. final val typeOfArrayOp: Map[Int, Global.icodes.TypeKind]

    Permalink
  166. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  169. def [B](y: B): (ScalaPrimitives, B)

    Permalink
    Implicit information
    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