Class

io.github.dreamylost.macros

AbstractMacroProcessor

Related Doc: package macros

Permalink

abstract class AbstractMacroProcessor extends AnyRef

Version

1.0

Since

2021/7/24

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AbstractMacroProcessor
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AbstractMacroProcessor(c: Context)

    Permalink

Abstract Value Members

  1. abstract def impl(annottees: scala.reflect.macros.Universe.Expr[Any]*): scala.reflect.macros.Universe.Expr[Any]

    Permalink

    Subclasses must override the method.

    Subclasses must override the method.

    returns

    Macro expanded final syntax tree.

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

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

    Permalink
    Definition Classes
    Any
  5. val c: Context

    Permalink
  6. def checkAndGetClassDef(annottees: scala.reflect.macros.Universe.Expr[Any]*): scala.reflect.macros.Universe.ClassDef

    Permalink

    Check the class and its companion object, and return the class definition.

    Check the class and its companion object, and return the class definition.

    returns

    Return ClassDef

  7. def classParamsIsNotPrivate(field: scala.reflect.macros.Universe.Tree): Boolean

    Permalink

    Check whether the mods of the fields has a private[this], because it cannot be used in equals method.

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  11. def evalTree[T](tree: scala.reflect.macros.Universe.Tree)(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): T

    Permalink

    Eval tree.

  12. def extractArgumentsTuple1[T](partialFunction: PartialFunction[scala.reflect.macros.Universe.Tree, (T)])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): (T)

    Permalink
  13. def extractArgumentsTuple2[T1, T2](partialFunction: PartialFunction[scala.reflect.macros.Universe.Tree, (T1, T2)])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T1], arg1: scala.reflect.macros.Universe.WeakTypeTag[T2]): (T1, T2)

    Permalink
  14. def extractArgumentsTuple4[T1, T2, T3, T4](partialFunction: PartialFunction[scala.reflect.macros.Universe.Tree, (T1, T2, T3, T4)])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T1], arg1: scala.reflect.macros.Universe.WeakTypeTag[T2], arg2: scala.reflect.macros.Universe.WeakTypeTag[T3], arg3: scala.reflect.macros.Universe.WeakTypeTag[T4]): (T1, T2, T3, T4)

    Permalink
  15. def extractClassTypeParamsTypeName(tpParams: List[scala.reflect.macros.Universe.Tree]): List[scala.reflect.macros.Universe.TypeName]

    Permalink

    Gets a list of generic parameters.

    Gets a list of generic parameters. This is because the generic parameters of a class cannot be used directly in the return type, and need to be converted.

  16. def getApplyMethodWithCurrying(typeName: scala.reflect.macros.Universe.TypeName, fieldss: List[List[scala.reflect.macros.Universe.Tree]], classTypeParams: List[scala.reflect.macros.Universe.Tree]): scala.reflect.macros.Universe.Tree

    Permalink

    We generate apply method with currying, and we have to deal with the first layer of currying alone.

    We generate apply method with currying, and we have to deal with the first layer of currying alone.

    returns

    A apply method with currying.

    Example:
    1. apply(int: Int)(j: Int)(k: Option[String])(t: Option[Long]): B3 = new B3(int)(j)(k)(t)

  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  18. def getClassMemberDefDefs(annotteeClassDefinitions: Seq[scala.reflect.macros.Universe.Tree]): Seq[scala.reflect.macros.Universe.Tree]

    Permalink

    Extract the methods belonging to the class, contains Secondary Constructor.

  19. def getClassMemberValDefs(annotteeClassDefinitions: Seq[scala.reflect.macros.Universe.Tree]): Seq[scala.reflect.macros.Universe.Tree]

    Permalink

    Extract the internal fields of members belonging to the class, but not in primary constructor.

  20. def getConstructorWithCurrying(typeName: scala.reflect.macros.Universe.TypeName, fieldss: List[List[scala.reflect.macros.Universe.Tree]], isCase: Boolean): scala.reflect.macros.Universe.Tree

    Permalink

    We generate constructor with currying, and we have to deal with the first layer of currying alone.

    We generate constructor with currying, and we have to deal with the first layer of currying alone.

    returns

    A constructor with currying, it not contains tpt, provide for calling method.

    Example:
    1. TestClass12(i)(j)(k)(t)

  21. def getFieldAssignExprs(annotteeClassParams: Seq[scala.reflect.macros.Universe.Tree]): Seq[scala.reflect.macros.Universe.Tree]

    Permalink

    Expand the constructor and get the field with assign.

  22. def getFieldTermName(field: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.TermName

    Permalink

    Expand the constructor and get the field TermName.

  23. def getMethodParamName(field: scala.reflect.macros.Universe.Tree): scala.reflect.macros.Universe.Name

    Permalink

    Expand the method params and get the param Name.

  24. def handleWithImplType(annottees: scala.reflect.macros.Universe.Expr[Any]*)(modifyAction: (scala.reflect.macros.Universe.ClassDef, Option[scala.reflect.macros.Universe.ModuleDef]) ⇒ Any): scala.reflect.macros.Universe.Expr[Nothing]

    Permalink

    Modify the associated object itself according to whether there is an associated object.

    Modify the associated object itself according to whether there is an associated object.

    modifyAction

    The actual processing function

    returns

    Return the result of modifyAction

  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  26. def isCaseClass(annotateeClass: scala.reflect.macros.Universe.ClassDef): Boolean

    Permalink

    Expand the class and check whether the class is a case class.

    Expand the class and check whether the class is a case class.

    annotateeClass

    classDef

    returns

    Return true if it is a case class

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def modifiedCompanion(compDeclOpt: Option[scala.reflect.macros.Universe.ModuleDef], codeBlock: scala.reflect.macros.Universe.Tree, className: scala.reflect.macros.Universe.TypeName): scala.reflect.macros.Universe.Tree

    Permalink

    Modify companion objects.

  29. def modifiedDeclaration(classDecl: scala.reflect.macros.Universe.ClassDef, compDeclOpt: Option[scala.reflect.macros.Universe.ModuleDef] = None): Any

    Permalink

    Subclasses should override the method and return the final result abstract syntax tree, or an abstract syntax tree close to the final result.

    Subclasses should override the method and return the final result abstract syntax tree, or an abstract syntax tree close to the final result. When the macro implementation is very simple, we don't need to use this method, so we don't need to implement it. When there are many macro input parameters, we will not use this method temporarily because we need to pass parameters.

    returns

    c.Expr[Any], Why use Any? The dependent type need aux-pattern in scala2. Now let's get around this.

  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  33. def printTree(force: Boolean, resTree: scala.reflect.macros.Universe.Tree): Unit

    Permalink

    Output ast result.

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

    Permalink
    Definition Classes
    AnyRef
  35. def toScalaType(jType: String): String

    Permalink

    Only for primitive types, we can get type and map to scala type.

    Only for primitive types, we can get type and map to scala type.

    jType

    java type name

    returns

    Scala type name

  36. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  37. def treeResultWithCompanionObject(resTree: scala.reflect.macros.Universe.Tree, annottees: scala.reflect.macros.Universe.Expr[Any]*): scala.reflect.macros.Universe.Tree

    Permalink

    Wrap tree result with companion object.

    Wrap tree result with companion object.

    resTree

    class

  38. def tryGetCompanionObject(annottees: scala.reflect.macros.Universe.Expr[Any]*): Option[scala.reflect.macros.Universe.ModuleDef]

    Permalink

    Get companion object if it exists.

  39. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

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

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped