Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
Comment string // comment for this base object
Type types.Type // type for this base object
Fields []Field // list of fields
OptFields []Field // list of optional fields
Qualifier string // qualifier for this type
}
Base holds a base type, its fields, and its comment.
type Field ¶
type Field struct {
Name string // name of this field (the const name, for an enum value)
Comment string // comment for this field
Value string // default value of field (for optionals)
Type types.Type // type for this field
Qualifier string // qualifier for this type
}
Field holds a field's type and its comment.
type PackageRequest ¶
PackageRequest represents an import request for a Go package. A list of these is passed into the loader to load types.
type TypeRegistry ¶
type TypeRegistry struct {
Packages map[string]*packages.Package
AliasToPack map[string]*packages.Package
PackToAlias map[string]string
Actions map[string]*Base
Events map[string]*Base
Datatypes map[string]*Base
Enums map[string]*Base
}
TypeRegistry holds all the imported packages and registers types within them.
func LoadTypes ¶
func LoadTypes(imports []*PackageRequest, workspace string, overlay map[string][]byte, env []string) (*TypeRegistry, []*sdk.CompileError)
LoadTypes loads all DSL types present in imports (Actions, Events, and Datatypes). Also loads comments and detects optional types by #optional tags. env is appended to the packages.Config environment on top of the process's own (e.g. "CGO_ENABLED=0"), so the caller can keep this type-checking pass's build-cache key aligned with whatever flags it ultimately builds the mission binary with.