diff options
author | Eugene Vigdorchik <eugenevigdorchik@epfl.ch> | 2010-10-04 17:20:40 +0000 |
---|---|---|
committer | Eugene Vigdorchik <eugenevigdorchik@epfl.ch> | 2010-10-04 17:20:40 +0000 |
commit | 6472e115d500bc0cae6064af2603c94c247c9732 (patch) | |
tree | ed7ae665ece155b3d436dcfeabaea0e8c542eeb3 | |
parent | ff1e0647c18c4a79f1276b0d0a2360faed03b7d0 (diff) | |
download | scala-6472e115d500bc0cae6064af2603c94c247c9732.tar.gz scala-6472e115d500bc0cae6064af2603c94c247c9732.tar.bz2 scala-6472e115d500bc0cae6064af2603c94c247c9732.zip |
Locator should follow TypeTree#original to get ...
Locator should follow TypeTree#original to get the smallest tree
containing a position. review by odersky
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/RangePositions.scala | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala index 889f51e7ab..cf66c80b02 100644 --- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala +++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala @@ -255,16 +255,20 @@ self: scala.tools.nsc.Global => } protected def isEligible(t: Tree) = !t.pos.isTransparent override def traverse(t: Tree) { - if (t.pos includes pos) { - if (isEligible(t)) last = t - super.traverse(t) - } else if (t.symbol != null) { - for(annot <- t.symbol.annotations if (annot.pos includes pos) && !annot.pos.isTransparent) { - last = Annotated(TypeTree(annot.atp) setPos annot.pos, t) - last.setType(annot.atp) - last.setPos(annot.pos) - traverseTrees(annot.args) - } + t match { + case tt : TypeTree if tt.original != null => traverse(tt.original) + case _ => + if (t.pos includes pos) { + if (isEligible(t)) last = t + super.traverse(t) + } else if (t.symbol != null) { + for(annot <- t.symbol.annotations if (annot.pos includes pos) && !annot.pos.isTransparent) { + last = Annotated(TypeTree(annot.atp) setPos annot.pos, t) + last.setType(annot.atp) + last.setPos(annot.pos) + traverseTrees(annot.args) + } + } } } } |