diff options
author | paltherr <paltherr@epfl.ch> | 2003-09-11 16:03:17 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-09-11 16:03:17 +0000 |
commit | 66807fa7e22a4ce6a314751590e2454e2f39dfff (patch) | |
tree | 4697fd416d3e06853cd12ed9992c2da1a2b577a8 /sources | |
parent | 9207360ce2c532707112da0dc5ef5cf3c40a4762 (diff) | |
download | scala-66807fa7e22a4ce6a314751590e2454e2f39dfff.tar.gz scala-66807fa7e22a4ce6a314751590e2454e2f39dfff.tar.bz2 scala-66807fa7e22a4ce6a314751590e2454e2f39dfff.zip |
- Added field and method OBJECT_TAG
- Added fields and methods REF_x
- Added fields and methods FUNCTION_x
- Added method loadTerm
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/symtab/Definitions.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java index e9f000b848..a01db7a7ba 100644 --- a/sources/scalac/symtab/Definitions.java +++ b/sources/scalac/symtab/Definitions.java @@ -99,6 +99,12 @@ public class Definitions { public final Symbol OBJECT_CLASS; public final Type OBJECT_TYPE; + private Symbol OBJECT_TAG; + public Symbol OBJECT_TAG() { + if (OBJECT_TAG == null) OBJECT_TAG = loadTerm(OBJECT_TYPE, Names.tag); + return OBJECT_TAG; + } + /** the scala.All class */ public final Symbol ALL_CLASS; @@ -146,6 +152,31 @@ public class Definitions { public final Symbol STRING_CLASS; public final Type STRING_TYPE; + /** the scala.FunctionX classes + */ + public final int FUNCTION_count = 10; + public final Symbol[] FUNCTION_CLASS = new Symbol[FUNCTION_count]; + public final Type[] FUNCTION_TYPE = new Type[FUNCTION_count]; + + private final Symbol[] FUNCTION_APPLY = new Symbol[FUNCTION_count]; + public Symbol FUNCTION_APPLY(int arity) { + assert arity < FUNCTION_count: arity; + if (FUNCTION_APPLY[arity] == null) + FUNCTION_APPLY[arity] = loadTerm(FUNCTION_TYPE[arity],Names.apply); + return FUNCTION_APPLY[arity]; + } + + /** the scala.Ref class + */ + public final Symbol REF_CLASS; + public final Type REF_TYPE; + + private Symbol REF_ELEM; + public Symbol REF_ELEM() { + if (REF_ELEM == null) REF_ELEM = loadTerm(REF_TYPE, Names.elem); + return REF_ELEM; + } + public final Symbol SEQ_CLASS; /** string concatenation pseudo-methods of classes scala.Any and @@ -295,6 +326,12 @@ public class Definitions { STRING_TYPE = STRING_CLASS.typeConstructor(); STRING_CLASS.primaryConstructor().setInfo(Type.MethodType(Symbol.EMPTY_ARRAY, STRING_TYPE)); + for (int i = 0; i < FUNCTION_count; i++) { + FUNCTION_CLASS[i] = getClass(Names.scala_Function(i)); + FUNCTION_TYPE[i] = FUNCTION_CLASS[i].typeConstructor(); + } + REF_CLASS = getClass(Names.scala_Ref); + REF_TYPE = REF_CLASS.typeConstructor(); SEQ_CLASS = getClass(Names.scala_Seq); /* @@ -453,6 +490,12 @@ public class Definitions { AMPAMP = BOOLEAN_TYPE.lookup(Names.AMPAMP); } + private Symbol loadTerm(Type type, Name name) { + Symbol sym = type.lookup(name); + assert sym.isTerm() && !sym.isOverloaded(): type+"."+name+" -> "+sym; + return sym; + } + public Type arrayType(Type elemtpe) { return Type.appliedType(ARRAY_CLASS.typeConstructor(), new Type[]{elemtpe}); } |