Trait

scala.tools.nsc.typechecker.AnalyzerPlugins

MacroPlugin

Related Doc: package AnalyzerPlugins

Permalink

trait MacroPlugin extends AnyRef

Source
AnalyzerPlugins.scala
Linear Supertypes
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. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink

    Test two objects for inequality.

    Test two objects for inequality.

    returns

    true if !(this == that), false otherwise.

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink

    Equivalent to x.hashCode except for boxed numeric types and null.

    Equivalent to x.hashCode except for boxed numeric types and null. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to any2stringadd[Analyzer.MacroPlugin] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Analyzer.MacroPlugin, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to ArrowAssoc[Analyzer.MacroPlugin] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink

    Cast the receiver object to be of type T0.

    Cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expression List(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

    the receiver object.

    Definition Classes
    Any
    Exceptions thrown

    ClassCastException if the receiver object is not an instance of the erasure of type T0.

  7. def clone(): AnyRef

    Permalink

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
    Note

    not specified by SLS as a member of AnyRef

  8. def ensuring(cond: (Analyzer.MacroPlugin) ⇒ Boolean, msg: ⇒ Any): Analyzer.MacroPlugin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to Ensuring[Analyzer.MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (Analyzer.MacroPlugin) ⇒ Boolean): Analyzer.MacroPlugin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to Ensuring[Analyzer.MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ Any): Analyzer.MacroPlugin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to Ensuring[Analyzer.MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): Analyzer.MacroPlugin

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to Ensuring[Analyzer.MacroPlugin] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean

    Permalink

    Tests whether the argument (that) is a reference to the receiver object (this).

    Tests whether the argument (that) is a reference to the receiver object (this).

    The eq method implements an equivalence relation on non-null instances of AnyRef, and has three additional properties:

    • It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false.
    • For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.
    • null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Permalink

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to eq.

    See also equals in scala.Any.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Permalink

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the finalize method is invoked, as well as the interaction between finalize and non-local returns and exceptions, are all platform dependent.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
    Note

    not specified by SLS as a member of AnyRef

  15. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to StringFormat[Analyzer.MacroPlugin] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  16. final def getClass(): Class[_]

    Permalink

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
    AnyRef → Any
    Note

    not specified by SLS as a member of AnyRef

  17. def hashCode(): Int

    Permalink

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in scala.Any.

    returns

    the hash code value for this object.

    Definition Classes
    AnyRef → Any
  18. def isActive(): Boolean

    Permalink

    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

  19. final def isInstanceOf[T0]: Boolean

    Permalink

    Test whether the dynamic type of the receiver object is T0.

    Test whether the dynamic type of the receiver object is T0.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression 1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

    Permalink

    Equivalent to !(this eq that).

    Equivalent to !(this eq that).

    returns

    true if the argument is not a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  22. final def notifyAll(): Unit

    Permalink

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  23. def pluginsEnsureCompanionObject(namer: Analyzer.Namer, cdef: Global.ClassDef, creator: (Global.ClassDef) ⇒ Global.Tree = companionModuleDef(_)): Option[Global.Symbol]

    Permalink

    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..

  24. def pluginsEnterStats(typer: Analyzer.Typer, stats: List[Global.Tree]): List[Global.Tree]

    Permalink

    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.

  25. def pluginsEnterSym(namer: Analyzer.Namer, tree: Global.Tree): Boolean

    Permalink

    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..

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

    Permalink

    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..

  27. def pluginsMacroArgs(typer: Analyzer.Typer, expandee: Global.Tree): Option[Analyzer.MacroArgs]

    Permalink

    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..

  28. def pluginsMacroExpand(typer: Analyzer.Typer, expandee: Global.Tree, mode: Mode, pt: Global.Type): Option[Global.Tree]

    Permalink

    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..

  29. def pluginsMacroRuntime(expandee: Global.Tree): Option[Analyzer.MacroRuntime]

    Permalink

    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..

  30. def pluginsTypedMacroBody(typer: Analyzer.Typer, ddef: Global.DefDef): Option[Global.Tree]

    Permalink

    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..

  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toString(): String

    Permalink

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def [B](y: B): (Analyzer.MacroPlugin, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.MacroPlugin to ArrowAssoc[Analyzer.MacroPlugin] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Analyzer.MacroPlugin to any2stringadd[Analyzer.MacroPlugin]

Inherited by implicit conversion StringFormat from Analyzer.MacroPlugin to StringFormat[Analyzer.MacroPlugin]

Inherited by implicit conversion Ensuring from Analyzer.MacroPlugin to Ensuring[Analyzer.MacroPlugin]

Inherited by implicit conversion ArrowAssoc from Analyzer.MacroPlugin to ArrowAssoc[Analyzer.MacroPlugin]

Ungrouped