summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab/Type.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-09 19:31:37 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-09 19:31:37 +0000
commitb93f7b2512dbcf2acabc009dae7d5f78a0919d82 (patch)
tree0d2e56839a6817483612578d629f3ef2258dea8c /sources/scalac/symtab/Type.java
parent774209bb21ac348acfaec6be004d0b3fa37d56ef (diff)
downloadscala-b93f7b2512dbcf2acabc009dae7d5f78a0919d82.tar.gz
scala-b93f7b2512dbcf2acabc009dae7d5f78a0919d82.tar.bz2
scala-b93f7b2512dbcf2acabc009dae7d5f78a0919d82.zip
- Added method Symbol.newCompoundClass
- Added Symbol.IS_COMPOUND - Adapted Type.ExtCompoundType to use method Symbol.newCompoundClass
Diffstat (limited to 'sources/scalac/symtab/Type.java')
-rw-r--r--sources/scalac/symtab/Type.java33
1 files changed, 11 insertions, 22 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index d1df9d6e35..c7d4e38a03 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -237,20 +237,11 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
public static CompoundType compoundType(Type[] parts, Scope members,
Symbol clazz) {
- ExtCompoundType res = new ExtCompoundType(parts, members);
- res.tsym = clazz;
- return res;
+ return new ExtCompoundType(parts, members, clazz);
}
public static CompoundType compoundTypeWithOwner(Symbol owner, Type[] parts, Scope members) {
- ExtCompoundType res = new ExtCompoundType(parts, members);
- res.tsym = new ClassSymbol(
- Position.FIRSTPOS, Names.COMPOUND_NAME.toTypeName(), owner,
- SYNTHETIC | ABSTRACT);
- res.tsym.setInfo(res);
- res.tsym.primaryConstructor().setInfo(
- Type.MethodType(Symbol.EMPTY_ARRAY, Type.typeRef(res.tsym.owner().thisType(), res.tsym, Type.EMPTY_ARRAY)));
- return res;
+ return new ExtCompoundType(owner, parts, members);
}
static class ExtSingleType extends SingleType {
@@ -274,23 +265,21 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
}
}
- static class ExtCompoundType extends CompoundType {
- Symbol tsym;
- ExtCompoundType(Type[] parts, Scope members) {
+ private static final class ExtCompoundType extends CompoundType {
+ private final Symbol clasz;
+ public ExtCompoundType(Symbol owner, Type[] parts, Scope members) {
super(parts, members);
+ this.clasz = owner.newCompoundClass(this);
}
- public Symbol symbol() {
- return tsym;
+ public ExtCompoundType(Type[] parts, Scope members, Symbol clasz) {
+ super(parts, members);
+ this.clasz = clasz;
}
- void validate() {//debug
- for (Scope.SymbolIterator it = members.iterator(true); it.hasNext(); )
- assert it.next().owner() == tsym;
+ public Symbol symbol() {
+ return clasz;
}
}
- void validate() {//debug
- }
-
// Access methods ---------------------------------------------------------------
/** If this is a thistype, named type, applied type, singleton type, or compound type,