Documentation ¶
Index ¶
Constants ¶
View Source
const Slice = "[]"
Slice represents the token for a go slice prefix.
View Source
const Star = "*"
Star represents the pointer prefix.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prefixer ¶
type Prefixer interface { // Valid validates the prefixer and its subprefixers. // // An example would be a composition of a StarExpr with an ArrayType of an Ident. // In that case, all three prefixers computed from those ast.Expr will be validated with Valid. Valid() error // ToString transforms a Prefixer (ast.Expr) into its string representation. // It also returns a boolean indicating whether the type is exported. ToString(sourcePackage string, typeParams []string, prefixes ...string) (stringType string, exported bool) }
Prefixer represents an interface to transform a specific ast.Expr into its string representation.
func NewPrefixer ¶
NewPrefixer transforms the input expression into it's corresponding Prefixer interface.
It returns an error if the input expression hasn't a Prefixer implementation.
func NewPrefixerEditor ¶
NewPrefixerEditor creates a Prefixer wrapping another Prefixer.
It can be used to alter the result of the wrapped Prefixer to add like a name, edit the exported bool result or even remove, replace, or change the resulted string type.
Click to show internal directories.
Click to hide internal directories.