diff options
author | Martin Odersky <odersky@gmail.com> | 2003-03-21 15:48:37 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-03-21 15:48:37 +0000 |
commit | 787d4bb9dbc540a61632c1f234a54ab74a69609c (patch) | |
tree | b09ef894e8f03e68f3defd96ad71c362741bf76c /sources/scalac | |
parent | 54952ba17e2c99e3c842068b7b091ebbf4093921 (diff) | |
download | scala-787d4bb9dbc540a61632c1f234a54ab74a69609c.tar.gz scala-787d4bb9dbc540a61632c1f234a54ab74a69609c.tar.bz2 scala-787d4bb9dbc540a61632c1f234a54ab74a69609c.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac')
-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 |
4 files changed, 15 insertions, 25 deletions
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; } |