Documentation ¶
Overview ¶
Package vdlgen implements VDL code generation from compiled VDL packages.
Index ¶
- func BaseType(t *vdl.Type, pkgPath string, imports codegen.Imports) string
- func Imports(imports codegen.Imports) string
- func PrintEmbed(w io.Writer, x signature.Embed)
- func PrintInterface(w io.Writer, x signature.Interface, types *NamedTypes)
- func PrintMethod(w io.Writer, x signature.Method, types *NamedTypes)
- func Type(t *vdl.Type, pkgPath string, imports codegen.Imports) string
- func TypedConst(v *vdl.Value, pkgPath string, imports codegen.Imports) string
- func UntypedConst(v *vdl.Value, pkgPath string, imports codegen.Imports) string
- type NamedTypes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseType ¶
BaseType returns the base type of t using VDL syntax, where the base type is the type of t disregarding its name. Subtypes contained in t are output via calls to Type.
func Imports ¶
Imports returns the vdl imports clause corresponding to imports; empty if there are no imports.
func PrintInterface ¶
func PrintInterface(w io.Writer, x signature.Interface, types *NamedTypes)
PrintInterface pretty-prints x to w. The types are used to collect named types, so that they may be printed later.
func PrintMethod ¶
func PrintMethod(w io.Writer, x signature.Method, types *NamedTypes)
PrintMethod pretty-prints x to w. The types are used to collect named types, so that they may be printed later.
func Type ¶
Type returns t using VDL syntax, returning the qualified name if t is named, otherwise returning the base type of t. The pkgPath and imports are used to determine the local package qualifier to add to named types; if a local package qualifier cannot be found, a full package path qualifier is added.
func TypedConst ¶
TypedConst returns the explicitly-typed vdl const corresponding to v, in the given pkgPath, with the given imports.
Types ¶
type NamedTypes ¶
type NamedTypes struct {
// contains filtered or unexported fields
}
NamedTypes represents a set of unique named types. The main usage is to collect the named types from one or more signatures, and to print all of the named types.
func (*NamedTypes) Add ¶
func (x *NamedTypes) Add(t *vdl.Type)
Add adds to x all named types from the type graph rooted at t.