vdlgen

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 9 Imported by: 5

Documentation

Overview

Package vdlgen implements VDL code generation from compiled VDL packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseType

func BaseType(t *vdl.Type, pkgPath string, imports codegen.Imports) string

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

func Imports(imports codegen.Imports) string

Imports returns the vdl imports clause corresponding to imports; empty if there are no imports.

func PrintEmbed

func PrintEmbed(w io.Writer, x signature.Embed)

PrintEmbed pretty-prints x to w.

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

func Type(t *vdl.Type, pkgPath string, imports codegen.Imports) string

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

func TypedConst(v *vdl.Value, pkgPath string, imports codegen.Imports) string

TypedConst returns the explicitly-typed vdl const corresponding to v, in the given pkgPath, with the given imports.

func UntypedConst

func UntypedConst(v *vdl.Value, pkgPath string, imports codegen.Imports) string

UntypedConst returns the untyped 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.

func (NamedTypes) Print

func (x NamedTypes) Print(w io.Writer)

Print pretty-prints x to w.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL