diff options
author | paltherr <paltherr@epfl.ch> | 2004-02-01 16:35:10 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-02-01 16:35:10 +0000 |
commit | 06bad88d6cd96165df940f8bd1b13eecc0d4fadf (patch) | |
tree | 528b4bd9d2c8020b2be82aa963dcad9b5ddade81 /sources | |
parent | 131fc7ff568bc9e09542c28c3dd34cd6ccacb9bd (diff) | |
download | scala-06bad88d6cd96165df940f8bd1b13eecc0d4fadf.tar.gz scala-06bad88d6cd96165df940f8bd1b13eecc0d4fadf.tar.bz2 scala-06bad88d6cd96165df940f8bd1b13eecc0d4fadf.zip |
- Removed interpreter specific code from AddCon...
- Removed interpreter specific code from AddConstructor Added module
- initialization in interpreter's ExpressionCompiler
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/scalai/ExpressionCompiler.java | 8 | ||||
-rw-r--r-- | sources/scalac/transformer/AddConstructors.java | 44 |
2 files changed, 12 insertions, 40 deletions
diff --git a/sources/scala/tools/scalai/ExpressionCompiler.java b/sources/scala/tools/scalai/ExpressionCompiler.java index 84594a1f5b..2cc87880cc 100644 --- a/sources/scala/tools/scalai/ExpressionCompiler.java +++ b/sources/scala/tools/scalai/ExpressionCompiler.java @@ -149,9 +149,17 @@ public class ExpressionCompiler { assert invoke.target == Code.Self | invoke.target == Code.Null : Debug.show(code); invoke.target = Code.Load(Code.Null, variable); context.insertVariable(symbol, variable); + Code module = template.getSymbol().isModuleClass() + && template.getSymbol().module().isGlobalModule() + ? Code.Store( + Code.Null, + context.lookupVariable(template.getSymbol().module()), + Code.Load(Code.Null, variable)) + : Code.Null; code = Code.Block( new Code[] { Code.Store(Code.Null, variable, Code.Create(template)), + module, invoke}, Code.Load(Code.Null, variable)); } diff --git a/sources/scalac/transformer/AddConstructors.java b/sources/scalac/transformer/AddConstructors.java index 4027dbb16d..5ef1e1c406 100644 --- a/sources/scalac/transformer/AddConstructors.java +++ b/sources/scalac/transformer/AddConstructors.java @@ -8,26 +8,18 @@ package scalac.transformer; -import scalac.Global; -import scalac.util.Name; -import scalac.util.Names; +import java.util.HashMap; +import java.util.ArrayList; +import scalac.Global; import scalac.ast.Tree; -import Tree.*; +import scalac.ast.Tree.Template; import scalac.ast.GenTransformer; - import scalac.symtab.Type; import scalac.symtab.Symbol; import scalac.symtab.SymbolSubstTypeMap; import scalac.symtab.TermSymbol; -import scalac.symtab.Scope; -import scalac.symtab.Kinds; import scalac.symtab.Modifiers; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.ArrayList; - import scalac.util.Debug; /** @@ -72,9 +64,6 @@ import scalac.util.Debug; */ public class AddConstructors extends GenTransformer { - /** True iff we generate code for INT backend. */ - private final boolean forINT; - /** A constructor to initializer map */ private final HashMap/*<Symbol,Symbol>*/ initializers; @@ -87,7 +76,6 @@ public class AddConstructors extends GenTransformer { public AddConstructors(Global global, HashMap initializers) { super(global); this.initializers = initializers; - this.forINT = global.target == global.TARGET_INT; this.subst = new SymbolSubstTypeMap(); } @@ -188,30 +176,6 @@ public class AddConstructors extends GenTransformer { } } - // inline initialization of module values - if (forINT && clasz.isModuleClass()) { - Symbol module = clasz.module(); - if (module.isGlobalModule()) { - constrBody.add( - gen.Assign( - gen.mkRef(tree.pos, module), - gen.This(tree.pos, clasz))); - } else { - Symbol owner = module.owner(); - Name module_eqname = module.name.append(Names._EQ); - Symbol module_eq = owner.lookup(module_eqname); - assert module != Symbol.NONE :Debug.show(clasz.module()); - if (owner.isModuleClass() && owner.module().isStable()) { - constrBody.add( - gen.mkApply_V( - gen.mkRef(tree.pos, module_eq), - new Tree[] {gen.This(tree.pos, clasz)})); - } else { - // !!! module_eq must be accessed via some outer field - } - } - } - // add valdefs and class-level expression to the constructorr body constrBody.addAll(constrBody2); |