diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-02-08 15:37:34 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-02-08 15:37:34 +0000 |
commit | ac7dc3c10243af1bb3affb0ffb0a369b9b1bfeaa (patch) | |
tree | c2e7abc58df2728b62956c8ffb9f36a376721f47 /src | |
parent | 7577ec4388010c7c927a2d2050b59dea97c508a2 (diff) | |
download | scala-ac7dc3c10243af1bb3affb0ffb0a369b9b1bfeaa.tar.gz scala-ac7dc3c10243af1bb3affb0ffb0a369b9b1bfeaa.tar.bz2 scala-ac7dc3c10243af1bb3affb0ffb0a369b9b1bfeaa.zip |
fix msil build (nested classes in particular).
Diffstat (limited to 'src')
-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 |
2 files changed, 22 insertions, 10 deletions
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) } |