@@ -180,7 +180,7 @@ trait AnalyzerPlugins { self: Analyzer =>
180
180
* Typechecks the right-hand side of a macro definition (which typically features
181
181
* a mere reference to a macro implementation).
182
182
*
183
- * Default implementation provided in `self.typedMacroBody ` makes sure that the rhs
183
+ * Default implementation provided in `self.standardTypedMacroBody ` makes sure that the rhs
184
184
* resolves to a reference to a method in either a static object or a macro bundle,
185
185
* verifies that the referred method is compatible with the macro def and upon success
186
186
* attaches a macro impl binding to the macro def's symbol.
@@ -193,7 +193,7 @@ trait AnalyzerPlugins { self: Analyzer =>
193
193
* Expands an application of a def macro (i.e. of a symbol that has the MACRO flag set),
194
194
* possibly using the current typer mode and the provided prototype.
195
195
*
196
- * Default implementation provided in `self.macroExpand ` figures out whether the `expandee`
196
+ * Default implementation provided in `self.standardMacroExpand ` figures out whether the `expandee`
197
197
* needs to be expanded right away or its expansion has to be delayed until all undetermined
198
198
* parameters are inferred, then loads the macro implementation using `self.pluginsMacroRuntime`,
199
199
* prepares the invocation arguments for the macro implementation using `self.pluginsMacroArgs`,
@@ -211,7 +211,7 @@ trait AnalyzerPlugins { self: Analyzer =>
211
211
/**
212
212
* Computes the arguments that need to be passed to the macro impl corresponding to a particular expandee.
213
213
*
214
- * Default implementation provided in `self.macroArgs ` instantiates a `scala.reflect.macros.contexts.Context`,
214
+ * Default implementation provided in `self.standardMacroArgs ` instantiates a `scala.reflect.macros.contexts.Context`,
215
215
* gathers type and value arguments of the macro application and throws them together into `MacroArgs`.
216
216
*
217
217
* $nonCumulativeReturnValueDoc.
@@ -221,7 +221,7 @@ trait AnalyzerPlugins { self: Analyzer =>
221
221
/**
222
222
* Summons a function that encapsulates macro implementation invocations for a particular expandee.
223
223
*
224
- * Default implementation provided in `self.macroRuntime ` returns a function that
224
+ * Default implementation provided in `self.standardMacroRuntime ` returns a function that
225
225
* loads the macro implementation binding from the macro definition symbol,
226
226
* then uses either Java or Scala reflection to acquire the method that corresponds to the impl,
227
227
* and then reflectively calls into that method.
@@ -233,7 +233,7 @@ trait AnalyzerPlugins { self: Analyzer =>
233
233
/**
234
234
* Creates a symbol for the given tree in lexical context encapsulated by the given namer.
235
235
*
236
- * Default implementation provided in `namer.enterSym ` handles MemberDef's and Imports,
236
+ * Default implementation provided in `namer.standardEnterSym ` handles MemberDef's and Imports,
237
237
* doing nothing for other trees (DocDef's are seen through and rewrapped). Typical implementation
238
238
* of `enterSym` for a particular tree flavor creates a corresponding symbol, assigns it to the tree,
239
239
* enters the symbol into scope and then might even perform some code generation.
@@ -245,7 +245,7 @@ trait AnalyzerPlugins { self: Analyzer =>
245
245
/**
246
246
* Makes sure that for the given class definition, there exists a companion object definition.
247
247
*
248
- * Default implementation provided in `namer.ensureCompanionObject ` looks up a companion symbol for the class definition
248
+ * Default implementation provided in `namer.standardEnsureCompanionObject ` looks up a companion symbol for the class definition
249
249
* and then checks whether the resulting symbol exists or not. If it exists, then nothing else is done.
250
250
* If not, a synthetic object definition is created using the provided factory, which is then entered into namer's scope.
251
251
*
@@ -371,54 +371,56 @@ trait AnalyzerPlugins { self: Analyzer =>
371
371
def pluginsTypedMacroBody (typer : Typer , ddef : DefDef ): Tree = invoke(new NonCumulativeOp [Tree ] {
372
372
def position = ddef.pos
373
373
def description = " typecheck this macro definition"
374
- def default = typedMacroBody (typer, ddef)
374
+ def default = standardTypedMacroBody (typer, ddef)
375
375
def custom (plugin : MacroPlugin ) = plugin.pluginsTypedMacroBody(typer, ddef)
376
376
})
377
377
378
378
/** @see MacroPlugin.pluginsMacroExpand */
379
379
def pluginsMacroExpand (typer : Typer , expandee : Tree , mode : Mode , pt : Type ): Tree = invoke(new NonCumulativeOp [Tree ] {
380
380
def position = expandee.pos
381
381
def description = " expand this macro application"
382
- def default = macroExpand (typer, expandee, mode, pt)
382
+ def default = standardMacroExpand (typer, expandee, mode, pt)
383
383
def custom (plugin : MacroPlugin ) = plugin.pluginsMacroExpand(typer, expandee, mode, pt)
384
384
})
385
385
386
386
/** @see MacroPlugin.pluginsMacroArgs */
387
387
def pluginsMacroArgs (typer : Typer , expandee : Tree ): MacroArgs = invoke(new NonCumulativeOp [MacroArgs ] {
388
388
def position = expandee.pos
389
389
def description = " compute macro arguments for this macro application"
390
- def default = macroArgs (typer, expandee)
390
+ def default = standardMacroArgs (typer, expandee)
391
391
def custom (plugin : MacroPlugin ) = plugin.pluginsMacroArgs(typer, expandee)
392
392
})
393
393
394
394
/** @see MacroPlugin.pluginsMacroRuntime */
395
395
def pluginsMacroRuntime (expandee : Tree ): MacroRuntime = invoke(new NonCumulativeOp [MacroRuntime ] {
396
396
def position = expandee.pos
397
397
def description = " compute macro runtime for this macro application"
398
- def default = macroRuntime (expandee)
398
+ def default = standardMacroRuntime (expandee)
399
399
def custom (plugin : MacroPlugin ) = plugin.pluginsMacroRuntime(expandee)
400
400
})
401
401
402
402
/** @see MacroPlugin.pluginsEnterSym */
403
- def pluginsEnterSym (namer : Namer , tree : Tree ): Context = invoke(new NonCumulativeOp [Context ] {
404
- def position = tree.pos
405
- def description = " enter a symbol for this tree"
406
- def default = namer.enterSym(tree)
407
- def custom (plugin : MacroPlugin ) = {
408
- val hasExistingSym = tree.symbol != NoSymbol
409
- val result = plugin.pluginsEnterSym(namer, tree)
410
- if (result && hasExistingSym) Some (namer.context)
411
- else if (result && tree.isInstanceOf [Import ]) Some (namer.context.make(tree))
412
- else if (result) Some (namer.context)
413
- else None
414
- }
415
- })
403
+ def pluginsEnterSym (namer : Namer , tree : Tree ): Context =
404
+ if (macroPlugins.isEmpty) namer.standardEnterSym(tree)
405
+ else invoke(new NonCumulativeOp [Context ] {
406
+ def position = tree.pos
407
+ def description = " enter a symbol for this tree"
408
+ def default = namer.standardEnterSym(tree)
409
+ def custom (plugin : MacroPlugin ) = {
410
+ val hasExistingSym = tree.symbol != NoSymbol
411
+ val result = plugin.pluginsEnterSym(namer, tree)
412
+ if (result && hasExistingSym) Some (namer.context)
413
+ else if (result && tree.isInstanceOf [Import ]) Some (namer.context.make(tree))
414
+ else if (result) Some (namer.context)
415
+ else None
416
+ }
417
+ })
416
418
417
419
/** @see MacroPlugin.pluginsEnsureCompanionObject */
418
420
def pluginsEnsureCompanionObject (namer : Namer , cdef : ClassDef , creator : ClassDef => Tree = companionModuleDef(_)): Symbol = invoke(new NonCumulativeOp [Symbol ] {
419
421
def position = cdef.pos
420
422
def description = " enter a companion symbol for this tree"
421
- def default = namer.ensureCompanionObject (cdef, creator)
423
+ def default = namer.standardEnsureCompanionObject (cdef, creator)
422
424
def custom (plugin : MacroPlugin ) = plugin.pluginsEnsureCompanionObject(namer, cdef, creator)
423
425
})
424
426
0 commit comments