summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-06-24 15:23:54 +0000
committerMartin Odersky <odersky@gmail.com>2005-06-24 15:23:54 +0000
commit43e1f829ef446e1f5d8e4a360b2be68b1a7065c6 (patch)
tree546fd08659eca6321fa8ec5f26f4bc9be0200971
parenta93bb8d43f4d40e64822b01e405c00886e9ca272 (diff)
downloadscala-43e1f829ef446e1f5d8e4a360b2be68b1a7065c6.tar.gz
scala-43e1f829ef446e1f5d8e4a360b2be68b1a7065c6.tar.bz2
scala-43e1f829ef446e1f5d8e4a360b2be68b1a7065c6.zip
*** empty log message ***
-rw-r--r--config/list/nsc.lst12
-rwxr-xr-xsources/scala/tools/nsc/Global.scala9
-rw-r--r--sources/scala/tools/nsc/ast/TreePrinters.scala4
-rw-r--r--sources/scala/tools/nsc/ast/Trees.scala30
-rw-r--r--sources/scala/tools/nsc/matching/AlgebraicMatchers.scala (renamed from sources/scala/tools/nsc/matching/AlgebraicMatcher.scala)0
-rw-r--r--sources/scala/tools/nsc/matching/PatternMatchers.scala (renamed from sources/scala/tools/nsc/matching/PatternMatcher.scala)0
-rw-r--r--sources/scala/tools/nsc/matching/SequenceMatchers.scala (renamed from sources/scala/tools/nsc/matching/SequenceMatcher.scala)0
-rwxr-xr-xsources/scala/tools/nsc/symtab/Definitions.scala11
-rwxr-xr-xsources/scala/tools/nsc/transform/UnCurry.scala5
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Typers.scala13
10 files changed, 43 insertions, 41 deletions
diff --git a/config/list/nsc.lst b/config/list/nsc.lst
index 2a32ab9d0a..902550db08 100644
--- a/config/list/nsc.lst
+++ b/config/list/nsc.lst
@@ -23,20 +23,20 @@ ast/parser/SyntaxAnalyzer.scala
ast/parser/Tokens.scala
ast/parser/TreeBuilder.scala
-matching/AlgebraicMatcher.scala
+matching/AlgebraicMatchers.scala
matching/Autom2Scala.scala
-matching/BerrySethi.scala
+matching/BerrySethis.scala
matching/CodeFactory.scala
-matching/DetWordAutom.scala
+matching/DetWordAutoms.scala
matching/LeftTracerInScala.scala
matching/MatcherLabels.scala
-matching/NondetWordAutom.scala
+matching/NondetWordAutoms.scala
matching/Npair.scala
-matching/PatternMatcher.scala
+matching/PatternMatchers.scala
matching/PatternNodeCreator.scala
matching/PatternNodes.scala
matching/RightTracerInScala.scala
-matching/SequenceMatcher.scala
+matching/SequenceMatchers.scala
matching/StateSetComparator.scala
matching/TransMatcher.scala
matching/WordAutomInScala.scala
diff --git a/sources/scala/tools/nsc/Global.scala b/sources/scala/tools/nsc/Global.scala
index b914b95e80..ef00c40ce1 100755
--- a/sources/scala/tools/nsc/Global.scala
+++ b/sources/scala/tools/nsc/Global.scala
@@ -16,7 +16,7 @@ import util._;
import ast._;
import ast.parser._;
import typechecker._;
-import matching.TransMatcher;
+//import matching.TransMatcher;
import transform._;
class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable with Trees with CompilationUnits {
@@ -170,12 +170,13 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
}
val uncurryPhase = new uncurry.Phase(refchecksPhase);
+/*
object transmatcher extends TransMatcher {
val global: Global.this.type = Global.this;
}
-
- val transMatchPhase = new transmatcher.Phase(uncurryPhase);
+*/
+ //val transMatchPhase = new transmatcher.Phase(uncurryPhase);
//object typesAsValues extends TypesAsValues {
// val global: Global.this.type = Global.this;
//}
@@ -183,7 +184,7 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
object sampleTransform extends SampleTransform {
val global: Global.this.type = Global.this;
}
- val samplePhase = new sampleTransform.Phase(transMatchPhase);
+ val samplePhase = new sampleTransform.Phase(uncurryPhase);
//val transMatchPhase = new transmatcher.TransMatchPhase(picklePhase);
/*
diff --git a/sources/scala/tools/nsc/ast/TreePrinters.scala b/sources/scala/tools/nsc/ast/TreePrinters.scala
index d04c658778..ea3c9616eb 100644
--- a/sources/scala/tools/nsc/ast/TreePrinters.scala
+++ b/sources/scala/tools/nsc/ast/TreePrinters.scala
@@ -170,8 +170,8 @@ abstract class TreePrinters {
case Bind(name, t) =>
print("("); print(symName(tree, name)); print(" @ "); print(t); print(")");
- case SeqTerm(trees) =>
- printRow(trees, "[", ", ", "]")
+ case ArrayValue(elemtpt, trees) =>
+ print("Array["); print(elemtpt); printRow(trees, "]{", ", ", "}")
case Function(vparams, body) =>
print("("); printValueParams(vparams); print(" => "); print(body); print(")")
diff --git a/sources/scala/tools/nsc/ast/Trees.scala b/sources/scala/tools/nsc/ast/Trees.scala
index bde6629010..7a92280d17 100644
--- a/sources/scala/tools/nsc/ast/Trees.scala
+++ b/sources/scala/tools/nsc/ast/Trees.scala
@@ -287,11 +287,9 @@ abstract class Trees: Global {
case class Bind(name: Name, body: Tree)
extends DefTree;
- /** Sequence of expressions, needs to be translated in backend,
- * ideally like this: SeqTerm(t1,...,tn) = Vector({t1,...,tn}),
- * where { ... } is an array.
+ /** Array of expressions, needs to be translated in backend,
*/
- case class SeqTerm(trees: List[Tree])
+ case class ArrayValue(elemtpt: Tree, elems: List[Tree])
extends TermTree;
/** Anonymous function, eliminated by analyzer */
@@ -450,7 +448,7 @@ abstract class Trees: Global {
case Alternative(trees) => (eliminated by transmatch)
case Star(elem) => (eliminated by transmatch)
case Bind(name, body) => (eliminated by transmatch)
- case SeqTerm(trees) =>
+ case ArrayValue(elemtpt, trees) => (introduced by uncurry)
case Function(vparams, body) => (eliminated by typecheck)
case Assign(lhs, rhs) =>
case If(cond, thenp, elsep) =>
@@ -493,7 +491,7 @@ abstract class Trees: Global {
def Alternative(tree: Tree, trees: List[Tree]): Alternative;
def Star(tree: Tree, elem: Tree): Star;
def Bind(tree: Tree, name: Name, body: Tree): Bind;
- def SeqTerm(tree: Tree, trees: List[Tree]): SeqTerm;
+ def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]): ArrayValue;
def Function(tree: Tree, vparams: List[ValDef], body: Tree): Function;
def Assign(tree: Tree, lhs: Tree, rhs: Tree): Assign;
def If(tree: Tree, cond: Tree, thenp: Tree, elsep: Tree): If;
@@ -554,8 +552,8 @@ abstract class Trees: Global {
new Star(elem).copyAttrs(tree);
def Bind(tree: Tree, name: Name, body: Tree) =
new Bind(name, body).copyAttrs(tree);
- def SeqTerm(tree: Tree, trees: List[Tree]) =
- new SeqTerm(trees).copyAttrs(tree);
+ def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]) =
+ new ArrayValue(elemtpt, trees).copyAttrs(tree);
def Function(tree: Tree, vparams: List[ValDef], body: Tree) =
new Function(vparams, body).copyAttrs(tree);
def Assign(tree: Tree, lhs: Tree, rhs: Tree) =
@@ -692,10 +690,10 @@ abstract class Trees: Global {
if ((name0 == name) && (body0 == body)) => t
case _ => copy.Bind(tree, name, body)
}
- def SeqTerm(tree: Tree, trees: List[Tree]) = tree match {
- case t @ SeqTerm(trees0)
- if ((trees0 == trees)) => t
- case _ => copy.SeqTerm(tree, trees)
+ def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]) = tree match {
+ case t @ ArrayValue(elemtpt0, trees0)
+ if ((elemtpt0 == elemtpt) && (trees0 == trees)) => t
+ case _ => copy.ArrayValue(tree, elemtpt, trees)
}
def Function(tree: Tree, vparams: List[ValDef], body: Tree) = tree match {
case t @ Function(vparams0, body0)
@@ -860,8 +858,8 @@ abstract class Trees: Global {
copy.Star(tree, transform(elem))
case Bind(name, body) =>
copy.Bind(tree, name, transform(body))
- case SeqTerm(trees) =>
- copy.SeqTerm(tree, transformTrees(trees))
+ case ArrayValue(elemtpt, trees) =>
+ copy.ArrayValue(tree, transform(elemtpt), transformTrees(trees))
case Function(vparams, body) =>
copy.Function(tree, transformValDefs(vparams), transform(body))
case Assign(lhs, rhs) =>
@@ -988,8 +986,8 @@ abstract class Trees: Global {
traverse(elem)
case Bind(name, body) =>
traverse(body)
- case SeqTerm(trees) =>
- traverseTrees(trees)
+ case ArrayValue(elemtpt, trees) =>
+ traverse(elemtpt); traverseTrees(trees)
case Function(vparams, body) =>
traverseTrees(vparams); traverse(body)
case Assign(lhs, rhs) =>
diff --git a/sources/scala/tools/nsc/matching/AlgebraicMatcher.scala b/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala
index 1d32485fcc..1d32485fcc 100644
--- a/sources/scala/tools/nsc/matching/AlgebraicMatcher.scala
+++ b/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala
diff --git a/sources/scala/tools/nsc/matching/PatternMatcher.scala b/sources/scala/tools/nsc/matching/PatternMatchers.scala
index 1e4dfabf3a..1e4dfabf3a 100644
--- a/sources/scala/tools/nsc/matching/PatternMatcher.scala
+++ b/sources/scala/tools/nsc/matching/PatternMatchers.scala
diff --git a/sources/scala/tools/nsc/matching/SequenceMatcher.scala b/sources/scala/tools/nsc/matching/SequenceMatchers.scala
index dcbd9bc1a5..dcbd9bc1a5 100644
--- a/sources/scala/tools/nsc/matching/SequenceMatcher.scala
+++ b/sources/scala/tools/nsc/matching/SequenceMatchers.scala
diff --git a/sources/scala/tools/nsc/symtab/Definitions.scala b/sources/scala/tools/nsc/symtab/Definitions.scala
index 2dab0dcab1..f12bc799f5 100755
--- a/sources/scala/tools/nsc/symtab/Definitions.scala
+++ b/sources/scala/tools/nsc/symtab/Definitions.scala
@@ -143,6 +143,10 @@ abstract class Definitions: SymbolTable {
// pattern wildcard
var PatternWildcard: Symbol = _;
+ // boxed classes
+ var BoxedArrayClass: Symbol = _;
+ var BoxedUnitClass: Symbol = _;
+
def getModule(fullname: Name): Symbol =
getModuleOrClass(fullname, true);
@@ -311,11 +315,10 @@ abstract class Definitions: SymbolTable {
String_+ = newMethod(
StringClass, "+", List(AnyClass.typeConstructor), StringClass.typeConstructor) setFlag FINAL;
- //Iterator_next = //??
- //Iterator_hasNext = //??
+ PatternWildcard = NoSymbol.newValue(Position.NOPOS, "_").setInfo(AllClass.typeConstructor);
- // pattern wildcard
- PatternWildcard = NoSymbol.newValue(Position.NOPOS, "_").setInfo(AllClass.typeConstructor)
+ BoxedArrayClass = getClass("scala.runtime.BoxedArray");
+ BoxedUnitClass = getClass("scala.runtime.BoxedUnit");
}
}
}
diff --git a/sources/scala/tools/nsc/transform/UnCurry.scala b/sources/scala/tools/nsc/transform/UnCurry.scala
index 069958c07f..03de525857 100755
--- a/sources/scala/tools/nsc/transform/UnCurry.scala
+++ b/sources/scala/tools/nsc/transform/UnCurry.scala
@@ -20,7 +20,7 @@ package scala.tools.nsc.transform;
* - for every argument list that corresponds to a repeated parameter
* (a_1, ..., a_n) => (Seq(a_1, ..., a_n))
* - for every argument list that is an escaped sequence
- * (a_1:_*) => (a_1)
+ * (a_1:_*) => (a_1)g
* - convert implicit method types to method types
* - todo: check-no-double-def in erasure
*/
@@ -90,7 +90,8 @@ abstract class UnCurry extends InfoTransform {
val args1 =
formals.last match {
case TypeRef(pre, sym, List(elempt)) if (sym == RepeatedParamClass) =>
- def mkSequence(args: List[Tree]) = atPos(pos)(SeqTerm(args) setType formals.last);
+ def mkSequence(args: List[Tree]) = atPos(pos)(
+ ArrayValue(TypeTree(elempt), args) setType formals.last);
if (args.isEmpty) List(mkSequence(args))
else {
val suffix = args.last match {
diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala
index d5c94046d9..0e91a856cd 100755
--- a/sources/scala/tools/nsc/typechecker/Typers.scala
+++ b/sources/scala/tools/nsc/typechecker/Typers.scala
@@ -1005,13 +1005,12 @@ abstract class Typers: Analyzer {
if (vble.name != nme.WILDCARD) namer.enterInScope(vble);
copy.Bind(tree, name, body1) setSymbol vble setType pt
- case SeqTerm(elems) =>
- val elempt = pt.baseType(SeqClass) match {
- case TypeRef(pre, seqClass, List(arg)) => arg
- case _ => WildcardType
- }
- val elems1 = List.mapConserve(elems)(elem => typed(elem, mode, elempt));
- copy.SeqTerm(tree, elems1) setType ptOrLub(elems1 map (.tpe))
+ case ArrayValue(elemtpt, elems) =>
+ val elemtpt1 = typedType(elemtpt);
+ val elems1 = List.mapConserve(elems)(elem => typed(elem, mode, elemtpt1.tpe));
+ copy.ArrayValue(tree, elemtpt1, elems1)
+ setType (if (isFullyDefined(pt)) pt
+ else appliedType(ArrayClass.tpe, List(elemtpt1.tpe)))
case fun @ Function(_, _) =>
newTyper(context.makeNewScope(tree, context.owner)).typedFunction(fun, mode, pt)