diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-08-08 18:55:05 +0200 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-08-14 11:45:47 +0200 |
commit | b4598b4a7826b76cc6405b448b50d6c20f7a5732 (patch) | |
tree | 11c03a03ec45b8e4f1f53c13cfef0f24667c5fa2 /test/files | |
parent | d7ad291a0f93004fe9dc38f2414b77276f148c5c (diff) | |
download | scala-b4598b4a7826b76cc6405b448b50d6c20f7a5732.tar.gz scala-b4598b4a7826b76cc6405b448b50d6c20f7a5732.tar.bz2 scala-b4598b4a7826b76cc6405b448b50d6c20f7a5732.zip |
SI-7331 remove all the wrapping code from toolbox
Change toolbox parsing to use `parseStats` parser entry point
instead of current code-wrappign technique that makes positions
much less useful to end users.
There is also no need to create a compiler `Run` for parsing.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t7331a.check | 2 | ||||
-rw-r--r-- | test/files/run/t7331a.scala | 10 | ||||
-rw-r--r-- | test/files/run/t7331b.check | 3 | ||||
-rw-r--r-- | test/files/run/t7331b.scala | 11 | ||||
-rw-r--r-- | test/files/run/t7331c.check | 3 | ||||
-rw-r--r-- | test/files/run/t7331c.scala | 11 |
6 files changed, 40 insertions, 0 deletions
diff --git a/test/files/run/t7331a.check b/test/files/run/t7331a.check new file mode 100644 index 0000000000..a59b400344 --- /dev/null +++ b/test/files/run/t7331a.check @@ -0,0 +1,2 @@ +source-<toolbox>,line-1,offset=0 +2
\ No newline at end of file diff --git a/test/files/run/t7331a.scala b/test/files/run/t7331a.scala new file mode 100644 index 0000000000..1851945e63 --- /dev/null +++ b/test/files/run/t7331a.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val tree = tb.parse("x") + println(tree.pos) + println(tree.pos.source.content.length) +}
\ No newline at end of file diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check new file mode 100644 index 0000000000..7034a95a3f --- /dev/null +++ b/test/files/run/t7331b.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +')' expected but eof found. diff --git a/test/files/run/t7331b.scala b/test/files/run/t7331b.scala new file mode 100644 index 0000000000..052656d11b --- /dev/null +++ b/test/files/run/t7331b.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} + +object Test extends App { + val tb = cm.mkToolBox() + try tb.parse("f(x") + catch { + case ToolBoxError(msg, _) => println(msg) + } +}
\ No newline at end of file diff --git a/test/files/run/t7331c.check b/test/files/run/t7331c.check new file mode 100644 index 0000000000..fd3ac1d9ef --- /dev/null +++ b/test/files/run/t7331c.check @@ -0,0 +1,3 @@ +ClassDef(Modifiers(), TypeName("C"), List(), Template(List(Select(Ident(scala), TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))))) +source-<toolbox>,line-1,offset=6 +NoPosition diff --git a/test/files/run/t7331c.scala b/test/files/run/t7331c.scala new file mode 100644 index 0000000000..75873afcd0 --- /dev/null +++ b/test/files/run/t7331c.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val tree = tb.parse("class C").asInstanceOf[ClassDef] + println(showRaw(tree)) + println(tree.pos) + println(tree.impl.self.pos) +}
\ No newline at end of file |