diff options
author | paltherr <paltherr@epfl.ch> | 2003-03-13 14:02:56 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-03-13 14:02:56 +0000 |
commit | 6e1b224b2052a1f0d935f756ba93f027a7321e71 (patch) | |
tree | e31199fef2518d4438698a02b08f3529a293e2b0 | |
parent | 38ec9ea7d1e586f421b2ed956f516753a51069a1 (diff) | |
download | scala-6e1b224b2052a1f0d935f756ba93f027a7321e71.tar.gz scala-6e1b224b2052a1f0d935f756ba93f027a7321e71.tar.bz2 scala-6e1b224b2052a1f0d935f756ba93f027a7321e71.zip |
- Added consoleContext
-rw-r--r-- | sources/scalac/typechecker/AnalyzerPhase.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sources/scalac/typechecker/AnalyzerPhase.java b/sources/scalac/typechecker/AnalyzerPhase.java index e0802f50b3..d5601da0dd 100644 --- a/sources/scalac/typechecker/AnalyzerPhase.java +++ b/sources/scalac/typechecker/AnalyzerPhase.java @@ -19,6 +19,7 @@ import java.util.ArrayList; public class AnalyzerPhase extends PhaseDescriptor { /* final */ Context startContext; + /* final */ Context consoleContext; HashMap/*<Unit,Context>*/ contexts = new HashMap(); ArrayList/*<Unit>*/ newSources = new ArrayList(); @@ -77,6 +78,28 @@ public class AnalyzerPhase extends PhaseDescriptor { startContext.imports = new ImportList( importscalaPredef, new Scope(), startContext.imports); } + + this.consoleContext = new Context( + Tree.Empty, + definitions.ROOT_CLASS, + definitions.ROOT_CLASS.members(), + startContext); + } + + public void addConsoleImport(Global global, Symbol module) { + Definitions definitions = global.definitions; + TreeFactory make = global.make; + + Tree console = make.Ident(Position.NOPOS, module.name) + .setSymbol(module) + .setType(Type.singleType(definitions.ROOT_TYPE, module)); + + Tree importConsole = make.Import( + Position.NOPOS, console, new Name[]{Names.WILDCARD}) + .setSymbol(module) + .setType(definitions.UNIT_TYPE); + consoleContext.imports = new ImportList( + importConsole, new Scope(), consoleContext.imports); } public String name() { |