summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-05-29 14:49:11 +0000
committerMartin Odersky <odersky@gmail.com>2009-05-29 14:49:11 +0000
commit5ef904034f8a4a1c12cf5e3621714eaa19d63ef1 (patch)
treed087cf4b3a77bc7eb2d0348fb75f45cce817e3f5 /src/compiler
parent660b4beeda91771b0569571b5ef8d12cfd63fa1d (diff)
downloadscala-5ef904034f8a4a1c12cf5e3621714eaa19d63ef1.tar.gz
scala-5ef904034f8a4a1c12cf5e3621714eaa19d63ef1.tar.bz2
scala-5ef904034f8a4a1c12cf5e3621714eaa19d63ef1.zip
rest of last commit
Diffstat (limited to 'src/compiler')
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala20
-rwxr-xr-xsrc/compiler/scala/tools/nsc/interactive/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala2
4 files changed, 16 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 0c434e200d..c116b60cee 100755
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -116,7 +116,7 @@ self =>
def o2p(offset: Int): Position
def r2p(start: Int, mid: Int, end: Int): Position
- def t2p(tree: Tree): Position = SyntheticPosition(tree)
+ def t2p(tree: Tree): Position = SyntheticAliasPosition(tree)
//private implicit def p2i(pos: Position) = pos.offset.get
/** whether a non-continuable syntax error has been seen */
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 39bd230212..28cb07b421 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -39,9 +39,13 @@ abstract class TreeBuilder {
private object patvarTransformer extends Transformer {
override def transform(tree: Tree): Tree = tree match {
case Ident(name) if (treeInfo.isVarPattern(tree) && name != nme.WILDCARD) =>
- atPos(tree.pos)(Bind(name, Ident(nme.WILDCARD)))
+ atPos(tree.pos)(Bind(name, atPos(tree) (Ident(nme.WILDCARD))))
case Typed(id @ Ident(name), tpt) if (treeInfo.isVarPattern(id) && name != nme.WILDCARD) =>
- Bind(name, atPos(tree.pos)(Typed(Ident(nme.WILDCARD), tpt))) setPos id.pos
+ atPos(tree.pos.withPoint(id.pos.point)) {
+ Bind(name, atPos(tree.pos.withStart(tree.pos.point)) {
+ Typed(Ident(nme.WILDCARD), tpt)
+ })
+ }
case Apply(fn @ Apply(_, _), args) =>
copy.Apply(tree, transform(fn), transformTrees(args))
case Apply(fn, args) =>
@@ -105,7 +109,7 @@ abstract class TreeBuilder {
case _ => t
}
- def makeAnnotated(t: Tree, annot: Annotation): Tree = Annotated(annot, t) setPos annot.pos
+ def makeAnnotated(t: Tree, annot: Annotation): Tree = atPos(annot.pos union t.pos)(Annotated(annot, t))
def makeSelfDef(name: Name, tpt: Tree): ValDef =
ValDef(Modifiers(PRIVATE), name, tpt, EmptyTree)
@@ -387,10 +391,10 @@ abstract class TreeBuilder {
def makePatDef(pat: Tree, rhs: Tree): List[Tree] =
makePatDef(Modifiers(0), pat, rhs)
- /** Create tree for pattern definition &lt;mods val pat0 = rhs&gt; */
+ /** Create tree for pattern definition <mods val pat0 = rhs> */
def makePatDef(mods: Modifiers, pat: Tree, rhs: Tree): List[Tree] = matchVarPattern(pat) match {
case Some((name, tpt)) =>
- List(ValDef(mods, name, tpt, rhs).setPos(pat.pos))
+ List(ValDef(mods, name, tpt, rhs))
case None =>
// in case there is exactly one variable x_1 in pattern
@@ -403,14 +407,14 @@ abstract class TreeBuilder {
// val/var x_N = t$._N
val pat1 = patvarTransformer.transform(pat)
val vars = getVariables(pat1)
- val matchExpr = atPos(pat1.pos){
+ val matchExpr = atPos(rhs.pos){
Match(
makeUnchecked(rhs),
- List(CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map Ident, true))))
+ List(makeSynthetic(CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map Ident, true)))))
}
vars match {
case List((vname, tpt, pos)) =>
- List(ValDef(mods, vname, tpt, matchExpr).setPos(pos))
+ List(ValDef(mods, vname, tpt, matchExpr))
case _ =>
val tmp = freshName()
val firstDef = ValDef(Modifiers(PRIVATE | LOCAL | SYNTHETIC | (mods.flags & LAZY)),
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 4d72f9ae07..7d1333fab1 100755
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -228,6 +228,8 @@ self =>
}
}
+ def typeCompletion() {}
+
// ---------------- Helper classes ---------------------------
/** A transformer that replaces tree `from` with tree `to` in a given tree */
diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
index 5aedf09a28..2228de95bf 100644
--- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
@@ -52,7 +52,7 @@ abstract class AbstractReporter extends Reporter {
private def testAndLog(pos: Position, severity: Severity): Boolean = {
if (pos eq null) return false
if (pos.offset.isEmpty) return false
- val fpos = pos.focus
+ val fpos = pos.focusPoint
if ((positions contains fpos) && positions(fpos) >= severity) return true
positions += (fpos -> severity)
false