diff options
-rw-r--r-- | sources/scala/None.scala | 3 | ||||
-rw-r--r-- | sources/scala/Some.scala | 1 | ||||
-rw-r--r-- | sources/scalac/Global.java | 18 | ||||
-rw-r--r-- | sources/scalac/ast/parser/Sourcefile.java | 2 | ||||
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 15 | ||||
-rw-r--r-- | sources/scalac/typechecker/Analyzer.java | 5 |
6 files changed, 18 insertions, 26 deletions
diff --git a/sources/scala/None.scala b/sources/scala/None.scala index fe034a3f34..767bb80ec8 100644 --- a/sources/scala/None.scala +++ b/sources/scala/None.scala @@ -2,5 +2,6 @@ package scala { final case class None[b] extends Option[b] { def isNone = true; def get: b = error("None does not have an element."); + override def toString() = "None"; } -} +}
\ No newline at end of file diff --git a/sources/scala/Some.scala b/sources/scala/Some.scala index 84d9a529fa..84df35c8d7 100644 --- a/sources/scala/Some.scala +++ b/sources/scala/Some.scala @@ -2,5 +2,6 @@ package scala { final case class Some[c](x: c) extends Option[c] { def isNone = false; def get: c = x; + override def toString() = "Some(" + x + ")" } } diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java index c4ecc98a88..5c5b94ccc2 100644 --- a/sources/scalac/Global.java +++ b/sources/scalac/Global.java @@ -86,7 +86,7 @@ public class Global { /** The set of currenttly compiled top-level symbols */ - public HashSet/*Symbol*/ compiledNow = new HashSet(); + public HashMap/*<Symbol,Sourcefile>*/ compiledNow = new HashMap(); /** the current phase */ @@ -283,8 +283,10 @@ public class Global { } if (reporter.errors() != 0) { imports.clear(); - for (Iterator it = compiledNow.iterator(); it.hasNext();) { - uninitialize((Symbol)it.next()); + for (Iterator it = compiledNow.keySet().iterator(); it.hasNext();) { + Symbol sym = (Symbol) it.next(); + Sourcefile f = (Sourcefile) compiledNow.get(sym); + sym.reset(new SourceCompleter(this, f.filename)); } } compiledNow.clear(); @@ -629,14 +631,4 @@ public class Global { reporter.inform("[" + message + " in " + (System.currentTimeMillis() - start) + "ms]"); } - - private void uninitialize(Symbol sym) { - if (sym instanceof ClassSymbol) { - ClassSymbol clazz = (ClassSymbol)sym; - if (clazz.sourcefile != null) { - clazz.reset( - new SourceCompleter(this, clazz.sourcefile)); - } - } - } } diff --git a/sources/scalac/ast/parser/Sourcefile.java b/sources/scalac/ast/parser/Sourcefile.java index 517e0dd5dd..3ac0a9d4bd 100644 --- a/sources/scalac/ast/parser/Sourcefile.java +++ b/sources/scalac/ast/parser/Sourcefile.java @@ -35,7 +35,7 @@ public class Sourcefile { /** the filename */ - protected String filename; + public String filename; public String shortname; public String pathname; diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 35ceb28e36..3beeb0b0db 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -1148,13 +1148,6 @@ public class ClassSymbol extends TypeSymbol { */ final private Type thistp = Type.ThisType(this); - /** The sourcefile name form where the class symbol was or - * needs to be loaded. only defined for Scala source library classes; - * not for classes that exist in class files, or classes compiled - * from the command line. - */ - public String sourcefile = null; - /** Principal Constructor */ public ClassSymbol(int pos, Name name, Symbol owner, int flags) { @@ -1177,7 +1170,6 @@ public class ClassSymbol extends TypeSymbol { this.module = TermSymbol.newCompanionModule(this, 0, parser); this.mangled = name; this.setInfo(parser); - this.sourcefile = parser.filename; } /** Constructor for classes to load as class files. @@ -1198,7 +1190,6 @@ public class ClassSymbol extends TypeSymbol { other.constructor.setInfo(constructor.info()); other.mangled = mangled; other.module = module; - other.sourcefile = sourcefile; if (thisSym != this) other.setTypeOfThis(typeOfThis()); return other; } @@ -1354,6 +1345,9 @@ public final class ErrorSymbol extends Symbol { public Symbol enclClass() { return this; } + + public void reset(Type completer) { + } } /** The class of Symbol.NONE @@ -1400,6 +1394,9 @@ public final class NoSymbol extends Symbol { public Symbol owner() { throw new ApplicationError(); } + + public void reset(Type completer) { + } } /** A class for symbols generated in label definitions. diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index 7f830152cc..0c24bd31b5 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -812,7 +812,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { } result = other; } else if (sym.owner().isPackage()) { - if (global.compiledNow.contains(other)) { + if (global.compiledNow.get(other) != null) { error(sym.pos, sym + " is compiled twice"); } context.scope.unlink(e); @@ -836,7 +836,8 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { } else { context.scope.enter(sym); } - if (result.owner().isPackage()) global.compiledNow.add(result); + if (result.owner().isPackage()) + global.compiledNow.put(result, unit.source); return result; } |