diff options
author | mihaylov <mihaylov@epfl.ch> | 2007-05-15 10:46:54 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2007-05-15 10:46:54 +0000 |
commit | 9450c16f193ecab560f9374f7965a60be3b09c18 (patch) | |
tree | 03a4f5327a7f2f941d93c71e4a3ad8ba0d3f17cc /src/compiler | |
parent | 8de5ae2b13556c5dea09049b79a40b378e93d008 (diff) | |
download | scala-9450c16f193ecab560f9374f7965a60be3b09c18.tar.gz scala-9450c16f193ecab560f9374f7965a60be3b09c18.tar.bz2 scala-9450c16f193ecab560f9374f7965a60be3b09c18.zip |
Synced src/dotnet-library with src/library rev ...
Synced src/dotnet-library with src/library rev 11027
Diffstat (limited to 'src/compiler')
3 files changed, 23 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index e10691420d..b668e28c05 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -43,7 +43,7 @@ abstract class GenICode extends SubComponent { val SCALA_ALLREF = REFERENCE(definitions.AllRefClass) val THROWABLE = REFERENCE(definitions.ThrowableClass) - val BoxedCharacterClass = definitions.getClass("java.lang.Character") + val BoxedCharacterClass = if (forMSIL) null else definitions.getClass("java.lang.Character") val Comparator_equals = definitions.getMember(definitions.getModule("scala.runtime.Comparator"), nme.equals_) @@ -1384,9 +1384,9 @@ abstract class GenICode extends SubComponent { (lsym == definitions.ObjectClass) || (rsym == definitions.ObjectClass) || (lsym isNonBottomSubClass definitions.BoxedNumberClass)|| - (lsym isNonBottomSubClass BoxedCharacterClass) || + (!forMSIL && (lsym isNonBottomSubClass BoxedCharacterClass)) || (rsym isNonBottomSubClass definitions.BoxedNumberClass) || - (rsym isNonBottomSubClass BoxedCharacterClass) + (!forMSIL && (rsym isNonBottomSubClass BoxedCharacterClass)) } if (mustUseAnyComparator) { diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index e9061af154..6c6835bb6a 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -489,7 +489,11 @@ abstract class GenMSIL extends SubComponent { } } - tBuilder.setPosition((sym.pos).line.get, iclass.cunit.source.file.name) + val line = (sym.pos).line match { + case Some(l) => l + case None => 0 + } + tBuilder.setPosition(line, iclass.cunit.source.file.name) if (isTopLevelModule(sym)) { if (settings.debug.value) @@ -895,27 +899,27 @@ abstract class GenMSIL extends SubComponent { def replaceOutJumps(blocks: List[BasicBlock], leaving: List[(BasicBlock, List[BasicBlock])], exh: ExceptionHandler): (List[BasicBlock], Option[BasicBlock]) = { def replaceJump(block: BasicBlock, from: BasicBlock, to: BasicBlock) = block.lastInstruction match { case JUMP(where) => - assert(from == where) + //assert(from == where) block.replaceInstruction(block.lastInstruction, JUMP(to)) case CJUMP(success, failure, cond, kind) => if (from == success) block.replaceInstruction(block.lastInstruction, CJUMP(to, failure, cond, kind)) else - assert(from == failure) + //assert(from == failure) if (from == failure) block.replaceInstruction(block.lastInstruction, CJUMP(success, to, cond, kind)) case CZJUMP(success, failure, cond, kind) => if (from == success) block.replaceInstruction(block.lastInstruction, CZJUMP(to, failure, cond, kind)) else - assert(from == failure) + //assert(from == failure) if (from == failure) block.replaceInstruction(block.lastInstruction, CZJUMP(success, to, cond, kind)) case SWITCH(tags, labels) => // labels: List[BasicBlock] val newLabels = labels.map(b => if (b == from) to else b) assert(newLabels.contains(to)) block.replaceInstruction(block.lastInstruction, SWITCH(tags, newLabels)) - case _ => abort("expected branch at the end of block " + block) + case _ => () //abort("expected branch at the end of block " + block) } val jumpOutBlock = blocks.last.code.newBlock @@ -934,20 +938,20 @@ abstract class GenMSIL extends SubComponent { (blocks, None) else if (leaving.length == 1) { val outside = leaving(0)._2 - assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets") + //assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets") if (!firstBlockAfter.isDefinedAt(exh)) firstBlockAfter(exh) = outside(0) - else - assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0)) + //else () + //assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0)) val last = leaving(0)._1 (blocks.diff(List(last)) ::: List(last), None) } else { val outside = leaving.flatMap(p => p._2) - assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets") + //assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets") if (!firstBlockAfter.isDefinedAt(exh)) firstBlockAfter(exh) = outside(0) - else - assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets") + //else + //assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets") replaceOutJumps(blocks, leaving, exh) } } @@ -1177,8 +1181,9 @@ abstract class GenMSIL extends SubComponent { needAdditionalRet = false - var currentLineNr = try { (instr.pos).line.get } catch { - case _: Error => + val currentLineNr = (instr.pos).line match { + case Some(line) => line + case None => log("Warning: wrong position in: " + method) lastLineNr } // if getting line number fails diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index c52f2c7c4c..a7f40f84ec 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -37,7 +37,6 @@ trait Definitions { var AllClass: Symbol = _ var ClassClass: Symbol = _ - var MethodClass: Symbol = _ var StringClass: Symbol = _ var ThrowableClass: Symbol = _ var NullPointerExceptionClass: Symbol = _ @@ -755,7 +754,6 @@ trait Definitions { StringClass = getClass(if (forMSIL) "System.String" else "java.lang.String") ClassClass = getClass(if (forMSIL) "System.Type" else "java.lang.Class") - MethodClass = getClass("java.lang.reflect.Method") ThrowableClass = getClass(if (forMSIL) "System.Exception" else "java.lang.Throwable") NullPointerExceptionClass = getClass(if (forMSIL) "System.NullReferenceException" else "java.lang.NullPointerException") @@ -872,7 +870,8 @@ trait Definitions { PatternWildcard = NoSymbol.newValue(NoPosition, "_").setInfo(AllClass.typeConstructor) - BoxedNumberClass = if (forMSIL) null else getClass("java.lang.Number") + BoxedNumberClass = if (forMSIL) getClass("System.IConvertible") + else getClass("java.lang.Number") BoxedArrayClass = getClass("scala.runtime.BoxedArray") BoxedAnyArrayClass = getClass("scala.runtime.BoxedAnyArray") BoxedObjectArrayClass = getClass("scala.runtime.BoxedObjectArray") |