diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 09:09:16 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:49:04 +0200 |
commit | 94e280dee6655f9d4242ab5fd1f46c97975c7182 (patch) | |
tree | 594620b7c95454afe0aa711ead450d3a2cd8c7ea /src | |
parent | e9fbb661a3deb6e6234bdf94dce6fa98a205f3ca (diff) | |
download | scala-94e280dee6655f9d4242ab5fd1f46c97975c7182.tar.gz scala-94e280dee6655f9d4242ab5fd1f46c97975c7182.tar.bz2 scala-94e280dee6655f9d4242ab5fd1f46c97975c7182.zip |
exposes Position.source as SourceFile
It was useful to pretend that SourceFile isn't a part of the API,
when it's physical location was in scala-compiler.jar.
Afterwards Position and SourceFile have been moved to scala-reflect.jar,
and (what's more important) scala-reflect.jar gained experimental status,
meaning that we're not bound by backward compatibility in 2.10.0.
Therefore I'd say we should expose a full-fledged SourceFile in Position.source
(just as we do for Symbol.associatedFile) and later find out how to strip down
its interface to something suitable for public consumption.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/api/Position.scala | 10 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/util/Position.scala | 10 |
2 files changed, 5 insertions, 15 deletions
diff --git a/src/reflect/scala/reflect/api/Position.scala b/src/reflect/scala/reflect/api/Position.scala index 2bbc9172da..9c63e4becf 100644 --- a/src/reflect/scala/reflect/api/Position.scala +++ b/src/reflect/scala/reflect/api/Position.scala @@ -50,12 +50,12 @@ trait Position extends Attachments { type Pos >: Null <: Position /** Java file corresponding to the source file of this position. + * + * The return type is [[scala.reflect.io.AbstractFile]], which belongs to an experimental part of Scala reflection. + * It should not be used unless you know what you are doing. In subsequent releases, this API will be refined + * and exposed as a part of scala.reflect.api. */ - def fileInfo: java.io.File - - /** Content of the source file that contains this position. - */ - def fileContent: Array[Char] + def source: scala.reflect.internal.util.SourceFile /** Is this position neither a NoPosition nor a FakePosition? * If isDefined is true, offset and source are both defined. diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala index 0e5bbfa940..151a64daff 100644 --- a/src/reflect/scala/reflect/internal/util/Position.scala +++ b/src/reflect/scala/reflect/internal/util/Position.scala @@ -43,16 +43,6 @@ abstract class Position extends scala.reflect.api.Position { self => def withPos(newPos: Position): Attachments { type Pos = self.Pos } = newPos - /** Java file corresponding to the source file of this position. - */ - // necessary for conformance with scala.reflect.api.Position - def fileInfo: java.io.File = source.file.file - - /** Contents of the source file that contains this position. - */ - // necessary for conformance with scala.reflect.api.Position - def fileContent: Array[Char] = source.content - /** An optional value containing the source file referred to by this position, or * None if not defined. */ |