diff options
author | paltherr <paltherr@epfl.ch> | 2004-03-11 17:02:49 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-03-11 17:02:49 +0000 |
commit | 37be4bd4a8b10cc78127dd2f8103b9eda16abe84 (patch) | |
tree | cc69b2b2d7b067c3f2390951b320c079da43d295 /sources/scalac | |
parent | 247c8b081ebd4ad2f2afbe473e211bf25dd0b327 (diff) | |
download | scala-37be4bd4a8b10cc78127dd2f8103b9eda16abe84.tar.gz scala-37be4bd4a8b10cc78127dd2f8103b9eda16abe84.tar.bz2 scala-37be4bd4a8b10cc78127dd2f8103b9eda16abe84.zip |
- Added method Symbol.newFactory
- Removed class LabelSymbol
- Added constant Symbol.IS_LABEL
- Removed constant Modifiers.LABEL
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/symtab/Modifiers.java | 1 | ||||
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 20 | ||||
-rw-r--r-- | sources/scalac/transformer/TailCallPhase.java | 3 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/LeftTracerInScala.java | 6 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/RightTracerInScala.java | 6 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/WordAutomInScala.java | 6 |
6 files changed, 15 insertions, 27 deletions
diff --git a/sources/scalac/symtab/Modifiers.java b/sources/scalac/symtab/Modifiers.java index 68985fe16e..22d7ed3e21 100644 --- a/sources/scalac/symtab/Modifiers.java +++ b/sources/scalac/symtab/Modifiers.java @@ -39,7 +39,6 @@ public interface Modifiers { int SELECTOR = 0x00080000; // symbol was used as selector in Select int PACKAGE = 0x00100000; // symbol is a java package. - int LABEL = 0x00200000; // symbol is a label symbol int STABLE = 0x00800000; // functions that are assumed to be stable // (typically, access methods for valdefs) diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index e935eb27e6..70ceaa047b 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -40,6 +40,7 @@ public abstract class Symbol implements Modifiers, Kinds { // Attribues ------------------------------------------------------------- public static final int IS_ROOT = 0x00000001; + public static final int IS_LABEL = 0x00000010; public static final int IS_COMPOUND = 0x80000000; // Fields ------------------------------------------------------------- @@ -93,6 +94,12 @@ public abstract class Symbol implements Modifiers, Kinds { return new TermSymbol(pos, Names.CONSTRUCTOR, owner(), flags, 0, this); } + /** Creates a new Label owned by this symbol. */ + public final TermSymbol newLabel(int pos, Name name) { + assert isTerm(): Debug.show(this); + return new TermSymbol(pos, name, this, 0, IS_LABEL); + } + /** Creates a new module owned by this symbol. */ public final TermSymbol newModule(int pos, int flags, Name name) { ClassSymbol clasz = newModuleClass(pos, flags, name.toTypeName()); @@ -664,7 +671,7 @@ public abstract class Symbol implements Modifiers, Kinds { /** Does this symbol denote a label? */ public final boolean isLabel() { - return (flags & LABEL) != 0; + return (attrs & IS_LABEL) != 0; } /** Is this symbol accessed? */ @@ -1952,17 +1959,6 @@ public final class NoSymbol extends Symbol { } -/** A class for symbols generated in label definitions. - */ -public class LabelSymbol extends TermSymbol { - - /** give as argument the symbol of the function that triggered - the creation of this label */ - public LabelSymbol(Symbol f) { - super(f.pos, f.name, f, LABEL); - } -} - /** An exception for signalling cyclic references. */ public class CyclicReference extends Type.Error { diff --git a/sources/scalac/transformer/TailCallPhase.java b/sources/scalac/transformer/TailCallPhase.java index 80d86166fd..29cce5dc5e 100644 --- a/sources/scalac/transformer/TailCallPhase.java +++ b/sources/scalac/transformer/TailCallPhase.java @@ -14,7 +14,6 @@ import scalac.PhaseDescriptor; import scalac.Unit; import scalac.ast.Tree; import scalac.ast.GenTransformer; -import scalac.symtab.LabelSymbol; import scalac.symtab.Symbol; import scalac.symtab.Type; import scalac.util.Debug; @@ -89,7 +88,7 @@ public class TailCallPhase extends Phase { assert method == null: Debug.show(method) + " -- " + tree; method = tree.symbol(); if (method.isMethodFinal()) { - label = new LabelSymbol(method); + label = method.newLabel(method.pos, method.name); types = Type.EMPTY_ARRAY; Type type = method.type(); switch (type) { diff --git a/sources/scalac/transformer/matching/LeftTracerInScala.java b/sources/scalac/transformer/matching/LeftTracerInScala.java index 875b1dd89b..56604e511d 100644 --- a/sources/scalac/transformer/matching/LeftTracerInScala.java +++ b/sources/scalac/transformer/matching/LeftTracerInScala.java @@ -38,10 +38,8 @@ public class LeftTracerInScala extends TracerInScala { } protected void initializeSyms() { - this.funSym = new TermSymbol( pos, - cf.fresh.newName( "left" ), - owner, - Modifiers.LABEL ); + this.funSym = owner.newLabel( pos, + cf.fresh.newName( "left" )); this.iterSym = new TermSymbol( pos, cf.fresh.newName( "iter" ), diff --git a/sources/scalac/transformer/matching/RightTracerInScala.java b/sources/scalac/transformer/matching/RightTracerInScala.java index 31041cbf9d..2d41544331 100644 --- a/sources/scalac/transformer/matching/RightTracerInScala.java +++ b/sources/scalac/transformer/matching/RightTracerInScala.java @@ -126,10 +126,8 @@ public class RightTracerInScala extends TracerInScala { protected void initializeSyms() { - this.funSym = new TermSymbol( pos, - cf.fresh.newName( "right" ), - owner, - Modifiers.LABEL ); + this.funSym = owner.newLabel( pos, + cf.fresh.newName( "right" )); this.iterSym = new TermSymbol( pos, cf.fresh.newName("iter"), diff --git a/sources/scalac/transformer/matching/WordAutomInScala.java b/sources/scalac/transformer/matching/WordAutomInScala.java index c84291b9ae..c1d5c439f6 100644 --- a/sources/scalac/transformer/matching/WordAutomInScala.java +++ b/sources/scalac/transformer/matching/WordAutomInScala.java @@ -68,10 +68,8 @@ public class WordAutomInScala extends Autom2Scala { protected void initializeSyms() { // TEST - this.funSym = new TermSymbol( pos, - cf.fresh.newName( "matcher" ), - owner, - Modifiers.LABEL ); + this.funSym = owner.newLabel( pos, + cf.fresh.newName( "matcher" )); this.iterSym = new TermSymbol( pos, cf.fresh.newName("iter"), |