From 5bcdedd615aaa18c44b408db74776949f09e307d Mon Sep 17 00:00:00 2001 From: Matthias Zenger Date: Wed, 2 Jul 2003 12:40:42 +0000 Subject: 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. --- sources/scalac/transformer/ErasurePhase.java | 34 ++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'sources/scalac/transformer/ErasurePhase.java') 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) }; } } -- cgit v1.2.3