diff options
author | Miguel Garcia <magarcia@epfl.ch> | 2011-03-20 10:55:55 +0000 |
---|---|---|
committer | Miguel Garcia <magarcia@epfl.ch> | 2011-03-20 10:55:55 +0000 |
commit | 6eb6e8ca22ce4c5f3f41cd12139ad57354f82eb2 (patch) | |
tree | 9fd26cc4a5462fee73b2f23943e1a262608929a6 | |
parent | 50eb40bcd602a5898e3d816c0efa6a5d08b51c43 (diff) | |
download | scala-6eb6e8ca22ce4c5f3f41cd12139ad57354f82eb2.tar.gz scala-6eb6e8ca22ce4c5f3f41cd12139ad57354f82eb2.tar.bz2 scala-6eb6e8ca22ce4c5f3f41cd12139ad57354f82eb2.zip |
for .NET bootstrapping (more coming).
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 42 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/StdNames.scala | 30 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala | 9 |
3 files changed, 31 insertions, 50 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index 5f9a7d2816..118d650586 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -843,48 +843,6 @@ trait Definitions extends reflect.generic.StandardDefinitions { setParents(sym, anyvalparam) } - if (forMSIL) { - val intType = IntClass.typeConstructor - val intParam = List(intType) - val longType = LongClass.typeConstructor - val charType = CharClass.typeConstructor - val unitType = UnitClass.typeConstructor - val stringType = StringClass.typeConstructor - val stringParam = List(stringType) - - // additional methods of Object - newMethod(ObjectClass, "clone", List(), AnyRefClass.typeConstructor) - // wait in Java returns void, on .NET Wait returns boolean. by putting - // `booltype` the compiler adds a `drop` after calling wait. - newMethod(ObjectClass, "wait", List(), booltype) - newMethod(ObjectClass, "wait", List(longType), booltype) - newMethod(ObjectClass, "notify", List(), unitType) - newMethod(ObjectClass, "notifyAll", List(), unitType) - - // additional methods of String - newMethod(StringClass, "length", List(), intType) - newMethod(StringClass, "compareTo", stringParam, intType) - newMethod(StringClass, "charAt", intParam, charType) - newMethod(StringClass, "concat", stringParam, stringType) - newMethod(StringClass, "indexOf", intParam, intType) - newMethod(StringClass, "indexOf", List(intType, intType), intType) - newMethod(StringClass, "indexOf", stringParam, intType) - newMethod(StringClass, "indexOf", List(stringType, intType), intType) - newMethod(StringClass, "lastIndexOf", intParam, intType) - newMethod(StringClass, "lastIndexOf", List(intType, intType), intType) - newMethod(StringClass, "lastIndexOf", stringParam, intType) - newMethod(StringClass, "lastIndexOf", List(stringType, intType), intType) - newMethod(StringClass, "toLowerCase", List(), stringType) - newMethod(StringClass, "toUpperCase", List(), stringType) - newMethod(StringClass, "startsWith", stringParam, booltype) - newMethod(StringClass, "endsWith", stringParam, booltype) - newMethod(StringClass, "substring", intParam, stringType) - newMethod(StringClass, "substring", List(intType, intType), stringType) - newMethod(StringClass, "trim", List(), stringType) - newMethod(StringClass, "intern", List(), stringType) - newMethod(StringClass, "replace", List(charType, charType), stringType) - newMethod(StringClass, "toCharArray", List(), arrayType(charType)) - } isInitialized = true } //init diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala index ec545fa4c6..8c2966e494 100644 --- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala +++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala @@ -186,7 +186,7 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { val canEqual_ : NameType = "canEqual" val checkInitialized: NameType = "checkInitialized" val classOf: NameType = "classOf" - val clone_ : NameType = "clone" + val clone_ : NameType = sn.OClone val conforms: NameType = "conforms" val copy: NameType = "copy" val delayedInit: NameType = "delayedInit" @@ -195,19 +195,19 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { val drop: NameType = "drop" val elem: NameType = "elem" val eq: NameType = "eq" - val equals_ : NameType = "equals" + val equals_ : NameType = sn.OEquals val error: NameType = "error" val ex: NameType = "ex" val false_ : NameType = "false" val filter: NameType = "filter" - val finalize_ : NameType = "finalize" + val finalize_ : NameType = sn.OFinalize val find_ : NameType = "find" val flatMap: NameType = "flatMap" val foreach: NameType = "foreach" val genericArrayOps: NameType = "genericArrayOps" val get: NameType = "get" val hasNext: NameType = "hasNext" - val hashCode_ : NameType = "hashCode" + val hashCode_ : NameType = sn.OHashCode val hash_ : NameType = "hash" val head: NameType = "head" val identity: NameType = "identity" @@ -246,7 +246,7 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { val toArray: NameType = "toArray" val toList: NameType = "toList" val toSeq: NameType = "toSeq" - val toString_ : NameType = "toString" + val toString_ : NameType = sn.OToString val true_ : NameType = "true" val unapply: NameType = "unapply" val unapplySeq: NameType = "unapplySeq" @@ -430,6 +430,12 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { val Invoke : TermName val JavaLang : TermName + val OClone : String + val OEquals : String + val OFinalize : String + val OHashCode : String + val OToString : String + val Boxed: immutable.Map[TypeName, TypeName] } @@ -527,6 +533,12 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { final val Invoke: TermName = "invoke" final val JavaLang: TermName = "java.lang" + final val OClone = "clone" + final val OEquals = "equals" + final val OFinalize = "finalize" + final val OHashCode = "hashCode" + final val OToString = "toString" + val Boxed = immutable.Map[TypeName, TypeName]( tpnme.Boolean -> BoxedBoolean, tpnme.Byte -> BoxedByte, @@ -565,9 +577,15 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { final val Invoke: TermName = "Invoke" final val JavaLang: TermName = "System" + final val OClone = "MemberwiseClone" + final val OEquals = "Equals" + final val OFinalize = "Finalize" + final val OHashCode = "GetHashCode" + final val OToString = "ToString" + val Boxed = immutable.Map[TypeName, TypeName]( tpnme.Boolean -> "System.Boolean", - tpnme.Byte -> "System.Byte", + tpnme.Byte -> "System.SByte", // a scala.Byte is signed and a System.SByte too (unlike a System.Byte) tpnme.Char -> "System.Char", tpnme.Short -> "System.Int16", tpnme.Int -> "System.Int32", diff --git a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala index c7b3a7a736..cf1f7f1db3 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/CLRTypes.scala @@ -66,8 +66,8 @@ abstract class CLRTypes { def isAddressOf(msym : Symbol) = addressOfViews.contains(msym) - def isNonEnumValuetype(clssym : Symbol) = { - val msilTOpt = types.get(clssym) + def isNonEnumValuetype(cls: Symbol) = { + val msilTOpt = types.get(cls) val res = msilTOpt.isDefined && { val msilT = msilTOpt.get msilT.IsValueType && !msilT.IsEnum @@ -75,6 +75,11 @@ abstract class CLRTypes { res } + def isValueType(cls: Symbol): Boolean = { + val opt = types.get(cls) + opt.isDefined && opt.get.IsValueType + } + def init() = try { // initialize // the MsilClasspath (nsc/util/Classpath.scala) initializes the msil-library by calling // Assembly.LoadFrom("mscorlib.dll"), so this type should be found |