@@ -20,9 +20,9 @@ import scala.quoted.runtime.impl.{QuotesImpl, SpliceScope}
20
20
21
21
import scala .quoted .Quotes
22
22
23
- class MacroAnnotations (thisPhase : DenotTransformer ):
23
+ class TastyAnnotations (thisPhase : DenotTransformer ):
24
24
import tpd .*
25
- import MacroAnnotations .*
25
+ import TastyAnnotations .*
26
26
27
27
/** Expands every macro annotation that is on this tree.
28
28
* Returns a list with transformed definition and any added definitions.
@@ -50,7 +50,7 @@ class MacroAnnotations(thisPhase: DenotTransformer):
50
50
51
51
// Apply all macro annotation to `tree` and collect new definitions in order
52
52
val transformedTree : DefTree = tree.symbol.annotations.foldLeft(tree) { (tree, annot) =>
53
- if isMacroAnnotation (annot) then
53
+ if isTastyAnnotation (annot) then
54
54
debug.println(i " Expanding macro annotation: ${annot}" )
55
55
56
56
// Interpret call to `new myAnnot(..).transform(using <Quotes>)(<tree>)`
@@ -81,16 +81,16 @@ class MacroAnnotations(thisPhase: DenotTransformer):
81
81
82
82
/** Interpret the code `new annot(..).transform(using <Quotes(ctx)>)(<tree>)` */
83
83
private def callMacro (interpreter : Interpreter , tree : MemberDef , annot : Annotation )(using Context ): List [MemberDef ] =
84
- // TODO: Remove when scala.annaotaion.MacroAnnotation is no longer experimental
84
+ // TODO: Remove when scala.annaotaion.TastyAnnotation is no longer experimental
85
85
import scala .reflect .Selectable .reflectiveSelectable
86
- type MacroAnnotation = {
86
+ type TastyAnnotation = {
87
87
def transform (using Quotes )(tree : Object /* Erased type of quotes.refelct.Definition*/ ): List [MemberDef /* quotes.refelct.Definition known to be MemberDef in QuotesImpl*/ ]
88
88
}
89
89
90
90
// Interpret macro annotation instantiation `new myAnnot(..)`
91
- val annotInstance = interpreter.interpret[MacroAnnotation ](annot.tree).get
92
- // TODO: Remove when scala.annaotaion.MacroAnnotation is no longer experimental
93
- assert(annotInstance.getClass.getClassLoader.loadClass(" scala.annotation.MacroAnnotation " ).isInstance(annotInstance))
91
+ val annotInstance = interpreter.interpret[TastyAnnotation ](annot.tree).get
92
+ // TODO: Remove when scala.annaotaion.TastyAnnotation is no longer experimental
93
+ assert(annotInstance.getClass.getClassLoader.loadClass(" scala.annotation.TastyAnnotation " ).isInstance(annotInstance))
94
94
95
95
val quotes = QuotesImpl ()(using SpliceScope .contextWithNewSpliceScope(tree.symbol.sourcePos)(using MacroExpansion .context(tree)).withOwner(tree.symbol))
96
96
annotInstance.transform(using quotes)(tree.asInstanceOf [quotes.reflect.Definition ])
@@ -107,13 +107,13 @@ class MacroAnnotations(thisPhase: DenotTransformer):
107
107
else
108
108
sym.enteredAfter(thisPhase)
109
109
110
- object MacroAnnotations :
110
+ object TastyAnnotations :
111
111
112
- /** Is this an annotation that implements `scala.annation.MacroAnnotation ` */
113
- def isMacroAnnotation (annot : Annotation )(using Context ): Boolean =
112
+ /** Is this an annotation that implements `scala.annation.TastyAnnotation ` */
113
+ def isTastyAnnotation (annot : Annotation )(using Context ): Boolean =
114
114
val sym = annot.tree.symbol
115
- sym.denot != NoDenotation && sym.owner.derivesFrom(defn.MacroAnnotationClass )
115
+ sym.denot != NoDenotation && sym.owner.derivesFrom(defn.TastyAnnotationClass )
116
116
117
- /** Is this symbol annotated with an annotation that implements `scala.annation.MacroAnnotation ` */
117
+ /** Is this symbol annotated with an annotation that implements `scala.annation.TastyAnnotation ` */
118
118
def hasMacro (sym : Symbol )(using Context ): Boolean =
119
- sym.getAnnotation(defn.MacroAnnotationClass ).isDefined
119
+ sym.getAnnotation(defn.TastyAnnotationClass ).isDefined
0 commit comments