diff options
-rw-r--r-- | lib/msil.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala | 16 | ||||
-rw-r--r-- | src/msil/ch/epfl/lamp/compiler/msil/emit/TypeBuilder.scala | 16 |
3 files changed, 23 insertions, 11 deletions
diff --git a/lib/msil.jar.desired.sha1 b/lib/msil.jar.desired.sha1 index 457da38de3..cfdfc0b26e 100644 --- a/lib/msil.jar.desired.sha1 +++ b/lib/msil.jar.desired.sha1 @@ -1 +1 @@ -92c69c96c171b36e7ad36fb9c77fec822d766876 ?msil.jar +009cec9efeb8f9b9287e49da1c4b69e1a629b299 ?msil.jar diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index bd7601c9ec..4177cddd3f 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -1530,9 +1530,10 @@ abstract class GenMSIL extends SubComponent { else if (sym == definitions.NullClass) return "scala.runtime.Null$" - (if (sym.isClass || (sym.isModule && !sym.isMethod)) - sym.fullName - else + (if (sym.isClass || (sym.isModule && !sym.isMethod)) { + if (sym.isNestedClass) sym.simpleName + else sym.fullName + } else sym.simpleName.toString().trim()) + suffix } @@ -1662,7 +1663,14 @@ abstract class GenMSIL extends SubComponent { case FLOAT => MFLOAT case DOUBLE => MDOUBLE case REFERENCE(cls) => getType(cls) - case ARRAY(elem) => clrTypes.mkArrayType(msilType(elem)) + case ARRAY(elem) => + msilType(elem) match { + // For type builders, cannot call "clrTypes.mkArrayType" because this looks up + // the type "tp" in the assembly (not in the HashMap "types" of the backend). + // This can fail for nested types because the biulders are not complete yet. + case tb: TypeBuilder => tb.MakeArrayType() + case tp: MsilType => clrTypes.mkArrayType(tp) + } } private def msilType(tpe: Type): MsilType = msilType(toTypeKind(tpe)) diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/TypeBuilder.scala b/src/msil/ch/epfl/lamp/compiler/msil/emit/TypeBuilder.scala index 84fd2a4023..2c0ab29b90 100644 --- a/src/msil/ch/epfl/lamp/compiler/msil/emit/TypeBuilder.scala +++ b/src/msil/ch/epfl/lamp/compiler/msil/emit/TypeBuilder.scala @@ -141,14 +141,19 @@ class TypeBuilder (module: Module, attributes: Int, fullName: String, baseType: /** Searches for the nested type with the specified name. */ override def GetNestedType(name: String): Type = { - testRaw(name) - return super.GetNestedType(name) + testRaw(name) + super.GetNestedType(name) } /** Returns all the types nested within the current Type. */ override def GetNestedTypes(): Array[Type] = { - testRaw("<GetNestedTypes>") - return super.GetNestedTypes() + testRaw("<GetNestedTypes>") + super.GetNestedTypes() + } + + /** Returns a Type object that represents a one-dimensional array of the current type */ + def MakeArrayType(): Type = { + Type.mkArray(this, 1) } /** Sets a custom attribute. */ @@ -184,8 +189,7 @@ class TypeBuilder (module: Module, attributes: Int, fullName: String, baseType: // i.e. not finalized by call to CreateType protected def testRaw(member: String) { if (raw) - throw new RuntimeException - ("Not supported for TypeBuilder before CreateType(): " + + throw new RuntimeException("Not supported for TypeBuilder before CreateType(): " + FullName + "::" + member) } |