diff options
author | paltherr <paltherr@epfl.ch> | 2003-10-28 12:04:49 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-10-28 12:04:49 +0000 |
commit | 3b6074552a9a5e25d609ec63046791283f0d8e45 (patch) | |
tree | 104f0f5b2c7456cdb72d9587ff2eea17da6c2a74 /sources/scalac | |
parent | bf1f22df3f01c9f6e23456fcb5715614b8cb6f49 (diff) | |
download | scala-3b6074552a9a5e25d609ec63046791283f0d8e45.tar.gz scala-3b6074552a9a5e25d609ec63046791283f0d8e45.tar.bz2 scala-3b6074552a9a5e25d609ec63046791283f0d8e45.zip |
- Added method singleTypeMethod
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/symtab/Type.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 08b2124640..c2b88fdf70 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -136,6 +136,27 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { } } + public static Type singleTypeMethod(Type pre, Symbol sym) { + Global global = Global.instance; + if (global.currentPhase.id <= global.PHASE.UNCURRY.id()) + return singleType(pre, sym); + else if (global.currentPhase.id <= global.PHASE.ERASURE.id()) + return sym.type().singleTypeMethod0(pre, sym); + else + return pre.memberType(sym); + } + + private Type singleTypeMethod0(Type pre, Symbol sym) { + switch (this) { + case PolyType(Symbol[] args, Type result): + return PolyType(args, result.singleTypeMethod0(pre, sym)); + case MethodType(Symbol[] args, Type result): + return MethodType(args, result.singleTypeMethod0(pre, sym)); + default: + return singleType(pre, sym); + } + } + public static TypeRef appliedType(Type tycon, Type[] args) { switch (tycon) { case TypeRef(Type pre, Symbol sym, Type[] args1): |