diff options
author | Martin Odersky <odersky@gmail.com> | 2011-07-06 11:44:51 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-07-06 11:44:51 +0000 |
commit | 2c28fc4afa6471fa4059fea674043081ab796423 (patch) | |
tree | d14bad13ce9b29c8aedd4d1e82ab52c8c1780322 | |
parent | 124e2f95aee0085b5df1af899008a63a762bece6 (diff) | |
download | scala-2c28fc4afa6471fa4059fea674043081ab796423.tar.gz scala-2c28fc4afa6471fa4059fea674043081ab796423.tar.bz2 scala-2c28fc4afa6471fa4059fea674043081ab796423.zip |
Fix to handling of imports in namers to make ID...
Fix to handling of imports in namers to make IDE structure building work
correctly.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/util/SourceFile.scala | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index c0160d5d34..1ea41ff928 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1278,6 +1278,9 @@ trait Namers { self: Analyzer => } checkSelectors(selectors) transformed(tree) = treeCopy.Import(tree, expr1, selectors) + expr.symbol = expr1.symbol // copy symbol and type attributes back into old expression + // so that the structure builder will find it. + expr.tpe = expr1.tpe ImportType(expr1) } } catch { diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 97aa08b183..44e06441ce 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -26,8 +26,10 @@ abstract class SourceFile { new OffsetPosition(this, offset) } def position(line: Int, column: Int) : Position = new OffsetPosition(this, lineToOffset(line) + column) + def offsetToLine(offset: Int): Int def lineToOffset(index : Int): Int + /** Map a position to a position in the underlying source file. * For regular source files, simply return the argument. */ |