diff options
author | Martin Odersky <odersky@gmail.com> | 2005-03-22 15:26:54 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2005-03-22 15:26:54 +0000 |
commit | 9e67e8eb2a4480d2761d2e08a87cea6b32a71fbb (patch) | |
tree | e71a2f25b3dd0072fa0db11c6e2e1282d4cfa97f /sources/scala/tools/nsc/typechecker/Contexts.scala | |
parent | 7179a093ef8f5c46941f6440704389316416b7f5 (diff) | |
download | scala-9e67e8eb2a4480d2761d2e08a87cea6b32a71fbb.tar.gz scala-9e67e8eb2a4480d2761d2e08a87cea6b32a71fbb.tar.bz2 scala-9e67e8eb2a4480d2761d2e08a87cea6b32a71fbb.zip |
*** empty log message ***
Diffstat (limited to 'sources/scala/tools/nsc/typechecker/Contexts.scala')
-rwxr-xr-x | sources/scala/tools/nsc/typechecker/Contexts.scala | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sources/scala/tools/nsc/typechecker/Contexts.scala b/sources/scala/tools/nsc/typechecker/Contexts.scala index 65e8b0925d..afaa1542b3 100755 --- a/sources/scala/tools/nsc/typechecker/Contexts.scala +++ b/sources/scala/tools/nsc/typechecker/Contexts.scala @@ -21,8 +21,9 @@ class Contexts: Analyzer { definitions.RootClass, definitions.RootClass.info.decls); def addImport(pkg: Symbol): unit = { - val impTree = Import(gen.mkGlobalRef(pkg), List(Pair(nme.WILDCARD, null))) - setSymbol NoSymbol.newImport(Position.NOPOS).setInfo(pkg.tpe) + val qual = gen.mkStableRef(pkg); + val impTree = Import(qual, List(Pair(nme.WILDCARD, null))) + setSymbol NoSymbol.newImport(Position.NOPOS).setInfo(ImportType(qual)) setType NoType; sc = sc.make( Template(List(), List(impTree)) setSymbol NoSymbol setType NoType, sc.owner, sc.scope) @@ -123,7 +124,13 @@ class Contexts: Analyzer { } } - class ImportInfo(val tree: Import, val depth: int) { + class ImportInfo(tree: Import, val depth: int) { + + /** The prefix expression */ + def qual: Tree = tree.symbol.info match { + case ImportType(expr) => expr + case _ => throw new FatalError("symbol " + tree.symbol + " has bad type: " + tree.symbol.info);//debug + } /** Is name imported explicitly, not via wildcard? */ def isExplicitImport(name: Name): boolean = @@ -150,6 +157,8 @@ class Contexts: Analyzer { override def toString() = tree.toString(); } + + case class ImportType(expr: Tree) extends Type; } |