summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-10-27 11:58:39 +0000
committerMartin Odersky <odersky@gmail.com>2003-10-27 11:58:39 +0000
commit36cde37b4aef5a1b4e2a0dc2554aafc0fece681e (patch)
tree352e7a2bc8d2018ed06b49d9410595b8fbed8db2 /sources
parent2f0b15f0e84313d6a513e96f71b9be5905268d64 (diff)
downloadscala-36cde37b4aef5a1b4e2a0dc2554aafc0fece681e.tar.gz
scala-36cde37b4aef5a1b4e2a0dc2554aafc0fece681e.tar.bz2
scala-36cde37b4aef5a1b4e2a0dc2554aafc0fece681e.zip
*** empty log message ***
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/ast/parser/Scanner.scala14
-rw-r--r--sources/scalac/symtab/classfile/Pickle.java6
-rw-r--r--sources/scalac/symtab/classfile/UnPickle.java9
-rw-r--r--sources/scalac/transformer/AddInterfaces.java2
4 files changed, 20 insertions, 11 deletions
diff --git a/sources/scalac/ast/parser/Scanner.scala b/sources/scalac/ast/parser/Scanner.scala
index 7411272ab7..d7376395eb 100644
--- a/sources/scalac/ast/parser/Scanner.scala
+++ b/sources/scalac/ast/parser/Scanner.scala
@@ -27,7 +27,7 @@ class Scanner(unit: Unit) extends TokenData {
/** buffer for the documentation comment
*/
- protected val docBuffer: StringBuffer = null;
+ protected var docBuffer: StringBuffer = null;
/** add the given character to the documentation buffer
*/
@@ -320,7 +320,7 @@ class Scanner(unit: Unit) extends TokenData {
true
} else if (ch == '*') {
docBuffer = null;
- val openComments = 1;
+ var openComments = 1;
nextch();
if (ch == '*') {
docBuffer = new StringBuffer("/**");
@@ -337,7 +337,7 @@ class Scanner(unit: Unit) extends TokenData {
nextch(); addCharToDoc(ch);
}
} else if (ch == LF) {
- cline++;
+ cline = cline + 1;
ccol = 0;
nextch(); addCharToDoc(ch);
} else if (ch == '\t') {
@@ -449,7 +449,7 @@ class Scanner(unit: Unit) extends TokenData {
/** returns true if argument corresponds to a keyword.
* Used in dtd2scala tool.
*/
- def isKeyword(str: String) = Name.fromString(str) <= maxKey;
+ def isKeyword(str: String) = Name.fromString(str).index <= maxKey;
def treatIdent(start: int, end: int) = {
name = Name.fromAscii(buf, start, end - start);
@@ -638,7 +638,7 @@ class Scanner(unit: Unit) extends TokenData {
}
def name2token(name: Name): int =
- if (name.index <= maxKey) key[name.index] else IDENTIFIER;
+ if (name.index <= maxKey) key(name.index) else IDENTIFIER;
def token2string(token: int): String = token match {
case IDENTIFIER =>
@@ -683,7 +683,7 @@ class Scanner(unit: Unit) extends TokenData {
"case object"
case _ =>
try {
- "'" + tokenName[token].toString() + "'"
+ "'" + tokenName(token).toString() + "'"
} catch {
case _: ArrayIndexOutOfBoundsException =>
"'<" + token + ">'"
@@ -692,7 +692,7 @@ class Scanner(unit: Unit) extends TokenData {
}
}
- def toString() = token match {
+ override def toString() = token match {
case IDENTIFIER =>
"id(" + name + ")"
case CHARLIT =>
diff --git a/sources/scalac/symtab/classfile/Pickle.java b/sources/scalac/symtab/classfile/Pickle.java
index 6b58cbf72c..bdc552e507 100644
--- a/sources/scalac/symtab/classfile/Pickle.java
+++ b/sources/scalac/symtab/classfile/Pickle.java
@@ -174,7 +174,8 @@ public class Pickle implements Kinds, Modifiers, EntryTags {
putTypes(args);
break;
case CompoundType(Type[] parents, Scope members):
- putSymbol(tp.symbol());
+ if (!tp.symbol().isCompoundSym())
+ putSymbol(tp.symbol());
putTypes(parents);
break;
case MethodType(Symbol[] vparams, Type result):
@@ -377,7 +378,8 @@ public class Pickle implements Kinds, Modifiers, EntryTags {
case CompoundType(Type[] parents, Scope members):
writeByte(COMPOUNDtpe);
writeByte(0); // space for length
- writeRef(tp.symbol());
+ if (!tp.symbol().isCompoundSym())
+ writeRef(tp.symbol());
writeRefs(parents);
break;
diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java
index d59d2bc192..482287fbb7 100644
--- a/sources/scalac/symtab/classfile/UnPickle.java
+++ b/sources/scalac/symtab/classfile/UnPickle.java
@@ -333,9 +333,14 @@ public class UnPickle implements Kinds, Modifiers, EntryTags {
readTypeRef(), readSymbolRef(), readTypeRefs(end));
break;
case COMPOUNDtpe:
- Symbol clazz = readSymbolRef();
+ Symbol[] clazzs = readSymbolRefs(end);
Type[] parents = readTypeRefs(end);
- tpe = Type.compoundType(parents, new Scope(), clazz);
+ if (clazzs.length == 0) {
+ tpe = Type.compoundType(parents, new Scope());
+ } else {
+ assert clazzs.length == 1;
+ tpe = Type.compoundType(parents, new Scope(), clazzs[0]);
+ }
break;
case METHODtpe:
Type restype = readTypeRef();
diff --git a/sources/scalac/transformer/AddInterfaces.java b/sources/scalac/transformer/AddInterfaces.java
index 46650b7a2a..b2f61cfa1c 100644
--- a/sources/scalac/transformer/AddInterfaces.java
+++ b/sources/scalac/transformer/AddInterfaces.java
@@ -241,11 +241,13 @@ class AddInterfaces extends Transformer {
case New(Template templ): {
Tree.New newTree = (Tree.New)super.transform(tree);
Type tp = newTree.type;
+ /*
switch (tp) {
case CompoundType(Type[] parts, _): tp = parts[0];
// gross hack to prevent crashing when selftypes are compound;
// should be fixed!
}
+ */
Symbol ifaceSym = tp.unalias().symbol();
if (phase.needInterface(ifaceSym)) {
Map clsMap = new HashMap();