summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-09 17:31:22 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-09 17:31:22 +0000
commit774209bb21ac348acfaec6be004d0b3fa37d56ef (patch)
tree40561670e8bacfe94736c32f632454fd36caa56b
parenta736bd41400de7e33b8c58678406cbe0b9ffdeb0 (diff)
downloadscala-774209bb21ac348acfaec6be004d0b3fa37d56ef.tar.gz
scala-774209bb21ac348acfaec6be004d0b3fa37d56ef.tar.bz2
scala-774209bb21ac348acfaec6be004d0b3fa37d56ef.zip
- Removed staticsParser and aliasParser in Clas...
- Removed staticsParser and aliasParser in ClassParser Changed - superclass of CLRPackageParser and CLRClassParser to SymbolLoader - Adapted Symbol.preInitialize and ClassSymbol constructor
-rw-r--r--config/list/compiler.lst1
-rw-r--r--sources/scalac/symtab/Symbol.java8
-rw-r--r--sources/scalac/symtab/classfile/CLRClassParser.java3
-rw-r--r--sources/scalac/symtab/classfile/CLRPackageParser.java6
-rw-r--r--sources/scalac/symtab/classfile/ClassParser.java54
-rw-r--r--sources/scalac/symtab/classfile/MetadataParser.java42
6 files changed, 9 insertions, 105 deletions
diff --git a/config/list/compiler.lst b/config/list/compiler.lst
index 63e748a5a7..59993d404f 100644
--- a/config/list/compiler.lst
+++ b/config/list/compiler.lst
@@ -77,7 +77,6 @@ symtab/classfile/ClassfileParser.java
symtab/classfile/ConstantPool.java
symtab/classfile/JavaTypeCreator.java
symtab/classfile/JavaTypeFactory.java
-symtab/classfile/MetadataParser.java
symtab/classfile/PackageParser.java
symtab/classfile/Signatures.java
symtab/classfile/SymblParser.java
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index dd8b5fb70f..29f9a134e2 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -815,9 +815,7 @@ public abstract class Symbol implements Modifiers, Kinds {
*/
public final void preInitialize() {
//todo: clean up
- if (infos.info instanceof ClassParser ||
- infos.info instanceof SourceCompleter ||
- infos.info instanceof ClassParser.StaticsParser)
+ if (infos.info instanceof SymbolLoader)
infos.info.complete(this);
}
@@ -1797,9 +1795,9 @@ public class ClassSymbol extends TypeSymbol {
/** Constructor for classes to load as class files.
*/
- public ClassSymbol(Name name, Symbol owner, ClassParser parser) {
+ public ClassSymbol(Name name, Symbol owner, SymbolLoader parser) {
this(Position.NOPOS, name, owner, JAVA);
- this.module = TermSymbol.newCompanionModule(this, JAVA, parser.staticsParser(this));
+ this.module = TermSymbol.newCompanionModule(this, JAVA, parser);
this.setInfo(parser);
}
diff --git a/sources/scalac/symtab/classfile/CLRClassParser.java b/sources/scalac/symtab/classfile/CLRClassParser.java
index 5432b55b59..3e66d59fdc 100644
--- a/sources/scalac/symtab/classfile/CLRClassParser.java
+++ b/sources/scalac/symtab/classfile/CLRClassParser.java
@@ -10,6 +10,7 @@ package scalac.symtab.classfile;
import scalac.Global;
import scalac.symtab.Symbol;
+import scalac.symtab.SymbolLoader;
import scalac.symtab.TermSymbol;
import scalac.symtab.ClassSymbol;
import scalac.symtab.AliasTypeSymbol;
@@ -23,7 +24,7 @@ import scalac.util.Debug;
import ch.epfl.lamp.util.Position;
import ch.epfl.lamp.compiler.msil.*;
-public class CLRClassParser extends ClassParser {
+public class CLRClassParser extends SymbolLoader {
protected JavaTypeFactory make;
diff --git a/sources/scalac/symtab/classfile/CLRPackageParser.java b/sources/scalac/symtab/classfile/CLRPackageParser.java
index 6a992b0d8a..3d626e0f28 100644
--- a/sources/scalac/symtab/classfile/CLRPackageParser.java
+++ b/sources/scalac/symtab/classfile/CLRPackageParser.java
@@ -18,6 +18,7 @@ import java.io.File;
import ch.epfl.lamp.compiler.msil.*;
import scalac.symtab.Symbol;
+import scalac.symtab.SymbolLoader;
import scalac.symtab.TermSymbol;
import scalac.symtab.ClassSymbol;
import scalac.symtab.Scope;
@@ -28,7 +29,7 @@ import scalac.Global;
/**
*/
-public class CLRPackageParser extends MetadataParser {
+public class CLRPackageParser extends SymbolLoader {
//##########################################################################
@@ -224,8 +225,9 @@ public class CLRPackageParser extends MetadataParser {
//##########################################################################
// main functionality
- protected void doComplete(Symbol p) {
+ protected String doComplete(Symbol p) {
// for future use
+ return "!!!";
}
/**
diff --git a/sources/scalac/symtab/classfile/ClassParser.java b/sources/scalac/symtab/classfile/ClassParser.java
index 882b4b2690..7066a2cde4 100644
--- a/sources/scalac/symtab/classfile/ClassParser.java
+++ b/sources/scalac/symtab/classfile/ClassParser.java
@@ -27,59 +27,5 @@ public class ClassParser extends SymbolLoader {
return "class file '" + file.getPath() + "'";
}
- public Type.LazyType staticsParser(Symbol clazz) {
- return new StaticsParser(clazz);
- }
-
- public Type.LazyType aliasParser(Symbol alias) {
- return new AliasParser(alias);
- }
-
- public class StaticsParser extends Type.LazyType {
- Symbol clazz;
-
- StaticsParser(Symbol clazz) {
- this.clazz = clazz;
- }
-
- public void complete(Symbol statics) {
- ClassParser.this.complete(clazz);
- }
-
- public String toString() {
- return "StaticsParser(" + clazz + ")";
- }
- }
-
- class AliasParser extends Type.LazyType {
- Symbol alias;
-
- AliasParser(Symbol alias) {
- this.alias = alias;
- }
-
- public void complete(Symbol c) {
- Phase phase = global.currentPhase;
- global.currentPhase = global.PHASE.ANALYZER.phase();
- try {
- long msec = System.currentTimeMillis();
- String filename = SourceRepresentation.externalizeFileName(
- alias, ".class");
- AbstractFile f = global.classPath.openFile(filename);
- if (f == null)
- global.error("could not read class " + c);
- else {
- new ClassfileParser(global, new AbstractFileReader(f), c).parse();
- global.operation("loaded " + f.getPath() + " in " +
- (System.currentTimeMillis() - msec) + "ms");
- }
- } catch (IOException e) {
- if (global.debug) e.printStackTrace();
- global.error("i/o error while loading " + c);
- c.setInfo(Type.ErrorType);
- }
- global.currentPhase = phase;
- }
- }
}
diff --git a/sources/scalac/symtab/classfile/MetadataParser.java b/sources/scalac/symtab/classfile/MetadataParser.java
deleted file mode 100644
index 8024b7dfc0..0000000000
--- a/sources/scalac/symtab/classfile/MetadataParser.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-** **
-** $Id$
-\* */
-
-package scalac.symtab.classfile;
-
-import scalac.Global;
-import scalac.Phase;
-import scalac.symtab.Symbol;
-import scalac.symtab.Type;
-
-/** Common superclass for all metadata parsers that load symbols
- * in the context of the first phase of the compiler.
- */
-public abstract class MetadataParser extends Type.LazyType {
-
- /** the global compilation environment
- */
- protected Global global;
-
- public MetadataParser(Global global) {
- this.global = global;
- }
-
- /** Complete symbol 'sym' by loading the members of the symbol.
- */
- public final void complete(Symbol sym) {
- Phase phase = global.currentPhase;
- global.currentPhase = global.PHASE.ANALYZER.phase();
- doComplete(sym);
- global.currentPhase = phase;
- }
-
- /** Perform the actual loading of the symbol.
- */
- protected abstract void doComplete(Symbol sym);
-
-}