summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2005-05-29 23:06:35 +0000
committermihaylov <mihaylov@epfl.ch>2005-05-29 23:06:35 +0000
commit08d6815870d309e1ce924a99f17f50c6e46f89cd (patch)
treeb02781adb87721405c94615ac91c57aa88c922c3 /sources/scalac/symtab
parenta50fb39267918c2ff500143e2c622445edacdffa (diff)
downloadscala-08d6815870d309e1ce924a99f17f50c6e46f89cd.tar.gz
scala-08d6815870d309e1ce924a99f17f50c6e46f89cd.tar.bz2
scala-08d6815870d309e1ce924a99f17f50c6e46f89cd.zip
Initial support for attributes - only works for...
Initial support for attributes - only works for the scala.serializable attribute
Diffstat (limited to 'sources/scalac/symtab')
-rw-r--r--sources/scalac/symtab/AttributeInfo.java39
-rw-r--r--sources/scalac/symtab/Definitions.java16
2 files changed, 50 insertions, 5 deletions
diff --git a/sources/scalac/symtab/AttributeInfo.java b/sources/scalac/symtab/AttributeInfo.java
new file mode 100644
index 0000000000..8269cc74a6
--- /dev/null
+++ b/sources/scalac/symtab/AttributeInfo.java
@@ -0,0 +1,39 @@
+package scalac.symtab;
+
+import scalac.atree.AConstant;
+import scalac.util.Debug;
+
+public class AttributeInfo {
+
+ public final Symbol constr;
+ public final AConstant[] args;
+ public final AttributeInfo next;
+
+ public AttributeInfo(Symbol constr, AConstant[] args, AttributeInfo next) {
+ this.constr = constr;
+ this.args = args;
+ this.next = next;
+ assert constr.isConstructor() : Debug.show(constr);
+ }
+
+ public AConstant[] getAttrArguments(Symbol sym) {
+ for (AttributeInfo attr = this; attr != null; attr = attr.next)
+ if (attr.constr == sym)
+ return attr.args;
+ return null;
+ }
+
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ for (AttributeInfo attr = this; attr != null; attr = attr.next) {
+ str.append('['); str.append(Debug.show(attr.constr.constructorClass()));
+ str.append('(');
+ for (int i = 0; i < attr.args.length; i++) {
+ if (i > 0) str.append(", ");
+ str.append(attr.args[i]);
+ }
+ str.append(")]\n");
+ }
+ return str.toString();
+ }
+}
diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java
index 11b49d1f57..a80ceeff52 100644
--- a/sources/scalac/symtab/Definitions.java
+++ b/sources/scalac/symtab/Definitions.java
@@ -77,10 +77,6 @@ public class Definitions {
public final Symbol THROWABLE_CLASS;
public final Type THROWABLE_TYPE() {return THROWABLE_CLASS.staticType();}
- /** The java.io.Serializable class */
- public final Symbol SERIALIZABLE_CLASS;
- public final Type SERIALIZABLE_TYPE() {return SERIALIZABLE_CLASS.staticType();}
-
//########################################################################
// Public Fields & Methods - Scala value classes
@@ -254,6 +250,12 @@ public class Definitions {
public final Symbol MATCHERROR;
//########################################################################
+ // attributes
+
+ public final Symbol SCALA_SERIALIZABLE_CONSTR;
+ public final Symbol SCALA_SERIAL_VERSION_UID_CONSTR;
+
+ //########################################################################
// Public Fields & Methods - Scala primitive types
/** Returns the primitive type void. */
@@ -789,7 +791,6 @@ public class Definitions {
STRING_CLASS = getClass(forMSIL ? "System.String" : "java.lang.String");
THROWABLE_CLASS =
getClass(forMSIL ? "System.Exception" : "java.lang.Throwable");
- SERIALIZABLE_CLASS = getClass("java.io.Serializable");
// the scala value classes
UNIT_CLASS = getClass("scala.Unit");
@@ -833,6 +834,11 @@ public class Definitions {
CONSOLE = getModule("scala.Console");
MATCHERROR = getModule("scala.MatchError");
+ SCALA_SERIALIZABLE_CONSTR = getClass("scala.serializable")
+ .primaryConstructor();
+ SCALA_SERIAL_VERSION_UID_CONSTR = getClass("scala.SerialVersionUID")
+ .primaryConstructor();
+
// initialize generated classes and aliases
initClass(ANY_CLASS, Type.EMPTY_ARRAY);
initAlias(ANYREF_CLASS, OBJECT_TYPE());