diff options
author | mihaylov <mihaylov@epfl.ch> | 2004-06-02 19:05:24 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2004-06-02 19:05:24 +0000 |
commit | 3f84ccaa23b188609de40e678fa81331cbe86d79 (patch) | |
tree | 2496dc46bb5da692687d066d05854b0a00cd6ddc /sources | |
parent | 76255b83a268a44ad3177ab436681a49442516ff (diff) | |
download | scala-3f84ccaa23b188609de40e678fa81331cbe86d79.tar.gz scala-3f84ccaa23b188609de40e678fa81331cbe86d79.tar.bz2 scala-3f84ccaa23b188609de40e678fa81331cbe86d79.zip |
- Accomodated the changes in CLRPackageParser
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/symtab/classfile/PackageParser.java | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/sources/scalac/symtab/classfile/PackageParser.java b/sources/scalac/symtab/classfile/PackageParser.java index b8a1636eb0..710c16ea48 100644 --- a/sources/scalac/symtab/classfile/PackageParser.java +++ b/sources/scalac/symtab/classfile/PackageParser.java @@ -41,7 +41,7 @@ public class PackageParser extends SymbolLoader { /** Are we targeting the MSIL? */ private boolean forMSIL; - private SymbolNameWriter snw = new SymbolNameWriter(); + private final CLRPackageParser clrParser; //######################################################################## // Public Constructors @@ -51,6 +51,7 @@ public class PackageParser extends SymbolLoader { super(global); this.directory = directory; this.forMSIL = global.target == global.TARGET_MSIL; + this.clrParser = forMSIL ? CLRPackageParser.instance() : null; } //######################################################################## @@ -89,8 +90,8 @@ public class PackageParser extends SymbolLoader { Set namespaces = null; ch.epfl.lamp.compiler.msil.Type type = null; if (forMSIL) { - types = clrParser().getTypes(peckage); - namespaces = clrParser().getNamespaces(peckage); + types = clrParser.getTypes(peckage); + namespaces = clrParser.getNamespaces(peckage); } // create JVM and source members @@ -121,17 +122,11 @@ public class PackageParser extends SymbolLoader { peckage.newLoadedClass(0, classname, loader, members); } - if (forMSIL) { - for (Iterator i = types.keySet().iterator(); i.hasNext(); ) { - classes.remove(i.next()); - } - } - for (Iterator i = classes.entrySet().iterator(); i.hasNext(); ) { HashMap.Entry entry = (HashMap.Entry)i.next(); String name = (String)entry.getKey(); //assert !types.containsKey(name) : types.get(name); - if (!forMSIL || clrParser().shouldLoadClassfile(peckage, name)) { + if (!forMSIL || clrParser.shouldLoadClassfile(peckage, name)) { AbstractFile cfile = (AbstractFile)entry.getValue(); packages.remove(name); Name classname = Name.fromString(name).toTypeName(); @@ -144,7 +139,7 @@ public class PackageParser extends SymbolLoader { // import the CLR types contained in the package (namespace) for (Iterator i = types.values().iterator(); i.hasNext(); ) { type = (ch.epfl.lamp.compiler.msil.Type)i.next(); - clrParser().importType(type, peckage, members); + clrParser.importType(type, peckage, members); } } @@ -162,7 +157,10 @@ public class PackageParser extends SymbolLoader { // import the CLR namespaces contained in the package (namespace) for (Iterator i = namespaces.iterator(); i.hasNext(); ) { String namespace = (String)i.next(); - clrParser().importNamespace(namespace, peckage, members); + Name name = Name.fromString(namespace); + if (members.lookup(name) == Symbol.NONE) { + peckage.newLoadedPackage(name, this, members); + } } } @@ -171,9 +169,5 @@ public class PackageParser extends SymbolLoader { return "directory path '" + directory + "'"; } - private CLRPackageParser clrParser() { - return CLRPackageParser.instance(global); - } - //######################################################################## } |