diff options
author | Matthias Zenger <mzenger@gmail.com> | 2003-07-02 12:40:42 +0000 |
---|---|---|
committer | Matthias Zenger <mzenger@gmail.com> | 2003-07-02 12:40:42 +0000 |
commit | 5bcdedd615aaa18c44b408db74776949f09e307d (patch) | |
tree | dffc1b3bbbe517a818c44cb19686fd0f5e6f876a /sources/scalac/transformer/ErasurePhase.java | |
parent | 478c334b562ff810f424b8ac3cdfd7f9c868feab (diff) | |
download | scala-5bcdedd615aaa18c44b408db74776949f09e307d.tar.gz scala-5bcdedd615aaa18c44b408db74776949f09e307d.tar.bz2 scala-5bcdedd615aaa18c44b408db74776949f09e307d.zip |
Added a new apply method to each phase which al...
Added a new apply method to each phase which allows to apply only a
single compilation unit. For some phases this might probably not work
as it is right now. At some stage, these phases have to be adapted
accordingly.
Diffstat (limited to 'sources/scalac/transformer/ErasurePhase.java')
-rw-r--r-- | sources/scalac/transformer/ErasurePhase.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sources/scalac/transformer/ErasurePhase.java b/sources/scalac/transformer/ErasurePhase.java index 4347d01c6c..8accd1ed9a 100644 --- a/sources/scalac/transformer/ErasurePhase.java +++ b/sources/scalac/transformer/ErasurePhase.java @@ -10,7 +10,7 @@ package scalac.transformer; import scalac.Global; -import scalac.PhaseDescriptor; +import scalac.*; import scalac.backend.Primitive; import scalac.backend.Primitives; import scalac.checkers.Checker; @@ -41,22 +41,28 @@ public class ErasurePhase extends PhaseDescriptor { } public void apply(Global global) { - this.definitions = global.definitions; - this.primitives = global.primitives; + this.definitions = global.definitions; + this.primitives = global.primitives; new Erasure(global).apply(); } - private Type eraseParams(Type tp) { - switch (tp) { - case PolyType(_, Type result): - return eraseParams(result); - case MethodType(Symbol[] params, Type result): - Symbol[] params1 = Type.erasureMap.map(params); - if (params1 == params) return tp; - else return Type.MethodType(params1, result); - default: - return tp; + public void apply(Unit unit) { + this.definitions = unit.global.definitions; + this.primitives = unit.global.primitives; + new Erasure(unit.global).apply(unit); } + + private Type eraseParams(Type tp) { + switch (tp) { + case PolyType(_, Type result): + return eraseParams(result); + case MethodType(Symbol[] params, Type result): + Symbol[] params1 = Type.erasureMap.map(params); + if (params1 == params) return tp; + else return Type.MethodType(params1, result); + default: + return tp; + } } public Type transformInfo(Symbol sym, Type tp) { @@ -76,7 +82,7 @@ public class ErasurePhase extends PhaseDescriptor { new CheckSymbols(global), new CheckTypes(global), new CheckOwners(global), - new CheckNames(global) + new CheckNames(global) }; } } |