Documentation ¶
Index ¶
- Variables
- func CallbackOnNamedType(fieldType types.Type, callback func(obj *types.Named)) error
- func GetCharReplacement(a rune) (rune, bool)
- func IdentifierToAsciiTypeName(typeIdentifier string) string
- func IdentifierToTypeName(typeIdentifier string) string
- func ObjectIsAccessible(obj types.Object, fromPackagePath string, logger goParser.LoggerCLI) bool
- func ResolveTypeIdentifier(t types.Type, pkgImports GoImports) (string, error)
- func TypeIsAccessible(t types.Type, fromPackagePath string) (bool, error)
- type GoImports
Constants ¶
This section is empty.
Variables ¶
var UnexpectedTypeError = fmt.Errorf("the given types.Type interface underlying type is not recognizable")
Functions ¶
func CallbackOnNamedType ¶
CallbackOnNamedType will iterate over a types.Type, trying to find some NamedType to pass as argument to the callback function
If the Type is an anonymous struct, for example, it will recursively iterate over the fields until it finds some Named type, or a basic type (in which case, the callback is not called). Note that the callback can be called more than just once (maybe not even called)
func GetCharReplacement ¶
GetCharReplacement will return the valid non-ASCII equivalent of an invalid GO typename symbol
func IdentifierToAsciiTypeName ¶
IdentifierToAsciiTypeName will transform a type identifier into an ASCII-only, valid GO typename
Example: "*int" (invalid typename) turns into "Ptr_int"
func IdentifierToTypeName ¶
IdentifierToTypeName will transform a type identifier into a valid GO typename. Note that it will use non-ASCII symbols as a trick to stay as close as possible to the original identifier representation
Example: "*int" turns into "ᕽint"
func ObjectIsAccessible ¶
ObjectIsAccessible will recursively check an object to see if it is accessible from the given package path (is it public? Private? Builtin?...)
func ResolveTypeIdentifier ¶
ResolveTypeIdentifier will take some type and return a string that represents it
Example: the type "pointer to integer" will return the string "*int"