diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-08-27 17:32:54 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-27 17:32:54 +0200 |
commit | 819ba8c3862b9b85ba5377e68d8f1a87a3bcf105 (patch) | |
tree | 543b8d20516c9f3e923264600779ae2c3853764b /src | |
parent | 71837ac72f8d0f4b64e16157c8252208b46156c1 (diff) | |
download | scala-819ba8c3862b9b85ba5377e68d8f1a87a3bcf105.tar.gz scala-819ba8c3862b9b85ba5377e68d8f1a87a3bcf105.tar.bz2 scala-819ba8c3862b9b85ba5377e68d8f1a87a3bcf105.zip |
rehash of source file information for Symbol
Symbol.pos is moved to macros.Universe, because it's empty at runtime.
Also added Symbol.associatedFile, because it has valid usages during runtime.
When reflecting one might want to get to a classfile of the symbol and then
analyze it to e.g. decompile the bytecode or find out the associated src file.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Symbols.scala | 5 | ||||
-rw-r--r-- | src/reflect/scala/reflect/macros/Universe.scala | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala index 80caf22c17..d000351b36 100644 --- a/src/reflect/scala/reflect/api/Symbols.scala +++ b/src/reflect/scala/reflect/api/Symbols.scala @@ -15,9 +15,10 @@ trait Symbols extends base.Symbols { self: Universe => /** The API of symbols */ trait SymbolApi extends SymbolBase { this: Symbol => - /** The position of this symbol + /** Source file if this symbol is created during this compilation run, + * or a class file if this symbol is loaded from a *.class or *.jar. */ - def pos: Position + def associatedFile: scala.tools.nsc.io.AbstractFile /** A list of annotations attached to this Symbol. */ diff --git a/src/reflect/scala/reflect/macros/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala index 2f494c6f3d..06428ee3fc 100644 --- a/src/reflect/scala/reflect/macros/Universe.scala +++ b/src/reflect/scala/reflect/macros/Universe.scala @@ -26,6 +26,10 @@ abstract class Universe extends scala.reflect.api.Universe { def deSkolemize: Symbol + /** The position of this symbol + */ + def pos: Position + def setTypeSignature(tpe: Type): Symbol def setAnnotations(annots: AnnotationInfo*): Symbol |