aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-06-12 16:17:34 +0200
committerMartin Odersky <odersky@gmail.com>2013-06-12 16:17:34 +0200
commit8ad783bf633ba5f913fda84c376dcec9dabd69a9 (patch)
tree1bcfe593e1c2c2fda4936168a0b0f12bcf9dddbe
parent4124ff23501eb8d30f0aa873bb3ea79115812f82 (diff)
downloaddotty-8ad783bf633ba5f913fda84c376dcec9dabd69a9.tar.gz
dotty-8ad783bf633ba5f913fda84c376dcec9dabd69a9.tar.bz2
dotty-8ad783bf633ba5f913fda84c376dcec9dabd69a9.zip
Made pos a total method on Symbols, returns NoSymbol if undefined.
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index 881e86880..9e68aab6d 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -377,10 +377,10 @@ object Symbols {
private def pickFile(file: AbstractFile, classFile: Boolean): AbstractFile =
if ((file eq null) || classFile != (file.path endsWith ".class")) null else file
- /** The position of this symbol.
- * @pre Symbol was loaded from source
+ /** The position of this symbol, or NoPosition is symbol was not loaded
+ * from source.
*/
- def pos: Position = coord.toPosition
+ def pos: Position = if (coord.isPosition) coord.toPosition else NoPosition
/** The prefix string to be used when displaying this symbol without denotation */
protected def prefixString = "Symbol"