diff options
author | paltherr <paltherr@epfl.ch> | 2003-05-19 16:48:53 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-05-19 16:48:53 +0000 |
commit | 3efb3a279e18d02f9bce5b6ad53708f411be91ad (patch) | |
tree | ec8457dba726fd8d9afc609840b6be31fea054ea /sources/scalac | |
parent | 7b6a46d75a034d7aeebcaf94c8a6d453a40ed34f (diff) | |
download | scala-3efb3a279e18d02f9bce5b6ad53708f411be91ad.tar.gz scala-3efb3a279e18d02f9bce5b6ad53708f411be91ad.tar.bz2 scala-3efb3a279e18d02f9bce5b6ad53708f411be91ad.zip |
- Fixed early initialization of module variable...
- Fixed early initialization of module variables (there are still
problems with some local modules).
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/transformer/AddConstructors.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sources/scalac/transformer/AddConstructors.java b/sources/scalac/transformer/AddConstructors.java index 995752fb20..cba2303715 100644 --- a/sources/scalac/transformer/AddConstructors.java +++ b/sources/scalac/transformer/AddConstructors.java @@ -148,10 +148,26 @@ public class AddConstructors extends Transformer { // inline initialization of module values if (forINT && treeSym.isModuleClass()) { - constrBody.add( - gen.Assign( - gen.mkRef(tree.pos, treeSym.module()), - gen.This(tree.pos, treeSym))); + Symbol module = treeSym.module(); + if (module.isGlobalModule()) { + constrBody.add( + gen.Assign( + gen.mkRef(tree.pos, module), + gen.This(tree.pos, treeSym))); + } 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(treeSym.module()); + if (owner.isModuleClass() && owner.module().isStable()) { + constrBody.add( + gen.Apply( + gen.mkRef(tree.pos, module_eq), + new Tree[] {gen.This(tree.pos, treeSym)})); + } else { + // !!! module_eq must be accessed via some outer field + } + } } // for every ValDef move the initialization code into the constructor |