diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-31 23:29:35 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-14 23:51:24 +0100 |
commit | 73adf2d9de441e151a117a5b33ae707ad79a9f36 (patch) | |
tree | a89a66cdbe161ef473a4ea16d5a6de17b50d81e2 /src | |
parent | 63462f3d5f032639e80571176c91c34b91e65441 (diff) | |
download | scala-73adf2d9de441e151a117a5b33ae707ad79a9f36.tar.gz scala-73adf2d9de441e151a117a5b33ae707ad79a9f36.tar.bz2 scala-73adf2d9de441e151a117a5b33ae707ad79a9f36.zip |
introduces c.internal
Sometimes universe.internal just won’t cut it (for example, when internal
APIs need access to enclosingOwner or to the typechecker), and for that
we need c.internal.
It’s totally not a problem for us in Scala, because with first-class modules
we can just inherit c.internal from c.universe.internal and have it expose
all the basic APIs automatically. Yay for Scala!
Diffstat (limited to 'src')
4 files changed, 31 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/macros/contexts/Context.scala b/src/compiler/scala/reflect/macros/contexts/Context.scala index 87dac18849..f3dd29d8b2 100644 --- a/src/compiler/scala/reflect/macros/contexts/Context.scala +++ b/src/compiler/scala/reflect/macros/contexts/Context.scala @@ -15,7 +15,8 @@ abstract class Context extends scala.reflect.macros.blackbox.Context with Parsers with Evals with ExprUtils - with Traces { + with Traces + with Internals { val universe: Global diff --git a/src/compiler/scala/reflect/macros/contexts/Internals.scala b/src/compiler/scala/reflect/macros/contexts/Internals.scala new file mode 100644 index 0000000000..e0f7824cf3 --- /dev/null +++ b/src/compiler/scala/reflect/macros/contexts/Internals.scala @@ -0,0 +1,9 @@ +package scala.reflect.macros +package contexts + +trait Internals { + self: Context => + + lazy val internal: ContextInternalApi = new global.SymbolTableInternal with ContextInternalApi { + } +}
\ No newline at end of file diff --git a/src/reflect/scala/reflect/macros/Internals.scala b/src/reflect/scala/reflect/macros/Internals.scala new file mode 100644 index 0000000000..f74f120470 --- /dev/null +++ b/src/reflect/scala/reflect/macros/Internals.scala @@ -0,0 +1,18 @@ +package scala +package reflect +package macros + +/** + * <span class="badge badge-red" style="float: right;">EXPERIMENTAL</span> + * @see [[scala.reflect.api.Internals]] + */ +trait Internals { + self: blackbox.Context => + + /** @see [[scala.reflect.api.Internals]] */ + val internal: ContextInternalApi + + /** @see [[scala.reflect.api.Internals]] */ + trait ContextInternalApi extends universe.MacroInternalApi { + } +} diff --git a/src/reflect/scala/reflect/macros/blackbox/Context.scala b/src/reflect/scala/reflect/macros/blackbox/Context.scala index 05d9595c3a..2f9c512efa 100644 --- a/src/reflect/scala/reflect/macros/blackbox/Context.scala +++ b/src/reflect/scala/reflect/macros/blackbox/Context.scala @@ -42,7 +42,8 @@ trait Context extends Aliases with Typers with Parsers with Evals - with ExprUtils { + with ExprUtils + with Internals { /** The compile-time universe. */ val universe: Universe |