From d8fdc6daf9486bc9884dbd695146821b773142fd Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 19 Dec 2005 15:47:50 +0000 Subject: --- src/compiler/scala/tools/nsc/Global.scala | 4 ++-- src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala | 2 +- src/compiler/scala/tools/nsc/symtab/Types.scala | 3 ++- .../scala/tools/nsc/symtab/classfile/MetaParser.scala | 2 +- src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 3 +-- src/compiler/scala/tools/nsc/transform/Constructors.scala | 3 ++- src/compiler/scala/tools/nsc/transform/Erasure.scala | 2 +- src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 3 +-- src/compiler/scala/tools/nsc/transform/Flatten.scala | 9 +++------ src/compiler/scala/tools/nsc/transform/LambdaLift.scala | 13 +++++-------- src/compiler/scala/tools/nsc/transform/Mixin.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Codification.scala | 3 ++- src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Infer.scala | 5 +++-- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 5 ++++- .../scala/tools/nsc/typechecker/SuperAccessors.scala | 2 +- .../scala/tools/nsc/typechecker/SyntheticMethods.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 +-- 18 files changed, 33 insertions(+), 35 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 75558c30b5..8c2429985b 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -11,11 +11,11 @@ import scala.tools.util.{SourceReader,ClassPath,AbstractFile}; import scala.tools.nsc.util.{Position,SourceFile}; import scala.tools.nsc.reporters._; -import scala.collection.mutable.{HashSet,HashMap} +import scala.collection.mutable.{HashSet,HashMap,ListBuffer} import symtab._; import symtab.classfile.{PickleBuffer, Pickler}; -import util.{ListBuffer, Statistics}; +import util.Statistics; import ast._; import ast.parser._; import typechecker._; diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 70355350a7..611defb2b0 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -6,7 +6,7 @@ package scala.tools.nsc.ast.parser; import symtab.Flags._; -import util.ListBuffer; +import scala.collection.mutable.ListBuffer; abstract class TreeBuilder { diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 583ca6503c..4eaac75fcf 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -6,7 +6,8 @@ package scala.tools.nsc.symtab; import scala.tools.nsc.util.Position; -import nsc.util.{ListBuffer, HashSet}; +import nsc.util.HashSet; +import scala.collection.mutable.ListBuffer; import Flags._; /* A standard type pattern match: diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala index eca5da7091..41490ad410 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala @@ -6,7 +6,7 @@ package scala.tools.nsc.symtab.classfile; import java.util.{StringTokenizer, NoSuchElementException} -import util.ListBuffer; +import scala.collection.mutable.ListBuffer; import scala.tools.nsc.util.Position; abstract class MetaParser{ diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 0ddcd4d33d..016de25857 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -7,8 +7,7 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.ListBuffer; -import collection.mutable.HashMap; +import collection.mutable.{HashMap, ListBuffer}; abstract class AddInterfaces extends InfoTransform { import global._; // the global environment diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index ea31249d30..b555aa9078 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -7,7 +7,8 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.{ListBuffer, TreeSet} +import scala.collection.mutable.ListBuffer; +import util.TreeSet; abstract class Constructors extends Transform { import global._; diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index c726d2255d..ce2e17e149 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -9,7 +9,7 @@ import collection.mutable.HashMap; import symtab._; import Flags._; import scala.tools.nsc.util.Position; -import util.ListBuffer; +import scala.collection.mutable.ListBuffer; abstract class Erasure extends AddInterfaces with typechecker.Analyzer { import global._; // the global environment diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 2a3fc9a19f..95a500634b 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -7,8 +7,7 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.ListBuffer; -import collection.mutable.HashMap; +import scala.collection.mutable.{HashMap, ListBuffer}; abstract class ExplicitOuter extends InfoTransform { import global._; diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index 031f7a0fcd..d2165492d1 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -7,8 +7,7 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.ListBuffer; -import collection.mutable.HashMap; +import scala.collection.mutable.{HashMap, ListBuffer} abstract class Flatten extends InfoTransform { import global._; @@ -103,10 +102,8 @@ abstract class Flatten extends InfoTransform { /** Transform statements and add lifted definitions to them. */ override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = { val stats1 = super.transformStats(stats, exprOwner); - if (currentOwner.isPackageClass && liftedDefs(currentOwner).hasNext) - stats1 ::: liftedDefs(currentOwner).toList - else - stats1 + if (currentOwner.isPackageClass) stats1 ::: liftedDefs(currentOwner).toList + else stats1 } } } diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 753fc65b48..67f2e4af88 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -7,8 +7,8 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.{ListBuffer, TreeSet}; -import collection.mutable.HashMap; +import util.TreeSet; +import scala.collection.mutable.{HashMap, ListBuffer}; abstract class LambdaLift extends InfoTransform { import global._; @@ -329,12 +329,9 @@ abstract class LambdaLift extends InfoTransform { override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = { def addLifted(stat: Tree): Tree = stat match { case ClassDef(mods, name, tparams, tpt, impl @ Template(parents, body)) => - val result = - if (liftedDefs(stat.symbol).hasNext) { - val lifted = liftedDefs(stat.symbol).toList map addLifted; - copy.ClassDef(stat, mods, name, tparams, tpt, - copy.Template(impl, parents, body ::: lifted)) - } else stat; + val lifted = liftedDefs(stat.symbol).toList map addLifted; + val result = copy.ClassDef( + stat, mods, name, tparams, tpt, copy.Template(impl, parents, body ::: lifted)); liftedDefs -= stat.symbol; result case _ => diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index d20deb8b85..08935e7e16 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -7,8 +7,8 @@ package scala.tools.nsc.transform; import symtab._; import Flags._; -import util.{ListBuffer} import scala.tools.nsc.util.Position; +import scala.collection.mutable.ListBuffer; abstract class Mixin extends InfoTransform { import global._; diff --git a/src/compiler/scala/tools/nsc/typechecker/Codification.scala b/src/compiler/scala/tools/nsc/typechecker/Codification.scala index 1deda7bdfb..59ddca225a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Codification.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Codification.scala @@ -7,7 +7,8 @@ package scala.tools.nsc.typechecker; import symtab.Flags._; import scala.collection.immutable.ListMap; -import scala.tools.nsc.util.{ListBuffer, FreshNameCreator}; +import scala.collection.mutable.ListBuffer; +import scala.tools.nsc.util.FreshNameCreator; [_trait_] abstract class Codification: Analyzer { diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala index f6d481d58b..36dd960342 100644 --- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala +++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala @@ -5,7 +5,7 @@ // $Id$ package scala.tools.nsc.typechecker; -import util.ListBuffer; +import scala.collection.mutable.ListBuffer; import symtab.Flags._; [_trait_] abstract class EtaExpansion: Analyzer { diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index fb03509627..e982ac1ba1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -5,12 +5,13 @@ // $Id$ package scala.tools.nsc.typechecker; +import scala.collection.mutable.ListBuffer; +import symtab.Flags._; + [_trait_] abstract class Infer: Analyzer { - import symtab.Flags._; import global._; import definitions._; import posAssigner.atPos; - import util.ListBuffer; var normM = 0; var normP = 0; diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index bb0aeed305..0fd959e271 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -111,7 +111,10 @@ trait Namers: Analyzer { } else { c = enterInScope(context.owner.newClass(pos, name)).setFlag(flags | inConstructorFlag); } - if (c.owner.isPackageClass) currentRun.symSource(c) = context.unit.source.getFile(); + if (c.owner.isPackageClass) { + currentRun.symSource(c) = context.unit.source.getFile(); + c.sourceFile = context.unit.source.getFile(); + } c } diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index 50749deb5e..4eb38f349b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -5,7 +5,7 @@ // $Id$ package scala.tools.nsc.typechecker; -import nsc.util.ListBuffer; +import scala.collection.mutable.ListBuffer; import nsc.symtab.Flags._; /** A sample transform. diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index da6ac07d6c..005a81d031 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -6,7 +6,7 @@ package scala.tools.nsc.typechecker; import symtab.Flags._; -import util.ListBuffer; +import scala.collection.mutable.ListBuffer; /** * - caseArity, caseElement implementations added to case classes diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index f4098b615a..e6d2e0e8a3 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -6,10 +6,9 @@ //todo: rewrite or disallow new T where T is a trait (currently: not a member of T) package scala.tools.nsc.typechecker; -import nsc.util.ListBuffer; import symtab.Flags._; import scala.tools.nsc.util.Position; -import collection.mutable.HashMap; +import scala.collection.mutable.{HashMap, ListBuffer} /** Methods to create symbols and to enter them into scopes. */ [_trait_] abstract class Typers: Analyzer { -- cgit v1.2.3