@@ -392,9 +392,9 @@ class Definitions {
392
392
def ArrayModule (implicit ctx : Context ) = ArrayModuleType .symbol.moduleClass.asClass
393
393
394
394
395
- lazy val UnitType : TypeRef = valueTypeRef(" scala.Unit" , BoxedUnitType , java.lang.Void .TYPE , UnitEnc )
395
+ lazy val UnitType : TypeRef = valueTypeRef(" scala.Unit" , BoxedUnitType , java.lang.Void .TYPE , UnitEnc , nme.specializedTypeNames. Void )
396
396
def UnitClass (implicit ctx : Context ) = UnitType .symbol.asClass
397
- lazy val BooleanType = valueTypeRef(" scala.Boolean" , BoxedBooleanType , java.lang.Boolean .TYPE , BooleanEnc )
397
+ lazy val BooleanType = valueTypeRef(" scala.Boolean" , BoxedBooleanType , java.lang.Boolean .TYPE , BooleanEnc , nme.specializedTypeNames. Boolean )
398
398
def BooleanClass (implicit ctx : Context ) = BooleanType .symbol.asClass
399
399
lazy val Boolean_notR = BooleanClass .requiredMethodRef(nme.UNARY_! )
400
400
def Boolean_! = Boolean_notR .symbol
@@ -413,13 +413,13 @@ class Definitions {
413
413
})
414
414
def Boolean_!= = Boolean_neqeqR .symbol
415
415
416
- lazy val ByteType : TypeRef = valueTypeRef(" scala.Byte" , BoxedByteType , java.lang.Byte .TYPE , ByteEnc )
416
+ lazy val ByteType : TypeRef = valueTypeRef(" scala.Byte" , BoxedByteType , java.lang.Byte .TYPE , ByteEnc , nme.specializedTypeNames. Byte )
417
417
def ByteClass (implicit ctx : Context ) = ByteType .symbol.asClass
418
- lazy val ShortType : TypeRef = valueTypeRef(" scala.Short" , BoxedShortType , java.lang.Short .TYPE , ShortEnc )
418
+ lazy val ShortType : TypeRef = valueTypeRef(" scala.Short" , BoxedShortType , java.lang.Short .TYPE , ShortEnc , nme.specializedTypeNames. Short )
419
419
def ShortClass (implicit ctx : Context ) = ShortType .symbol.asClass
420
- lazy val CharType : TypeRef = valueTypeRef(" scala.Char" , BoxedCharType , java.lang.Character .TYPE , CharEnc )
420
+ lazy val CharType : TypeRef = valueTypeRef(" scala.Char" , BoxedCharType , java.lang.Character .TYPE , CharEnc , nme.specializedTypeNames. Char )
421
421
def CharClass (implicit ctx : Context ) = CharType .symbol.asClass
422
- lazy val IntType : TypeRef = valueTypeRef(" scala.Int" , BoxedIntType , java.lang.Integer .TYPE , IntEnc )
422
+ lazy val IntType : TypeRef = valueTypeRef(" scala.Int" , BoxedIntType , java.lang.Integer .TYPE , IntEnc , nme.specializedTypeNames. Int )
423
423
def IntClass (implicit ctx : Context ) = IntType .symbol.asClass
424
424
lazy val Int_minusR = IntClass .requiredMethodRef(nme.MINUS , List (IntType ))
425
425
def Int_- = Int_minusR .symbol
@@ -435,7 +435,7 @@ class Definitions {
435
435
def Int_>= = Int_geR .symbol
436
436
lazy val Int_leR = IntClass .requiredMethodRef(nme.LE , List (IntType ))
437
437
def Int_<= = Int_leR .symbol
438
- lazy val LongType : TypeRef = valueTypeRef(" scala.Long" , BoxedLongType , java.lang.Long .TYPE , LongEnc )
438
+ lazy val LongType : TypeRef = valueTypeRef(" scala.Long" , BoxedLongType , java.lang.Long .TYPE , LongEnc , nme.specializedTypeNames. Long )
439
439
def LongClass (implicit ctx : Context ) = LongType .symbol.asClass
440
440
lazy val Long_XOR_Long = LongType .member(nme.XOR ).requiredSymbol(
441
441
x => (x is Method ) && (x.info.firstParamTypes.head isRef defn.LongClass )
@@ -450,9 +450,9 @@ class Definitions {
450
450
lazy val Long_divR = LongClass .requiredMethodRef(nme.DIV , List (LongType ))
451
451
def Long_/ = Long_divR .symbol
452
452
453
- lazy val FloatType : TypeRef = valueTypeRef(" scala.Float" , BoxedFloatType , java.lang.Float .TYPE , FloatEnc )
453
+ lazy val FloatType : TypeRef = valueTypeRef(" scala.Float" , BoxedFloatType , java.lang.Float .TYPE , FloatEnc , nme.specializedTypeNames. Float )
454
454
def FloatClass (implicit ctx : Context ) = FloatType .symbol.asClass
455
- lazy val DoubleType : TypeRef = valueTypeRef(" scala.Double" , BoxedDoubleType , java.lang.Double .TYPE , DoubleEnc )
455
+ lazy val DoubleType : TypeRef = valueTypeRef(" scala.Double" , BoxedDoubleType , java.lang.Double .TYPE , DoubleEnc , nme.specializedTypeNames. Double )
456
456
def DoubleClass (implicit ctx : Context ) = DoubleType .symbol.asClass
457
457
458
458
lazy val BoxedUnitType : TypeRef = ctx.requiredClassRef(" scala.runtime.BoxedUnit" )
@@ -979,15 +979,17 @@ class Definitions {
979
979
980
980
private val boxedTypes = mutable.Map [TypeName , TypeRef ]()
981
981
private val valueTypeEnc = mutable.Map [TypeName , PrimitiveClassEnc ]()
982
+ private val typeTags = mutable.Map [TypeName , Name ]().withDefaultValue(nme.specializedTypeNames.Object )
982
983
983
984
// private val unboxedTypeRef = mutable.Map[TypeName, TypeRef]()
984
985
// private val javaTypeToValueTypeRef = mutable.Map[Class[_], TypeRef]()
985
986
// private val valueTypeNameToJavaType = mutable.Map[TypeName, Class[_]]()
986
987
987
- private def valueTypeRef (name : String , boxed : TypeRef , jtype : Class [_], enc : Int ): TypeRef = {
988
+ private def valueTypeRef (name : String , boxed : TypeRef , jtype : Class [_], enc : Int , tag : Name ): TypeRef = {
988
989
val vcls = ctx.requiredClassRef(name)
989
990
boxedTypes(vcls.name) = boxed
990
991
valueTypeEnc(vcls.name) = enc
992
+ typeTags(vcls.name) = tag
991
993
// unboxedTypeRef(boxed.name) = vcls
992
994
// javaTypeToValueTypeRef(jtype) = vcls
993
995
// valueTypeNameToJavaType(vcls.name) = jtype
@@ -997,6 +999,9 @@ class Definitions {
997
999
/** The type of the boxed class corresponding to primitive value type `tp`. */
998
1000
def boxedType (tp : Type )(implicit ctx : Context ): TypeRef = boxedTypes(scalaClassName(tp))
999
1001
1002
+ /** The JVM tag for `tp` if it's a primitive, `java.lang.Object` otherwise. */
1003
+ def typeTag (tp : Type )(implicit ctx : Context ): Name = typeTags(scalaClassName(tp))
1004
+
1000
1005
type PrimitiveClassEnc = Int
1001
1006
1002
1007
val ByteEnc = 2
0 commit comments