Class

argus.macros

ASTHelpers

Related Doc: package macros

Permalink

class ASTHelpers[U <: Universe] extends AnyRef

Common utils for AST munging. Also includes a few helps for constructing type names/paths from json constructs.

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

Instance Constructors

  1. new ASTHelpers(u: U)

    Permalink

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. val RefNameExtractor: Regex

    Permalink
  5. val RefPathExtractor: Regex

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def extendsType(path: List[String], typ: U.Tree, defs: List[U.Tree]): List[(List[String], U.Tree)]

    Permalink

    Collects and returns case classes that extend the given type.

    Collects and returns case classes that extend the given type.

    returns

    A list of tuples. Each tuple contains the path, and class def

  11. def extractPathFromRef(rootName: Option[String], ref: String): List[String]

    Permalink

    Extracts a package path from a json-schema $ref.

    Extracts a package path from a json-schema $ref. Notes:

    • # is replaced by whatever we call the root schema
    • Definitions are defined at the same level as their containing object, i.e. for #/properties/a/definitions/Bob Bob is defined alongside A, not within it. This can be a bit confusing.
    rootName

    The name of the root class. Which is used to replace #/ references

    ref

    The $ref element to path-erize.

  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. def inList(inner: U.Tree): U.Tree

    Permalink

    Wrap the given type in an List type

  16. def inOption(inner: U.Tree): U.Tree

    Permalink

    Wrap the given type in an Option type

  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def mkSelectPath(path: List[String]): U.Tree

    Permalink

    Quasiquote doesn't support building trees of selects (i.e.

    Quasiquote doesn't support building trees of selects (i.e. obj1.obj2.MyObj), so we do it here manually.

    path

    List of strings representing the paths.

    returns

    e.g. obj1.obj2.myObj becomes: Select(Select(Ident(TermName("obj1")), TermName("obj2")), TermName("myObj"))

  19. def mkTypeSelectPath(path: List[String]): U.Tree

    Permalink

    Builds on mkSelectPath, but treats last item is a Type rather than a TermName

  20. def nameFromJson(json: String): String

    Permalink

    Best attempt at producing a name from a Json blob.

    Best attempt at producing a name from a Json blob. This is mostly used for enum, where the enum's can be any arbitrary Json structure. Mostly they are plain strings, in which case this is a no-op, but in the case where it's more complex then the property names from json structure are used to build a name. If the json object is a number then decimial points are stripped, and "n" is prefixed (i.e. 3.14 => n314).

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

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

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def paramsToMap(nameAndDefaults: List[(String, Any)], params: List[U.Tree]): Map[String, Any]

    Permalink

    Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))".

    Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))". Supports named arguments, and default values.

    nameAndDefaults

    A list of tuples containing each argument's name and default value. This must be the complete list of supported arguments.

    params

    A list of trees to as extracted by ..$params. If arguments are constants or option wrapped constants then their reified values are returned (i.e. Some(1)), if not then the AST chunk is returned.

    returns

    A map of argument names and their extracted values (or their default value if not extracted)

  25. def selectPathToList(tree: U.Tree): List[String]

    Permalink

    Extract the select path as a List[String]

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

    Permalink
    Definition Classes
    AnyRef
  27. def termNameToTypeName(typ: U.Tree): U.Tree

    Permalink
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. def treesIntersect(l1: List[U.Tree], l2: List[U.Tree]): List[U.Tree]

    Permalink
  30. def typeNameToTermName(typ: U.Tree): U.Tree

    Permalink
  31. def typeSelectPathToList(typ: U.Tree): List[String]

    Permalink

    Extract the select path (ending with a TypeName) as a List[String].

    Extract the select path (ending with a TypeName) as a List[String]. Types with type parameters are concatenated to form a single string. For example: a.b.MyObj[A,B[C]] becomes List(a,b,MyObjABC)

  32. def typeToName(typ: U.TypeName): String

    Permalink
  33. def typeToName(typ: U.Tree): String

    Permalink

    Makes type into a name, suitable for use as a variable name.

    Makes type into a name, suitable for use as a variable name. Rules:

    • Takes the last item of the select path (i.e. a.b.C -> C)
    • Makes initial letter lower-case
  34. val u: U

    Permalink
  35. def uncapitialize(s: String): String

    Permalink
  36. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped