diff options
-rw-r--r-- | sources/scala/tools/scalai/Interpreter.java | 2 | ||||
-rw-r--r-- | sources/scalac/Global.java | 16 | ||||
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 11 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/AttributeParser.java | 20 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/CLRClassParser.java | 16 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/ClassfileParser.java | 12 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/UnPickle.java | 10 |
7 files changed, 34 insertions, 53 deletions
diff --git a/sources/scala/tools/scalai/Interpreter.java b/sources/scala/tools/scalai/Interpreter.java index 181dc75274..4fe1934ab6 100644 --- a/sources/scala/tools/scalai/Interpreter.java +++ b/sources/scala/tools/scalai/Interpreter.java @@ -148,7 +148,7 @@ public class Interpreter { private Type getMainMethodType(boolean erased) { Phase current = global.currentPhase; - if (!erased) global.currentPhase = global.getFirstPhase(); + if (!erased) global.currentPhase = global.PHASE.ANALYZER.phase(); Definitions definitions = global.definitions; Type argument = definitions.ARRAY_TYPE(definitions.JAVA_STRING_TYPE()); Type result = definitions.UNIT_TYPE(); diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java index f581dac326..320886e914 100644 --- a/sources/scalac/Global.java +++ b/sources/scalac/Global.java @@ -113,10 +113,6 @@ public abstract class Global { */ public HashMap/*<Symbol,Sourcefile>*/ compiledNow = new HashMap(); - /** the first phase - */ - private final Phase firstPhase; - /** the current phase */ public Phase currentPhase; @@ -234,20 +230,14 @@ public abstract class Global { } PHASE.freeze(); PhaseDescriptor[] descriptors = PHASE.phases(); - this.firstPhase = descriptors[0].create(this); - for (int i = 1; i <= PHASE.ANALYZER.id(); i++) + for (int i = 0; i <= PHASE.ANALYZER.id(); i++) if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this); this.treeGen = ((AnalyzerPhase)PHASE.ANALYZER.phase()).gen; this.primitives = new Primitives(this); assert !descriptors[0].hasSkipFlag(); for (int i = PHASE.ANALYZER.id() + 1; i < descriptors.length; i++) if (!descriptors[i].hasSkipFlag()) descriptors[i].create(this); - this.currentPhase = firstPhase; - } - - /** Returns the first compilation phase. */ - public Phase getFirstPhase() { - return firstPhase; + this.currentPhase = PHASE.INITIAL.phase(); } /** @@ -304,7 +294,7 @@ public abstract class Global { private void compile() { treePrinter.begin(); - currentPhase = firstPhase; + currentPhase = PHASE.INITIAL.phase(); // apply successive phases and pray that it works while (currentPhase.next != null && reporter.errors() == 0) { currentPhase = currentPhase.next; diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 9876b8c0a7..a49b13a3a8 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -174,15 +174,6 @@ public abstract class Symbol implements Modifiers, Kinds { } /** - * Set initial information valid from start of first phase. This - * information is visible in the first phase and will be - * transformed by all phases excepted the first one. - */ - public final Symbol setFirstInfo(Type info) { - return setInfoAt(info, Global.instance.getFirstPhase()); - } - - /** * Set initial information valid from start of given phase. This * information is visible in the given phase and will be * transformed by the given phase. @@ -1655,7 +1646,7 @@ public class AbsTypeSymbol extends TypeSymbol { } public AbsTypeSymbol(int pos, Name name, Symbol owner, int flags, int attrs) { super(TYPE, pos, name, owner, flags, attrs); - allConstructors().setFirstInfo(Type.MethodType(EMPTY_ARRAY, Type.typeRef(owner.thisType(), this, Type.EMPTY_ARRAY))); + allConstructors().setInfo(Type.MethodType(EMPTY_ARRAY, Type.typeRef(owner.thisType(), this, Type.EMPTY_ARRAY))); } public static AbsTypeSymbol define( diff --git a/sources/scalac/symtab/classfile/AttributeParser.java b/sources/scalac/symtab/classfile/AttributeParser.java index b5cdc6006d..db3d6e91a7 100644 --- a/sources/scalac/symtab/classfile/AttributeParser.java +++ b/sources/scalac/symtab/classfile/AttributeParser.java @@ -126,7 +126,7 @@ public class AttributeParser implements ClassfileConstants { continue; AliasTypeSymbol alias = new AliasTypeSymbol(Position.NOPOS, name.toTypeName(), outer, 0); - alias.setFirstInfo(inner.typeConstructor()); + alias.setInfo(inner.typeConstructor()); alias.allConstructors() .setInfo(new Type.MethodType(Symbol.EMPTY_ARRAY, inner.info())); Scope.Entry e = parser.statics.lookupEntry(alias.name); // Why is this ?????? @@ -167,12 +167,12 @@ public class AttributeParser implements ClassfileConstants { case CONSTANT_VALUE_ATTR: Object constVal = pool.readPool(in.nextChar()); //System.out.println(sym.owner() + "." + sym + ": " + constVal + " of type " + constantType(type, constVal)); - sym.setFirstInfo(parser.make.constantType(type, constVal)); + sym.setInfo(parser.make.constantType(type, constVal)); return; case META_ATTR: //System.out.println("parsing meta data for " + sym); String meta = pool.readPool(in.nextChar()).toString().trim(); - sym.setFirstInfo( + sym.setInfo( new MetaParser(meta, tvars, sym, type).parse()); return; case JACO_ATTR: @@ -233,7 +233,7 @@ public class AttributeParser implements ClassfileConstants { Name.fromString(token).toTypeName(), owner, Modifiers.PARAM); - s.setFirstInfo(parser.make.anyType()); + s.setInfo(parser.make.anyType()); tvars.enter(s); return s; } else @@ -289,7 +289,7 @@ public class AttributeParser implements ClassfileConstants { //System.out.println("new var " + s + ", " + token);//DEBUG if (token.equals("<")) { nextToken(); - s.setFirstInfo(parseType()); + s.setInfo(parseType()); } syms.add(s); } while (token.equals(",")); @@ -302,7 +302,7 @@ public class AttributeParser implements ClassfileConstants { Symbol constr = parser.c.primaryConstructor(); switch (constr.rawInfo()) { case MethodType(Symbol[] vparams, _): - constr.setFirstInfo( + constr.setInfo( Type.PolyType( smbls, Type.MethodType(vparams, clazztype))); break; @@ -372,12 +372,12 @@ public class AttributeParser implements ClassfileConstants { Name.fromString(token).toTypeName(), owner, Modifiers.PARAM); - s.setFirstInfo(parser.make.anyType()); + s.setInfo(parser.make.anyType()); locals.enter(s); nextToken(); if (token.equals("<")) { nextToken(); - s.setFirstInfo(parseType()); + s.setInfo(parseType()); } syms.add(s); } while (token.equals(",")); @@ -401,7 +401,7 @@ public class AttributeParser implements ClassfileConstants { Position.NOPOS, Name.fromString("x" + (i++)), owner, - flags).setFirstInfo(parseType())); + flags).setInfo(parseType())); //System.out.println(" + " + token); } while (token.equals(",")); assert ")".equals(token); @@ -454,7 +454,7 @@ public class AttributeParser implements ClassfileConstants { Position.NOPOS, Name.fromString("x" + (i++)), owner, - Modifiers.PARAM).setFirstInfo(parseType())); + Modifiers.PARAM).setInfo(parseType())); //System.out.println(" + " + token); } while (token.equals(",")); assert ")".equals(token); diff --git a/sources/scalac/symtab/classfile/CLRClassParser.java b/sources/scalac/symtab/classfile/CLRClassParser.java index 57f0f3068e..e3dff6047a 100644 --- a/sources/scalac/symtab/classfile/CLRClassParser.java +++ b/sources/scalac/symtab/classfile/CLRClassParser.java @@ -69,12 +69,12 @@ public class CLRClassParser extends ClassParser { Scope statics = new Scope(); scalac.symtab.Type classType = scalac.symtab.Type.compoundType(baseTypes, members, clazz); - clazz.setFirstInfo(classType); + clazz.setInfo(classType); Symbol staticsClass = clazz.module().moduleClass(); if (staticsClass.isModuleClass()) { scalac.symtab.Type staticsInfo = scalac.symtab.Type.compoundType (scalac.symtab.Type.EMPTY_ARRAY, statics, staticsClass); - staticsClass.setFirstInfo(staticsInfo); + staticsClass.setInfo(staticsInfo); clazz.module().setInfo(scalac.symtab.Type.typeRef (staticsClass.owner().thisType(), staticsClass, scalac.symtab.Type.EMPTY_ARRAY)); @@ -133,7 +133,7 @@ public class CLRClassParser extends ClassParser { fieldType = make.constantType(fieldType, fields[i].getValue()); Symbol owner = fields[i].IsStatic() ? staticsClass : clazz; Symbol field = new TermSymbol(Position.NOPOS, name, owner, mods); - field.setFirstInfo(fieldType); + field.setInfo(fieldType); (fields[i].IsStatic() ? statics : members).enterOrOverload(field); importer.map(field, fields[i]); } @@ -156,7 +156,7 @@ public class CLRClassParser extends ClassParser { Symbol owner = getter.IsStatic() ? staticsClass : clazz; Symbol method = new TermSymbol(Position.NOPOS, n, owner, mods); setParamOwners(mtype, method); - method.setFirstInfo(mtype); + method.setInfo(mtype); (getter.IsStatic() ? statics : members).enterOrOverload(method); importer.map(method, getter); @@ -171,7 +171,7 @@ public class CLRClassParser extends ClassParser { mods = translateAttributes(setter); method = new TermSymbol(Position.NOPOS, n, owner, mods); setParamOwners(mtype, method); - method.setFirstInfo(mtype); + method.setInfo(mtype); (setter.IsStatic() ? statics : members).enterOrOverload(method); importer.map(method, setter); } @@ -200,7 +200,7 @@ public class CLRClassParser extends ClassParser { Symbol owner = methods[i].IsStatic() ? staticsClass : clazz; Symbol method = new TermSymbol(Position.NOPOS, n, owner, mods); setParamOwners(mtype, method); - method.setFirstInfo(mtype); + method.setInfo(mtype); (methods[i].IsStatic() ? statics : members).enterOrOverload(method); importer.map(method, methods[i]); } @@ -219,7 +219,7 @@ public class CLRClassParser extends ClassParser { int mods = translateAttributes(constrs[i]); TermSymbol.newConstructor(clazz, mods).copyTo(constr); setParamOwners(mtype, constr); - constr.setFirstInfo(mtype); + constr.setInfo(mtype); // System.out.println(clazz.allConstructors() + ": " // + clazz.allConstructors().info()); importer.map(constr, constrs[i]); @@ -227,7 +227,7 @@ public class CLRClassParser extends ClassParser { Symbol constr = clazz.primaryConstructor(); if (!constr.isInitialized()) { - constr.setFirstInfo(scalac.symtab.Type.MethodType + constr.setInfo(scalac.symtab.Type.MethodType (Symbol.EMPTY_ARRAY, ctype)); if ((clazz.flags & Modifiers.INTERFACE) == 0) constr.flags |= Modifiers.PRIVATE; diff --git a/sources/scalac/symtab/classfile/ClassfileParser.java b/sources/scalac/symtab/classfile/ClassfileParser.java index 6eb0d31798..46efe698e7 100644 --- a/sources/scalac/symtab/classfile/ClassfileParser.java +++ b/sources/scalac/symtab/classfile/ClassfileParser.java @@ -95,12 +95,12 @@ public class ClassfileParser implements ClassfileConstants { this.statics = new Scope(); // set type of class Type classType = Type.compoundType(basetpes, locals, c); - c.setFirstInfo(classType); + c.setInfo(classType); // set type of statics Symbol staticsClass = c.module().moduleClass(); if (staticsClass.isModuleClass()) { Type staticsInfo = Type.compoundType(Type.EMPTY_ARRAY, statics, staticsClass); - staticsClass.setFirstInfo(staticsInfo); + staticsClass.setInfo(staticsInfo); c.module().setInfo(Type.typeRef(staticsClass.owner().thisType(), staticsClass, Type.EMPTY_ARRAY)); } @@ -116,7 +116,7 @@ public class ClassfileParser implements ClassfileConstants { Symbol constr = c.primaryConstructor(); if (!constr.isInitialized()) { - constr.setFirstInfo( + constr.setInfo( Type.MethodType(Symbol.EMPTY_ARRAY, ctype)); if ((c.flags & Modifiers.INTERFACE) == 0) constr.flags |= Modifiers.PRIVATE; @@ -190,7 +190,7 @@ public class ClassfileParser implements ClassfileConstants { if ((flags & 0x0008) != 0) owner = c.module().moduleClass(); Symbol s = new TermSymbol(Position.NOPOS, name, owner, mods); - s.setFirstInfo(type); + s.setInfo(type); attrib.readAttributes(s, type, FIELD_ATTR); ((flags & 0x0008) != 0 ? statics : locals).enterOrOverload(s); } @@ -224,7 +224,7 @@ public class ClassfileParser implements ClassfileConstants { constr = c.addConstructor(); s.copyTo(constr); setParamOwners(type, constr); - constr.setFirstInfo(type); + constr.setInfo(type); attrib.readAttributes(constr, type, METH_ATTR); //System.out.println(c + " " + c.allConstructors() + ":" + c.allConstructors().info());//debug //System.out.println("-- enter " + s); @@ -234,7 +234,7 @@ public class ClassfileParser implements ClassfileConstants { ((flags & 0x0008) != 0) ? c.module().moduleClass() : c, sflags); setParamOwners(type, s); - s.setFirstInfo(type); + s.setInfo(type); attrib.readAttributes(s, type, METH_ATTR); if ((s.flags & Modifiers.BRIDGE) == 0) ((flags & 0x0008) != 0 ? statics : locals).enterOrOverload(s); diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java index 95422a38b9..c36e1433a5 100644 --- a/sources/scalac/symtab/classfile/UnPickle.java +++ b/sources/scalac/symtab/classfile/UnPickle.java @@ -224,14 +224,14 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags { case TYPEsym: entries[n] = sym = new AbsTypeSymbol( Position.NOPOS, name, owner, flags); - sym.setFirstInfo(getType(inforef)); + sym.setInfo(getType(inforef)); sym.setLoBound(readTypeRef()); break; case ALIASsym: entries[n] = sym = new AliasTypeSymbol( Position.NOPOS, name, owner, flags); - sym.setFirstInfo(getType(inforef)); + sym.setInfo(getType(inforef)); Symbol constr = readSymbolRef(); break; @@ -245,7 +245,7 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags { sym.copyTo(clr); entries[n] = sym = clr; } - sym.setFirstInfo(getType(inforef)); + sym.setInfo(getType(inforef)); sym.setTypeOfThis(readTypeRef()); Symbol constr = readSymbolRef(); assert constr == sym.allConstructors(); @@ -277,7 +277,7 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags { entries[n] = sym = moduleroot; } Type tp = getType(inforef); - sym.setFirstInfo(tp.setOwner(sym)); + sym.setInfo(tp.setOwner(sym)); break; default: @@ -365,7 +365,7 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags { params[i] = new TermSymbol( Position.NOPOS, Name.fromString("$" + i), Symbol.NONE, PARAM | flags[i]); - params[i].setFirstInfo(argtypes[i]); + params[i].setInfo(argtypes[i]); } tpe = Type.MethodType(params, restype); break; |