summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/macros
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-02-06 19:01:49 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-02-15 09:23:57 +0100
commit24780095d14938e60e28c710c47ed69629b7afc7 (patch)
tree7be93fa0110afd06c76a158a378d098d39908399 /src/reflect/scala/reflect/macros
parentfa8f4022754356859f3af1c4ffbac02ab3dc3e7c (diff)
downloadscala-24780095d14938e60e28c710c47ed69629b7afc7.tar.gz
scala-24780095d14938e60e28c710c47ed69629b7afc7.tar.bz2
scala-24780095d14938e60e28c710c47ed69629b7afc7.zip
addresses pull request feedback
Diffstat (limited to 'src/reflect/scala/reflect/macros')
-rw-r--r--src/reflect/scala/reflect/macros/Enclosures.scala7
-rw-r--r--src/reflect/scala/reflect/macros/Internals.scala5
-rw-r--r--src/reflect/scala/reflect/macros/Typers.scala6
-rw-r--r--src/reflect/scala/reflect/macros/Universe.scala2
4 files changed, 12 insertions, 8 deletions
diff --git a/src/reflect/scala/reflect/macros/Enclosures.scala b/src/reflect/scala/reflect/macros/Enclosures.scala
index 7c186139cf..69ede42cc7 100644
--- a/src/reflect/scala/reflect/macros/Enclosures.scala
+++ b/src/reflect/scala/reflect/macros/Enclosures.scala
@@ -20,7 +20,7 @@ import scala.language.existentials // SI-6541
* This is somewhat aligned with the overall evolution of macros during the 2.11 development cycle, where we played with
* `c.introduceTopLevel` and `c.introduceMember`, but at the end of the day decided to reject them.
*
- * If you're relying on the now deprecated APIs, consider using the new [[c.enclosingOwner]] method that can be used to obtain
+ * If you're relying on the now deprecated APIs, consider using the new [[c.internal.enclosingOwner]] method that can be used to obtain
* the names of enclosing definitions. Alternatively try reformulating your macros in terms of completely local expansion
* and/or joining a discussion of a somewhat related potential language feature at [[https://groups.google.com/forum/#!topic/scala-debate/f4CLmYShX6Q]].
* We also welcome questions and suggestions on our mailing lists, where we would be happy to further discuss this matter.
@@ -52,11 +52,6 @@ trait Enclosures {
*/
def enclosingPosition: Position
- /** Symbol associated with the innermost enclosing lexical context.
- * Walking the owner chain of this symbol will reveal information about more and more enclosing contexts.
- */
- def enclosingOwner: Symbol
-
/** Tree that corresponds to the enclosing method, or EmptyTree if not applicable.
* @see [[scala.reflect.macros.Enclosures]]
*/
diff --git a/src/reflect/scala/reflect/macros/Internals.scala b/src/reflect/scala/reflect/macros/Internals.scala
index 415e70c36e..843644b7e3 100644
--- a/src/reflect/scala/reflect/macros/Internals.scala
+++ b/src/reflect/scala/reflect/macros/Internals.scala
@@ -14,6 +14,11 @@ trait Internals {
/** @see [[scala.reflect.api.Internals]] */
trait ContextInternalApi extends universe.MacroInternalApi {
+ /** Symbol associated with the innermost enclosing lexical context.
+ * Walking the owner chain of this symbol will reveal information about more and more enclosing contexts.
+ */
+ def enclosingOwner: Symbol
+
/** Functions that are available during [[transform]].
* @see [[transform]]
*/
diff --git a/src/reflect/scala/reflect/macros/Typers.scala b/src/reflect/scala/reflect/macros/Typers.scala
index f1d8575774..d0dccb469d 100644
--- a/src/reflect/scala/reflect/macros/Typers.scala
+++ b/src/reflect/scala/reflect/macros/Typers.scala
@@ -27,7 +27,7 @@ trait Typers {
/** Represents mode of operations of the typechecker underlying `c.typecheck` calls.
* Is necessary since the shape of the typechecked tree alone is not enough to guess how it should be typechecked.
- * Can be EXPRmode (typecheck as a term) or TYPEmode (typecheck as a type).
+ * Can be EXPRmode (typecheck as a term), TYPEmode (typecheck as a type) or PATTERNmode (typecheck as a pattern).
*/
// I'd very much like to make use of https://github.com/dsl-paradise/dsl-paradise here!
type TypecheckMode
@@ -41,6 +41,10 @@ trait Typers {
*/
val TYPEmode: TypecheckMode
+ /** Indicates that an argument to `c.typecheck` should be typechecked as a pattern.
+ */
+ val PATTERNmode: TypecheckMode
+
/** @see `scala.reflect.macros.TypecheckException`
*/
type TypecheckException = scala.reflect.macros.TypecheckException
diff --git a/src/reflect/scala/reflect/macros/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala
index 23cd23cdb0..2dfb4ee0e2 100644
--- a/src/reflect/scala/reflect/macros/Universe.scala
+++ b/src/reflect/scala/reflect/macros/Universe.scala
@@ -138,7 +138,7 @@ abstract class Universe extends scala.reflect.api.Universe {
/** Retrieves the untyped list of subpatterns attached to selector dummy of an UnApply node.
* Useful in writing quasiquoting macros that do pattern matching.
*/
- def subpatterns(tree: Tree): List[Tree]
+ def subpatterns(tree: Tree): Option[List[Tree]]
}
/** @group Internal */