Add a primitive operation to the map
If code is a coercion primitive, the result type
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.
The method symbol
The type of the receiver object. It is used only for array operations
Return the code for the given symbol.
Initialize the primitive map
Check whether the given operation code is an array operation.
Check whether the given code is a comparison operator
(scalaPrimitives: StringAdd).self
(scalaPrimitives: StringFormat).self
(scalaPrimitives: ArrowAssoc[ScalaPrimitives]).x
(Since version 2.10.0) Use leftOfArrow
instead
(scalaPrimitives: Ensuring[ScalaPrimitives]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
Scala primitive operations are represented as methods in
Any
andAnyVal
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 fornull
, and if non-null, callsjava.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.