diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build/four.xml | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/Trees.scala | 35 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/InfoTransform.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/LambdaLift.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 3 |
8 files changed, 44 insertions, 15 deletions
diff --git a/src/build/four.xml b/src/build/four.xml index ac42b45294..82520023bd 100644 --- a/src/build/four.xml +++ b/src/build/four.xml @@ -297,7 +297,8 @@ work on a JVM 1.5. ============================================================================ --> <target name="four-test.suite" depends="four-pack.done"> - <partest showlog="yes" erroronfailed="no" scalacopts="-target:jvm-1.4" javacmd="${java.home}/bin/java -Xmx1024M"> + <partest showlog="yes" erroronfailed="yes" scalacopts="-target:jvm-1.4" + javacmd="${java.home}/bin/java -Xmx1024M"> <classpath> <pathelement location="${build-four-pack.dir}/lib/scala-library.jar"/> <pathelement location="${build-four-pack.dir}/lib/scala-compiler.jar"/> @@ -334,7 +335,8 @@ work on a JVM 1.4. </target> <target name="fourfour-test.suite" depends="fourfour-test.start"> - <partest showlog="yes" erroronfailed="no" scalacopts="-target:jvm-1.4" javacmd="${java.home}/bin/java -Xmx1024M"> + <partest showlog="yes" erroronfailed="yes" scalacopts="-target:jvm-1.4" + javacmd="${java.home}/bin/java -Xmx1024M"> <classpath> <pathelement location="${build-four-pack.dir}/lib/scala-library.jar"/> <pathelement location="${build-four-pack.dir}/lib/scala-compiler.jar"/> diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index c15b45f091..5bbf52faf2 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -455,6 +455,10 @@ class Scalac extends MatchingTask { ** Hooks for variants of Scala ** \*============================================================================*/ + protected def binaryEnding = backend match { + case Some("msil") => ".msil" + case _ => ".class" + } protected def newSettings(error: String=>Unit): Settings = new Settings(error) protected def newGlobal(settings: Settings, reporter: Reporter) = @@ -474,8 +478,10 @@ class Scalac extends MatchingTask { error("Attribute 'destdir' does not refer to an existing directory.") if (destination.isEmpty) destination = Some(getOrigin.head) + // TODO msil: map packages (will be in filename for .msil files). Use + // RegexppatternMapper (?) val mapper = new GlobPatternMapper() - mapper.setTo("*.class") + mapper.setTo("*" + binaryEnding) mapper.setFrom("*.scala") var javaOnly = true diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index 94c19baa34..67cc057b03 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -333,7 +333,7 @@ abstract class TreeBrowsers { ("Apply", EMPTY) case ApplyDynamic(qual, args) => - ("Apply", EMPTY) + ("ApplyDynamic", EMPTY) case Super(qualif, mix) => ("Super", qualif.toString() + ", mix: " + mix.toString()) diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 929f623c2d..cdb62a6950 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -1353,30 +1353,36 @@ trait Trees { } case ClassDef(mods, name, tparams, impl) => atOwner(tree.symbol) { - copy.ClassDef(tree, mods, name, transformTypeDefs(tparams), transformTemplate(impl)) + copy.ClassDef(tree, transformModifiers(mods), name, + transformTypeDefs(tparams), transformTemplate(impl)) } case ModuleDef(mods, name, impl) => atOwner(tree.symbol.moduleClass) { - copy.ModuleDef(tree, mods, name, transformTemplate(impl)) + copy.ModuleDef(tree, transformModifiers(mods), name, + transformTemplate(impl)) } case ValDef(mods, name, tpt, rhs) => atOwner(tree.symbol) { - copy.ValDef(tree, mods, name, transform(tpt), transform(rhs)) + copy.ValDef(tree, transformModifiers(mods), name, + transform(tpt), transform(rhs)) } case DefDef(mods, name, tparams, vparamss, tpt, rhs) => atOwner(tree.symbol) { copy.DefDef( - tree, mods, name, transformTypeDefs(tparams), transformValDefss(vparamss), transform(tpt), transform(rhs)) + tree, transformModifiers(mods), name,transformTypeDefs(tparams), + transformValDefss(vparamss), transform(tpt), transform(rhs)) } case TypeDef(mods, name, tparams, rhs) => atOwner(tree.symbol) { - copy.TypeDef(tree, mods, name, transformTypeDefs(tparams), transform(rhs)) + copy.TypeDef(tree, transformModifiers(mods), name, + transformTypeDefs(tparams), transform(rhs)) } case LabelDef(name, params, rhs) => copy.LabelDef(tree, name, transformIdents(params), transform(rhs)) //bq: Martin, once, atOwner(...) works, also change `LamdaLifter.proxy' case Import(expr, selectors) => copy.Import(tree, transform(expr), selectors) case Annotation(constr, elements) => +// println("transforming annotation: "+ this +"("+constr.getClass+")") copy.Annotation(tree, transform(constr), transformTrees(elements)) case DocDef(comment, definition) => copy.DocDef(tree, comment, transform(definition)) @@ -1476,6 +1482,9 @@ trait Trees { List.mapConserve(stats)(stat => if (exprOwner != currentOwner && stat.isTerm) atOwner(exprOwner)(transform(stat)) else transform(stat)) filter (EmptyTree !=) + def transformModifiers(mods: Modifiers): Modifiers = mods /* + Modifiers(mods.flags, mods.privateWithin, + mods.annotations.map(transform(_).asInstanceOf[Annotation])) */ def transformUnit(unit: CompilationUnit) { unit.body = transform(unit.body) } def atOwner[A](owner: Symbol)(trans: => A): A = { @@ -1498,29 +1507,35 @@ trait Trees { } case ClassDef(mods, name, tparams, impl) => atOwner(tree.symbol) { - traverseTrees(mods.annotations); traverseTrees(tparams); traverse(impl) + traverseTrees(mods.annotations) + traverseTrees(tparams); traverse(impl) } case ModuleDef(mods, name, impl) => atOwner(tree.symbol.moduleClass) { - traverseTrees(mods.annotations); traverse(impl) + traverseTrees(mods.annotations); + traverse(impl) } case ValDef(mods, name, tpt, rhs) => atOwner(tree.symbol) { - traverseTrees(mods.annotations); traverse(tpt); traverse(rhs) + traverseTrees(mods.annotations); + traverse(tpt); traverse(rhs) } case DefDef(mods, name, tparams, vparamss, tpt, rhs) => atOwner(tree.symbol) { - traverseTrees(mods.annotations); traverseTrees(tparams); traverseTreess(vparamss); traverse(tpt); traverse(rhs) + traverseTrees(mods.annotations); + traverseTrees(tparams); traverseTreess(vparamss); traverse(tpt); traverse(rhs) } case TypeDef(mods, name, tparams, rhs) => atOwner(tree.symbol) { - traverseTrees(mods.annotations); traverseTrees(tparams); traverse(rhs) + traverseTrees(mods.annotations); + traverseTrees(tparams); traverse(rhs) } case LabelDef(name, params, rhs) => traverseTrees(params); traverse(rhs) case Import(expr, selectors) => traverse(expr) case Annotation(constr, elements) => +// println("traversing annotation: "+ this +"("+constr.getClass+")") traverse(constr); traverseTrees(elements) case Annotated(annot, arg) => traverse(annot); traverse(arg) diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 0cb94b899f..55adde0c46 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2425,6 +2425,8 @@ A type's typeSymbol should never be inspected directly. // throw new Error("mapOver inapplicable for " + tp); } + /** Calls mapOver for the args, but with inverted variance for + * contravariant arguments */ def mapOverArgs(args: List[Type], tparams: List[Symbol]): List[Type] = map2Conserve(args, tparams) { (arg, tparam) => val v = variance diff --git a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala index d130abb336..e5b3e87458 100644 --- a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala +++ b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala @@ -30,6 +30,7 @@ trait InfoTransform extends Transform { val pid = id val changesBaseClasses = InfoTransform.this.changesBaseClasses def transform(sym: Symbol, tpe: Type): Type = transformInfo(sym, tpe) + override def toString() = InfoTransform.this.toString() } infoTransformers.insert(infoTransformer) } diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 38be297d4c..5b4d3349b7 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -194,6 +194,7 @@ abstract class LambdaLift extends InfoTransform { tree match { case ClassDef(_, _, _, _) => liftedDefs(tree.symbol) = new ListBuffer +// println("new lb for: "+ tree.symbol) if (sym.isLocal) renamable addEntry sym case DefDef(_, _, _, _, _, _) => if (sym.isLocal) { @@ -405,6 +406,7 @@ abstract class LambdaLift extends InfoTransform { val result = copy.ClassDef( stat, mods, name, tparams, copy.Template(impl, parents, self, body ::: lifted)) liftedDefs -= stat.symbol +// println("removed: "+ stat.symbol) result case _ => stat diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index bb552de8b9..d60ba017e3 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -484,7 +484,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { val sym = tree.symbol // a local variable that is mutable and free somewhere later should be lifted // as lambda lifting (coming later) will wrap 'rhs' in an Ref object. - if (!sym.owner.isSourceMethod || (sym.isVariable && freeMutableVars(sym))) + if (sym != NoSymbol && (!sym.owner.isSourceMethod || + (sym.isVariable && freeMutableVars(sym)))) withNeedLift(true) { super.transform(tree) } else super.transform(tree) |