Scala Compiler 2.13.16 - scala.tools.nsc.typechecker.AnalyzerPlugins.MacroPlugin
Keywords: Scala Compiler 2.13.16 scala.tools.nsc.typechecker.AnalyzerPlugins.MacroPlugin

Scala Compiler2.13.16 < Back


# Packages

-  package root

  The Scala compiler and reflection APIs.

  The Scala compiler and reflection APIs.

  Definition Classes
    root
-  package scala
  Definition Classes
    root
-  package tools
  Definition Classes
    scala
-  package nsc
  Definition Classes
    tools
-  package typechecker
  Definition Classes
    nsc
-  trait AnalyzerPlugins extends AnyRef

  Definition Classes
    typechecker
- AnalyzerPlugin
- MacroPlugin

t

scala.tools.nsc.typechecker.AnalyzerPlugins

# MacroPlugin

###

#### trait MacroPlugin extends AnyRef

Annotations
  @nowarn()
Source
  AnalyzerPlugins.scala

Linear Supertypes
AnyRef, Any
Type Hierarchy

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. MacroPlugin
2. AnyRef
3. Any

Implicitly

1. by any2stringadd
2. by StringFormat
3. by Ensuring
4. by ArrowAssoc

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  def +(other: String): String
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toany2stringadd[(AnalyzerPlugins.this)#MacroPlugin] performed by method any2stringadd in scala.Predef.
   Definition Classes
     any2stringadd
4.  def ->[B](y: B): ((AnalyzerPlugins.this)#MacroPlugin, B)
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toArrowAssoc[(AnalyzerPlugins.this)#MacroPlugin] performed by method ArrowAssoc in scala.Predef.
   Definition Classes
     ArrowAssoc
   Annotations
     @inline()
5.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
6.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
7.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.CloneNotSupportedException]) @native()
8.  def ensuring(cond: ((AnalyzerPlugins.this)#MacroPlugin) => Boolean, msg: => Any): (AnalyzerPlugins.this)#MacroPlugin
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toEnsuring[(AnalyzerPlugins.this)#MacroPlugin] performed by method Ensuring in scala.Predef.
   Definition Classes
     Ensuring
9.  def ensuring(cond: ((AnalyzerPlugins.this)#MacroPlugin) => Boolean): (AnalyzerPlugins.this)#MacroPlugin
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toEnsuring[(AnalyzerPlugins.this)#MacroPlugin] performed by method Ensuring in scala.Predef.
   Definition Classes
     Ensuring
10.  def ensuring(cond: Boolean, msg: => Any): (AnalyzerPlugins.this)#MacroPlugin
    Implicit
      This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toEnsuring[(AnalyzerPlugins.this)#MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
11.  def ensuring(cond: Boolean): (AnalyzerPlugins.this)#MacroPlugin
    Implicit
      This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toEnsuring[(AnalyzerPlugins.this)#MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
      Ensuring
12.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
13.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
14.  def finalize(): Unit
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.Throwable])
15.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
16.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
17.  def isActive(): Boolean

    Selectively activate this analyzer plugin, e.g.

    Selectively activate this analyzer plugin, e.g. according to the compiler phase.

    Note that the current phase can differ from the global compiler phase (look for `enteringPhase` invocations in the compiler). For instance, lazy types created by the UnPickler are completed at the phase in which their symbol is created. Observations show that this can even be the parser phase. Since symbol completion can trigger subtyping, typing etc, your plugin might need to be active also in phases other than namer and typer.

    Typically, this method can be implemented as

    global.phase.id < global.currentRun.picklerPhase.id

18.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
19.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
20.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
21.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
22.  def pluginsEnsureCompanionObject(namer: (AnalyzerPlugins.this)#Namer, cdef: Global.ClassDef, creator: (Global.ClassDef) => Global.Tree = companionModuleDef(_)): Option[Global.Symbol]

    Makes sure that for the given class definition, there exists a companion object definition.

    Makes sure that for the given class definition, there exists a companion object definition.

    Default implementation provided in `namer.standardEnsureCompanionObject` looks up a companion symbol for the class definition and then checks whether the resulting symbol exists or not. If it exists, then nothing else is done. If not, a synthetic object definition is created using the provided factory, which is then entered into namer's scope.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

23.  def pluginsEnterStats(typer: (AnalyzerPlugins.this)#Typer, stats: List[Global.Tree]): List[Global.Tree]

    Prepares a list of statements for being typechecked by performing domain-specific type-agnostic code synthesis.

    Prepares a list of statements for being typechecked by performing domain-specific type-agnostic code synthesis.

    Trees passed into this method are going to be named, but not typed. In particular, you can rely on the compiler having called `enterSym` on every stat prior to passing calling this method.

    Default implementation does nothing. Current approaches to code syntheses (generation of underlying fields for getters/setters, creation of companion objects for case classes, etc) are too disparate and ad-hoc to be treated uniformly, so I'm leaving this for future work.

24.  def pluginsEnterSym(namer: (AnalyzerPlugins.this)#Namer, tree: Global.Tree): Boolean

    Creates a symbol for the given tree in lexical context encapsulated by the given namer.

    Creates a symbol for the given tree in lexical context encapsulated by the given namer.

    Default implementation provided in `namer.standardEnterSym` handles MemberDef's and Imports, doing nothing for other trees (DocDef's are seen through and rewrapped). Typical implementation of `enterSym` for a particular tree flavor creates a corresponding symbol, assigns it to the tree, enters the symbol into scope and then might even perform some code generation.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

25.  def pluginsIsBlackbox(macroDef: Global.Symbol): Option[Boolean]

    Figures out whether the given macro definition is blackbox or whitebox.

    Figures out whether the given macro definition is blackbox or whitebox.

    Default implementation provided in `self.standardIsBlackbox` loads the macro impl binding and fetches boxity from the "isBlackbox" field of the macro signature.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

26.  def pluginsMacroArgs(typer: (AnalyzerPlugins.this)#Typer, expandee: Global.Tree): Option[(AnalyzerPlugins.this)#MacroArgs]

    Computes the arguments that need to be passed to the macro impl corresponding to a particular expandee.

    Computes the arguments that need to be passed to the macro impl corresponding to a particular expandee.

    Default implementation provided in `self.standardMacroArgs` instantiates a `scala.reflect.macros.contexts.Context`, gathers type and value arguments of the macro application and throws them together into `MacroArgs`.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

27.  def pluginsMacroExpand(typer: (AnalyzerPlugins.this)#Typer, expandee: Global.Tree, mode: Mode, pt: Global.Type): Option[Global.Tree]

    Expands an application of a def macro (i.e.

    Expands an application of a def macro (i.e. of a symbol that has the MACRO flag set), possibly using the current typer mode and the provided prototype.

    Default implementation provided in `self.standardMacroExpand` figures out whether the `expandee` needs to be expanded right away or its expansion has to be delayed until all undetermined parameters are inferred, then loads the macro implementation using `self.pluginsMacroRuntime`, prepares the invocation arguments for the macro implementation using `self.pluginsMacroArgs`, and finally calls into the macro implementation. After the call returns, it typechecks the expansion and performs some bookkeeping.

    This method is typically implemented if your plugin requires significant changes to the macro engine. If you only need to customize the macro context, consider implementing `pluginsMacroArgs`. If you only need to customize how macro implementation are invoked, consider going for `pluginsMacroRuntime`.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

28.  def pluginsMacroRuntime(expandee: Global.Tree): Option[(AnalyzerPlugins.this)#MacroRuntime]

    Summons a function that encapsulates macro implementation invocations for a particular expandee.

    Summons a function that encapsulates macro implementation invocations for a particular expandee.

    Default implementation provided in `self.standardMacroRuntime` returns a function that loads the macro implementation binding from the macro definition symbol, then uses either Java or Scala reflection to acquire the method that corresponds to the impl, and then reflectively calls into that method.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

29.  def pluginsTypedMacroBody(typer: (AnalyzerPlugins.this)#Typer, ddef: Global.DefDef): Option[Global.Tree]

    Typechecks the right-hand side of a macro definition (which typically features a mere reference to a macro implementation).

    Typechecks the right-hand side of a macro definition (which typically features a mere reference to a macro implementation).

    Default implementation provided in `self.standardTypedMacroBody` makes sure that the rhs resolves to a reference to a method in either a static object or a macro bundle, verifies that the referred method is compatible with the macro def and upon success attaches a macro impl binding to the macro def's symbol.

    Returns `None` if the plugin doesn't want to customize the default behavior or something else if the plugin knows better that the implementation provided in scala-compiler.jar. If multiple plugins return a non-empty result, it's going to be a compilation error..

30.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
31.  def toString(): String
    Definition Classes
      AnyRef → Any
32.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
33.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
34.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()

### Deprecated Value Members

1.  def formatted(fmtstr: String): String
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toStringFormat[(AnalyzerPlugins.this)#MacroPlugin] performed by method StringFormat in scala.Predef.
   Definition Classes
     StringFormat
   Annotations
     @deprecated @inline()
   Deprecated

     (Since version 2.12.16) Use `formatString.format(value)` instead of `value.formatted(formatString)`, or use the `f""` string interpolator. In Java 15 and later, `formatted` resolves to the new method in String which has reversed parameters.

2.  def →[B](y: B): ((AnalyzerPlugins.this)#MacroPlugin, B)
   Implicit
     This member is added by an implicit conversion from (AnalyzerPlugins.this)#MacroPlugin toArrowAssoc[(AnalyzerPlugins.this)#MacroPlugin] performed by method ArrowAssoc in scala.Predef.
   Definition Classes
     ArrowAssoc
   Annotations
     @deprecated
   Deprecated

     (Since version 2.13.0) Use `->` instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

### Inherited from AnyRef

### Inherited from Any

### Inherited by implicit conversion any2stringadd from(AnalyzerPlugins.this)#MacroPlugin to any2stringadd[(AnalyzerPlugins.this)#MacroPlugin]

### Inherited by implicit conversion StringFormat from(AnalyzerPlugins.this)#MacroPlugin to StringFormat[(AnalyzerPlugins.this)#MacroPlugin]

### Inherited by implicit conversion Ensuring from(AnalyzerPlugins.this)#MacroPlugin to Ensuring[(AnalyzerPlugins.this)#MacroPlugin]

### Inherited by implicit conversion ArrowAssoc from(AnalyzerPlugins.this)#MacroPlugin to ArrowAssoc[(AnalyzerPlugins.this)#MacroPlugin]

### Ungrouped