summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/macros/contexts/Internals.scala6
-rw-r--r--src/reflect/scala/reflect/macros/Internals.scala9
2 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/scala/reflect/macros/contexts/Internals.scala b/src/compiler/scala/reflect/macros/contexts/Internals.scala
index cca6d957da..8c784d7e54 100644
--- a/src/compiler/scala/reflect/macros/contexts/Internals.scala
+++ b/src/compiler/scala/reflect/macros/contexts/Internals.scala
@@ -29,6 +29,7 @@ trait Internals extends scala.tools.nsc.transform.TypingTransformers {
def recur(tree: Tree): Tree = hof(tree, this)
def default(tree: Tree): Tree = superTransform(tree)
def atOwner[T](owner: Symbol)(op: => T): T = self.atOwner(owner)(op)
+ def atOwner[T](tree: Tree, owner: Symbol)(op: => T): T = self.atOwner(tree, owner)(op)
def currentOwner: Symbol = self.currentOwner
def typecheck(tree: Tree): Tree = localTyper.typed(tree)
}
@@ -37,5 +38,10 @@ trait Internals extends scala.tools.nsc.transform.TypingTransformers {
}
def typingTransform(tree: Tree)(transformer: (Tree, TypingTransformApi) => Tree): Tree = new HofTypingTransformer(transformer).transform(tree)
+
+ def typingTransform(tree: Tree, owner: Symbol)(transformer: (Tree, TypingTransformApi) => Tree): Tree = {
+ val trans = new HofTypingTransformer(transformer)
+ trans.atOwner(owner)(trans.transform(tree))
+ }
}
} \ No newline at end of file
diff --git a/src/reflect/scala/reflect/macros/Internals.scala b/src/reflect/scala/reflect/macros/Internals.scala
index 843644b7e3..75164344da 100644
--- a/src/reflect/scala/reflect/macros/Internals.scala
+++ b/src/reflect/scala/reflect/macros/Internals.scala
@@ -51,6 +51,10 @@ trait Internals {
*/
def atOwner[T](owner: Symbol)(op: => T): T
+ /** Temporarily pushes the given tree onto the recursion stack, and then calls `atOwner(symbol)(trans)`.
+ */
+ def atOwner[T](tree: Tree, owner: Symbol)(op: => T): T
+
/** Returns the symbol currently on the top of the owner stack.
* If we're not inside any `atOwner` call, then macro application's context owner will be used.
*/
@@ -66,5 +70,10 @@ trait Internals {
* @see [[TypingTransformApi]]
*/
def typingTransform(tree: Tree)(transformer: (Tree, TypingTransformApi) => Tree): Tree
+
+ /** Transforms a given tree at a given owner using the provided function.
+ * @see [[TypingTransformApi]]
+ */
+ def typingTransform(tree: Tree, owner: Symbol)(transformer: (Tree, TypingTransformApi) => Tree): Tree
}
}