diff options
author | Matthias Zenger <mzenger@gmail.com> | 2003-03-17 16:39:47 +0000 |
---|---|---|
committer | Matthias Zenger <mzenger@gmail.com> | 2003-03-17 16:39:47 +0000 |
commit | 818eca7c394444b342c047274145c973841a7197 (patch) | |
tree | 604584051a1782f6c27009d207c9c8091699b52c /sources/scalac/symtab/classfile/PackageParser.java | |
parent | 6dfc1be51708a5cf2531b2200cfe08c943179232 (diff) | |
download | scala-818eca7c394444b342c047274145c973841a7197.tar.gz scala-818eca7c394444b342c047274145c973841a7197.tar.bz2 scala-818eca7c394444b342c047274145c973841a7197.zip |
* .scala files always dominate .class files; co...
* .scala files always dominate .class files; consequently, we never
refer to classfiles generated by the Scala compiler if the corresponding
sourcefiles can be found in the classpath.
Diffstat (limited to 'sources/scalac/symtab/classfile/PackageParser.java')
-rw-r--r-- | sources/scalac/symtab/classfile/PackageParser.java | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/sources/scalac/symtab/classfile/PackageParser.java b/sources/scalac/symtab/classfile/PackageParser.java index 50fcb46b00..9f14045723 100644 --- a/sources/scalac/symtab/classfile/PackageParser.java +++ b/sources/scalac/symtab/classfile/PackageParser.java @@ -71,23 +71,25 @@ public class PackageParser extends Type.LazyType { if (inclClasses && fname.endsWith(".class")) { Name n = Name.fromString(fname.substring(0, fname.length() - 6)) .toTypeName(); - ClassSymbol clazz = new ClassSymbol(n, p, classCompletion); - clazz.constructor().setInfo( - classCompletion.staticsParser(clazz)); - // enter class - locals.enter(clazz); - locals.enter(clazz.constructor()); - // enter module, except for scala.Object class - // todo: why not there also?. - if (!(n == Names.Object.toTypeName() && - p.fullName().toTermName() == Names.scala)) { - Scope.Entry e = locals.lookupEntry(clazz.module().name); - if (e != Scope.Entry.NONE) { - // we already have a package of the same name; delete it - locals.unlink(e); - } - locals.enter(clazz.module()); - } + if (locals.lookup(n) == Symbol.NONE) { + ClassSymbol clazz = new ClassSymbol(n, p, classCompletion); + clazz.constructor().setInfo( + classCompletion.staticsParser(clazz)); + // enter class + locals.enter(clazz); + locals.enter(clazz.constructor()); + // enter module, except for scala.Object class + // todo: why not there also?. + if (!(n == Names.Object.toTypeName() && + p.fullName().toTermName() == Names.scala)) { + Scope.Entry e = locals.lookupEntry(clazz.module().name); + if (e != Scope.Entry.NONE) { + // we already have a package of the same name; delete it + locals.unlink(e); + } + locals.enter(clazz.module()); + } + } } else if (fname.endsWith("/") && !fname.equals("META-INF/")) { Name n = Name.fromString(fname.substring(0, fname.length() - 1)); if (locals.lookup(n) == Symbol.NONE) { @@ -97,7 +99,7 @@ public class PackageParser extends Type.LazyType { } else if (fname.endsWith(".scala")) { Name n = Name.fromString(fname.substring(0, fname.length() - 6)) .toTypeName(); - if (locals.lookup(n) == Symbol.NONE) { + //if (locals.lookup(n) == Symbol.NONE) { SourceCompleter completer = new SourceCompleter(global, dir.getPath() + File.separatorChar + fname); ClassSymbol clazz = new ClassSymbol(n, p, completer); @@ -107,7 +109,7 @@ public class PackageParser extends Type.LazyType { locals.enter(clazz); locals.enter(clazz.constructor()); locals.enter(clazz.module()); - } + //} } } } catch (IOException e) { |