summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-04-04 13:02:50 +0000
committerpaltherr <paltherr@epfl.ch>2004-04-04 13:02:50 +0000
commit1731e5bd877af1468cb0d43776607bc3a8d2e224 (patch)
tree4f4078ff30664515fbae16c00d957ab020eee4c2 /sources
parentc83874f3a2b02915c2e6bfa14a63714e956da423 (diff)
downloadscala-1731e5bd877af1468cb0d43776607bc3a8d2e224.tar.gz
scala-1731e5bd877af1468cb0d43776607bc3a8d2e224.tar.bz2
scala-1731e5bd877af1468cb0d43776607bc3a8d2e224.zip
- Added attribute IS_ERROR
- Added methods newErrorValue and newErrorClass
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/symtab/Symbol.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index 42a9606e91..b29584e2dc 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -43,6 +43,7 @@ public abstract class Symbol implements Modifiers, Kinds {
public static final int IS_ANONYMOUS = 0x00000002;
public static final int IS_LABEL = 0x00000010;
public static final int IS_ACCESSMETHOD = 0x00000100;
+ public static final int IS_ERROR = 0x10000000;
public static final int IS_THISTYPE = 0x20000000;
public static final int IS_LOCALDUMMY = 0x40000000;
public static final int IS_COMPOUND = 0x80000000;
@@ -211,6 +212,16 @@ public abstract class Symbol implements Modifiers, Kinds {
return peckage;
}
+ /**
+ * Creates a new error value owned by this symbol and initializes
+ * it with an error type.
+ */
+ public Symbol newErrorValue(Name name) {
+ Symbol symbol = newTerm(pos, SYNTHETIC, name, IS_ERROR);
+ symbol.setInfo(Type.ErrorType);
+ return symbol;
+ }
+
/** Creates a new type alias owned by this symbol. */
public final Symbol newTypeAlias(int pos, int flags, Name name) {
return new AliasTypeSymbol(pos, name, this, flags, 0);
@@ -266,6 +277,17 @@ public abstract class Symbol implements Modifiers, Kinds {
}
/**
+ * Creates a new error class owned by this symbol and initializes
+ * it with an error type.
+ */
+ public ClassSymbol newErrorClass(Name name) {
+ ClassSymbol symbol = newClass(pos, SYNTHETIC, name, IS_ERROR, NONE);
+ symbol.setInfo(Type.ErrorType);
+ symbol.allConstructors().setInfo(Type.ErrorType);
+ return symbol;
+ }
+
+ /**
* Creates a new class with a dual module class, both owned by
* this symbol, initializes them with the loader and enters the
* class and the module in the scope if it's non-null.
@@ -493,9 +515,9 @@ public abstract class Symbol implements Modifiers, Kinds {
// Symbol classification ----------------------------------------------------
- /** Does this symbol denote the error symbol? */
+ /** Does this symbol denote an error symbol? */
public final boolean isError() {
- return kind == Kinds.ERROR;
+ return (attrs & IS_ERROR) != 0;
}
/** Does this symbol denote the none symbol? */
@@ -1933,7 +1955,7 @@ final class ErrorSymbol extends Symbol {
/** Constructor */
public ErrorSymbol() {
- super(Kinds.ERROR, Position.NOPOS, Names.ERROR, null, 0, 0);
+ super(Kinds.ERROR, Position.NOPOS, Names.ERROR, null, 0, IS_ERROR);
super.setInfo(Type.ErrorType);
}