ir

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ir is the resolved semantic model backends consume. The messages are generated from proto/tdl/ir/v1/ir.proto; the helpers are hand written.

Index

Constants

View Source
const Unresolved = -1

Unresolved is the index an ID carries when its name did not resolve. The ID keeps the name as written.

Variables

View Source
var (
	LiteralKind_name = map[int32]string{
		0: "LITERAL_KIND_UNSPECIFIED",
		1: "LITERAL_KIND_STRING",
		2: "LITERAL_KIND_INT",
		3: "LITERAL_KIND_FLOAT",
		4: "LITERAL_KIND_BOOL",
		5: "LITERAL_KIND_NAME",
		6: "LITERAL_KIND_REGEX",
		7: "LITERAL_KIND_LIST",
		8: "LITERAL_KIND_RANGE",
	}
	LiteralKind_value = map[string]int32{
		"LITERAL_KIND_UNSPECIFIED": 0,
		"LITERAL_KIND_STRING":      1,
		"LITERAL_KIND_INT":         2,
		"LITERAL_KIND_FLOAT":       3,
		"LITERAL_KIND_BOOL":        4,
		"LITERAL_KIND_NAME":        5,
		"LITERAL_KIND_REGEX":       6,
		"LITERAL_KIND_LIST":        7,
		"LITERAL_KIND_RANGE":       8,
	}
)

Enum value maps for LiteralKind.

View Source
var (
	StructKind_name = map[int32]string{
		0: "STRUCT_KIND_UNSPECIFIED",
		1: "STRUCT_KIND_ENTITY",
		2: "STRUCT_KIND_VALUE",
		3: "STRUCT_KIND_MIXIN",
	}
	StructKind_value = map[string]int32{
		"STRUCT_KIND_UNSPECIFIED": 0,
		"STRUCT_KIND_ENTITY":      1,
		"STRUCT_KIND_VALUE":       2,
		"STRUCT_KIND_MIXIN":       3,
	}
)

Enum value maps for StructKind.

View Source
var (
	KindAtom_name = map[int32]string{
		0: "KIND_ATOM_UNSPECIFIED",
		1: "KIND_ATOM_TYPE",
		2: "KIND_ATOM_UNIT",
	}
	KindAtom_value = map[string]int32{
		"KIND_ATOM_UNSPECIFIED": 0,
		"KIND_ATOM_TYPE":        1,
		"KIND_ATOM_UNIT":        2,
	}
)

Enum value maps for KindAtom.

View Source
var (
	SyntacticForm_name = map[int32]string{
		0: "SYNTACTIC_FORM_UNSPECIFIED",
		1: "SYNTACTIC_FORM_NAMED",
		2: "SYNTACTIC_FORM_BRACKETS",
		3: "SYNTACTIC_FORM_BRACES",
		4: "SYNTACTIC_FORM_ARROW",
		5: "SYNTACTIC_FORM_QUESTION",
		6: "SYNTACTIC_FORM_OR_NULL",
	}
	SyntacticForm_value = map[string]int32{
		"SYNTACTIC_FORM_UNSPECIFIED": 0,
		"SYNTACTIC_FORM_NAMED":       1,
		"SYNTACTIC_FORM_BRACKETS":    2,
		"SYNTACTIC_FORM_BRACES":      3,
		"SYNTACTIC_FORM_ARROW":       4,
		"SYNTACTIC_FORM_QUESTION":    5,
		"SYNTACTIC_FORM_OR_NULL":     6,
	}
)

Enum value maps for SyntacticForm.

View Source
var File_tdl_ir_v1_ir_proto protoreflect.FileDescriptor

Functions

func Dump

func Dump(m *Model) string

Dump renders a model as an indented tree, one node per line, in the conventions of `tdl ast`. It is the output of `tdl ir`.

func KindName added in v0.1.8

func KindName(k LiteralKind) string

KindName is how a diagnostic names a literal kind: "a string", "an integer", and so on.

Types

type Alias

type Alias struct {
	Params []*Param `protobuf:"bytes,1,rep,name=params" json:"params,omitempty"`
	Target *ID      `protobuf:"bytes,2,opt,name=target" json:"target,omitempty"` // indexes Model.types
	// contains filtered or unexported fields
}

Alias is a transparent abbreviation, expanded rather than referenced.

func (*Alias) Descriptor deprecated

func (*Alias) Descriptor() ([]byte, []int)

Deprecated: Use Alias.ProtoReflect.Descriptor instead.

func (*Alias) GetParams

func (x *Alias) GetParams() []*Param

func (*Alias) GetTarget

func (x *Alias) GetTarget() *ID

func (*Alias) ProtoMessage

func (*Alias) ProtoMessage()

func (*Alias) ProtoReflect

func (x *Alias) ProtoReflect() protoreflect.Message

func (*Alias) Reset

func (x *Alias) Reset()

func (*Alias) String

func (x *Alias) String() string

type AssocBind

type AssocBind struct {
	Name     string    `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Type     *ID       `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"` // indexes Model.types
	Position *Position `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

AssocBind supplies a type for one of a class's associated type requirements.

func (*AssocBind) Descriptor deprecated

func (*AssocBind) Descriptor() ([]byte, []int)

Deprecated: Use AssocBind.ProtoReflect.Descriptor instead.

func (*AssocBind) GetName

func (x *AssocBind) GetName() string

func (*AssocBind) GetPosition

func (x *AssocBind) GetPosition() *Position

func (*AssocBind) GetType

func (x *AssocBind) GetType() *ID

func (*AssocBind) ProtoMessage

func (*AssocBind) ProtoMessage()

func (*AssocBind) ProtoReflect

func (x *AssocBind) ProtoReflect() protoreflect.Message

func (*AssocBind) Reset

func (x *AssocBind) Reset()

func (*AssocBind) String

func (x *AssocBind) String() string

type AssocType

type AssocType struct {
	Meta *Meta `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"`
	Kind *Kind `protobuf:"bytes,2,opt,name=kind" json:"kind,omitempty"`
	// contains filtered or unexported fields
}

AssocType is a type an implementor must supply and an instance binds.

func (*AssocType) Descriptor deprecated

func (*AssocType) Descriptor() ([]byte, []int)

Deprecated: Use AssocType.ProtoReflect.Descriptor instead.

func (*AssocType) GetKind

func (x *AssocType) GetKind() *Kind

func (*AssocType) GetMeta

func (x *AssocType) GetMeta() *Meta

func (*AssocType) ProtoMessage

func (*AssocType) ProtoMessage()

func (*AssocType) ProtoReflect

func (x *AssocType) ProtoReflect() protoreflect.Message

func (*AssocType) Reset

func (x *AssocType) Reset()

func (*AssocType) String

func (x *AssocType) String() string

type Class

type Class struct {
	Params          []*Param     `protobuf:"bytes,1,rep,name=params" json:"params,omitempty"`
	FunDeps         []*FunDep    `protobuf:"bytes,2,rep,name=fun_deps,json=funDeps" json:"fun_deps,omitempty"`
	RequiresClasses []*ClassRef  `protobuf:"bytes,3,rep,name=requires_classes,json=requiresClasses" json:"requires_classes,omitempty"` // classes an implementor must also satisfy
	Constraints     []*ClassRef  `protobuf:"bytes,4,rep,name=constraints" json:"constraints,omitempty"`                                // the `requires` clause on this class's parameters
	Fields          []*Field     `protobuf:"bytes,5,rep,name=fields" json:"fields,omitempty"`
	AssocTypes      []*AssocType `protobuf:"bytes,7,rep,name=assoc_types,json=assocTypes" json:"assoc_types,omitempty"`
	// contains filtered or unexported fields
}

Class is a contract. Conformance is nominal and always declared.

func (*Class) Descriptor deprecated

func (*Class) Descriptor() ([]byte, []int)

Deprecated: Use Class.ProtoReflect.Descriptor instead.

func (*Class) GetAssocTypes

func (x *Class) GetAssocTypes() []*AssocType

func (*Class) GetConstraints

func (x *Class) GetConstraints() []*ClassRef

func (*Class) GetFields

func (x *Class) GetFields() []*Field

func (*Class) GetFunDeps

func (x *Class) GetFunDeps() []*FunDep

func (*Class) GetParams

func (x *Class) GetParams() []*Param

func (*Class) GetRequiresClasses

func (x *Class) GetRequiresClasses() []*ClassRef

func (*Class) ProtoMessage

func (*Class) ProtoMessage()

func (*Class) ProtoReflect

func (x *Class) ProtoReflect() protoreflect.Message

func (*Class) Reset

func (x *Class) Reset()

func (*Class) String

func (x *Class) String() string

type ClassRef

type ClassRef struct {
	Class    *ID       `protobuf:"bytes,1,opt,name=class" json:"class,omitempty"`   // indexes Model.decls; unset when extern is set
	Extern   *ID       `protobuf:"bytes,2,opt,name=extern" json:"extern,omitempty"` // indexes Model.externs
	Args     []*ID     `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"`     // indexes Model.types
	Position *Position `protobuf:"bytes,4,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

ClassRef names a class, applied to arguments.

func (*ClassRef) Descriptor deprecated

func (*ClassRef) Descriptor() ([]byte, []int)

Deprecated: Use ClassRef.ProtoReflect.Descriptor instead.

func (*ClassRef) GetArgs

func (x *ClassRef) GetArgs() []*ID

func (*ClassRef) GetClass

func (x *ClassRef) GetClass() *ID

func (*ClassRef) GetExtern

func (x *ClassRef) GetExtern() *ID

func (*ClassRef) GetPosition

func (x *ClassRef) GetPosition() *Position

func (*ClassRef) ProtoMessage

func (*ClassRef) ProtoMessage()

func (*ClassRef) ProtoReflect

func (x *ClassRef) ProtoReflect() protoreflect.Message

func (*ClassRef) Reset

func (x *ClassRef) Reset()

func (*ClassRef) String

func (x *ClassRef) String() string

type Constraint

type Constraint struct {
	Name     string     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Args     []*Literal `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"`
	Position *Position  `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	// from names the newtype a constraint was inherited from, unset for one
	// written on this declaration.
	From *ID `protobuf:"bytes,4,opt,name=from" json:"from,omitempty"` // indexes Model.decls
	// contains filtered or unexported fields
}

Constraint is one entry in a `where { ... }` block.

The set of names is open. The compiler checks the arity and argument kinds of the standard names and passes everything else through.

func (*Constraint) Descriptor deprecated

func (*Constraint) Descriptor() ([]byte, []int)

Deprecated: Use Constraint.ProtoReflect.Descriptor instead.

func (*Constraint) GetArgs

func (x *Constraint) GetArgs() []*Literal

func (*Constraint) GetFrom

func (x *Constraint) GetFrom() *ID

func (*Constraint) GetName

func (x *Constraint) GetName() string

func (*Constraint) GetPosition

func (x *Constraint) GetPosition() *Position

func (*Constraint) ProtoMessage

func (*Constraint) ProtoMessage()

func (*Constraint) ProtoReflect

func (x *Constraint) ProtoReflect() protoreflect.Message

func (*Constraint) Reset

func (x *Constraint) Reset()

func (*Constraint) String

func (x *Constraint) String() string

type Decl

type Decl struct {
	Meta       *Meta        `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"`
	Directives []*Directive `protobuf:"bytes,8,rep,name=directives" json:"directives,omitempty"`
	// Types that are valid to be assigned to Node:
	//
	//	*Decl_Primitive
	//	*Decl_Alias
	//	*Decl_Newtype
	//	*Decl_Structure
	//	*Decl_Enumeration
	//	*Decl_Class
	//	*Decl_Unit
	Node isDecl_Node `protobuf_oneof:"node"`
	// contains filtered or unexported fields
}

Decl is one declaration. Entities, values, and mixins share Struct; each other form has its own message.

func (*Decl) Constraints added in v0.2.3

func (d *Decl) Constraints() []*ClassRef

Constraints returns the `requires` clause on a declaration's type parameters, or nil.

func (*Decl) Descriptor deprecated

func (*Decl) Descriptor() ([]byte, []int)

Deprecated: Use Decl.ProtoReflect.Descriptor instead.

func (*Decl) Fields

func (d *Decl) Fields() []*Field

Fields returns a struct declaration's fields, or nil. An enum's fields belong to its variants.

func (*Decl) GetAlias

func (x *Decl) GetAlias() *Alias

func (*Decl) GetClass

func (x *Decl) GetClass() *Class

func (*Decl) GetDirectives

func (x *Decl) GetDirectives() []*Directive

func (*Decl) GetEnumeration

func (x *Decl) GetEnumeration() *Enum

func (*Decl) GetMeta

func (x *Decl) GetMeta() *Meta

func (*Decl) GetNewtype

func (x *Decl) GetNewtype() *Newtype

func (*Decl) GetNode

func (x *Decl) GetNode() isDecl_Node

func (*Decl) GetPrimitive

func (x *Decl) GetPrimitive() *Primitive

func (*Decl) GetStructure

func (x *Decl) GetStructure() *Struct

func (*Decl) GetUnit added in v0.1.4

func (x *Decl) GetUnit() *UnitDef

func (*Decl) Params

func (d *Decl) Params() []*Param

Params returns the type parameters of a declaration, or nil.

func (*Decl) ProtoMessage

func (*Decl) ProtoMessage()

func (*Decl) ProtoReflect

func (x *Decl) ProtoReflect() protoreflect.Message

func (*Decl) Reset

func (x *Decl) Reset()

func (*Decl) String

func (x *Decl) String() string

type Decl_Alias

type Decl_Alias struct {
	Alias *Alias `protobuf:"bytes,3,opt,name=alias,oneof"`
}

type Decl_Class

type Decl_Class struct {
	Class *Class `protobuf:"bytes,7,opt,name=class,oneof"`
}

type Decl_Enumeration

type Decl_Enumeration struct {
	Enumeration *Enum `protobuf:"bytes,6,opt,name=enumeration,oneof"`
}

type Decl_Newtype

type Decl_Newtype struct {
	Newtype *Newtype `protobuf:"bytes,4,opt,name=newtype,oneof"`
}

type Decl_Primitive

type Decl_Primitive struct {
	Primitive *Primitive `protobuf:"bytes,2,opt,name=primitive,oneof"`
}

type Decl_Structure

type Decl_Structure struct {
	Structure *Struct `protobuf:"bytes,5,opt,name=structure,oneof"`
}

type Decl_Unit added in v0.1.4

type Decl_Unit struct {
	Unit *UnitDef `protobuf:"bytes,9,opt,name=unit,oneof"`
}

type Deprecation

type Deprecation struct {
	Reason   string    `protobuf:"bytes,1,opt,name=reason" json:"reason,omitempty"` // empty when written without one
	Position *Position `protobuf:"bytes,2,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

Deprecation marks a node as on its way out.

func (*Deprecation) Descriptor deprecated

func (*Deprecation) Descriptor() ([]byte, []int)

Deprecated: Use Deprecation.ProtoReflect.Descriptor instead.

func (*Deprecation) GetPosition

func (x *Deprecation) GetPosition() *Position

func (*Deprecation) GetReason

func (x *Deprecation) GetReason() string

func (*Deprecation) ProtoMessage

func (*Deprecation) ProtoMessage()

func (*Deprecation) ProtoReflect

func (x *Deprecation) ProtoReflect() protoreflect.Message

func (*Deprecation) Reset

func (x *Deprecation) Reset()

func (*Deprecation) String

func (x *Deprecation) String() string

type Dimension added in v0.1.4

type Dimension struct {
	Base     *ID   `protobuf:"bytes,1,opt,name=base" json:"base,omitempty"`          // indexes Model.decls at a base UnitDef
	Exponent int32 `protobuf:"varint,2,opt,name=exponent" json:"exponent,omitempty"` // never zero; a cancelled dimension is dropped
	// contains filtered or unexported fields
}

Dimension is one base unit raised to a power.

func (*Dimension) Descriptor deprecated added in v0.1.4

func (*Dimension) Descriptor() ([]byte, []int)

Deprecated: Use Dimension.ProtoReflect.Descriptor instead.

func (*Dimension) GetBase added in v0.1.4

func (x *Dimension) GetBase() *ID

func (*Dimension) GetExponent added in v0.1.4

func (x *Dimension) GetExponent() int32

func (*Dimension) ProtoMessage added in v0.1.4

func (*Dimension) ProtoMessage()

func (*Dimension) ProtoReflect added in v0.1.4

func (x *Dimension) ProtoReflect() protoreflect.Message

func (*Dimension) Reset added in v0.1.4

func (x *Dimension) Reset()

func (*Dimension) String added in v0.1.4

func (x *Dimension) String() string

type Directive

type Directive struct {
	Name     string     `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Args     []*Literal `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"`
	Position *Position  `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	// target names the block this came from.
	Target string `protobuf:"bytes,4,opt,name=target" json:"target,omitempty"`
	// from_class is set when the directive was written against a class and
	// expanded onto everything satisfying it.
	FromClass *ID `protobuf:"bytes,5,opt,name=from_class,json=fromClass" json:"from_class,omitempty"` // indexes Model.decls
	// contains filtered or unexported fields
}

Directive is an opaque instruction to a backend. The compiler checks its shape and resolves its path; the backend decides what it means.

func (*Directive) Descriptor deprecated

func (*Directive) Descriptor() ([]byte, []int)

Deprecated: Use Directive.ProtoReflect.Descriptor instead.

func (*Directive) GetArgs

func (x *Directive) GetArgs() []*Literal

func (*Directive) GetFromClass

func (x *Directive) GetFromClass() *ID

func (*Directive) GetName

func (x *Directive) GetName() string

func (*Directive) GetPosition

func (x *Directive) GetPosition() *Position

func (*Directive) GetTarget

func (x *Directive) GetTarget() string

func (*Directive) ProtoMessage

func (*Directive) ProtoMessage()

func (*Directive) ProtoReflect

func (x *Directive) ProtoReflect() protoreflect.Message

func (*Directive) Reset

func (x *Directive) Reset()

func (*Directive) String

func (x *Directive) String() string

type Enum

type Enum struct {
	Params      []*Param    `protobuf:"bytes,1,rep,name=params" json:"params,omitempty"`
	Variants    []*Variant  `protobuf:"bytes,2,rep,name=variants" json:"variants,omitempty"`
	Conforms    []*ClassRef `protobuf:"bytes,3,rep,name=conforms" json:"conforms,omitempty"`
	Constraints []*ClassRef `protobuf:"bytes,4,rep,name=constraints" json:"constraints,omitempty"`
	// contains filtered or unexported fields
}

Enum is a closed set of variants. A variant may carry fields, which makes enum the language's sum type.

func (*Enum) Descriptor deprecated

func (*Enum) Descriptor() ([]byte, []int)

Deprecated: Use Enum.ProtoReflect.Descriptor instead.

func (*Enum) GetConforms

func (x *Enum) GetConforms() []*ClassRef

func (*Enum) GetConstraints

func (x *Enum) GetConstraints() []*ClassRef

func (*Enum) GetParams

func (x *Enum) GetParams() []*Param

func (*Enum) GetVariants

func (x *Enum) GetVariants() []*Variant

func (*Enum) ProtoMessage

func (*Enum) ProtoMessage()

func (*Enum) ProtoReflect

func (x *Enum) ProtoReflect() protoreflect.Message

func (*Enum) Reset

func (x *Enum) Reset()

func (*Enum) String

func (x *Enum) String() string

type Extern

type Extern struct {
	Package    string       `protobuf:"bytes,1,opt,name=package" json:"package,omitempty"`       // the declaring package
	Name       string       `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`             // the declaration's name within it
	Position   *Position    `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`     // where this model first referred to it
	Directives []*Directive `protobuf:"bytes,4,rep,name=directives" json:"directives,omitempty"` // resolved target directives whose path names this extern
	// contains filtered or unexported fields
}

Extern is a declaration in another package that this one refers to.

A backend either resolves an extern through the import table and generates a reference, or maps it with a target directive.

func (*Extern) Descriptor deprecated

func (*Extern) Descriptor() ([]byte, []int)

Deprecated: Use Extern.ProtoReflect.Descriptor instead.

func (*Extern) GetDirectives added in v0.2.11

func (x *Extern) GetDirectives() []*Directive

func (*Extern) GetName

func (x *Extern) GetName() string

func (*Extern) GetPackage

func (x *Extern) GetPackage() string

func (*Extern) GetPosition

func (x *Extern) GetPosition() *Position

func (*Extern) ProtoMessage

func (*Extern) ProtoMessage()

func (*Extern) ProtoReflect

func (x *Extern) ProtoReflect() protoreflect.Message

func (*Extern) Reset

func (x *Extern) Reset()

func (*Extern) String

func (x *Extern) String() string

type Field

type Field struct {
	Meta         *Meta         `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"`
	Type         *ID           `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"`    // indexes Model.types
	Owned        bool          `protobuf:"varint,4,opt,name=owned" json:"owned,omitempty"` // composition rather than reference
	Constraints  []*Constraint `protobuf:"bytes,6,rep,name=constraints" json:"constraints,omitempty"`
	DefaultValue *Literal      `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` // unset when the field has no default
	Directives   []*Directive  `protobuf:"bytes,8,rep,name=directives" json:"directives,omitempty"`
	// included_from names the mixin a field was copied from, unset for a
	// field the declaration wrote itself.
	IncludedFrom *ID `protobuf:"bytes,5,opt,name=included_from,json=includedFrom" json:"included_from,omitempty"` // indexes Model.decls
	// contains filtered or unexported fields
}

Field is a named, typed member.

func (*Field) Descriptor deprecated

func (*Field) Descriptor() ([]byte, []int)

Deprecated: Use Field.ProtoReflect.Descriptor instead.

func (*Field) GetConstraints

func (x *Field) GetConstraints() []*Constraint

func (*Field) GetDefaultValue

func (x *Field) GetDefaultValue() *Literal

func (*Field) GetDirectives

func (x *Field) GetDirectives() []*Directive

func (*Field) GetIncludedFrom

func (x *Field) GetIncludedFrom() *ID

func (*Field) GetMeta

func (x *Field) GetMeta() *Meta

func (*Field) GetOwned

func (x *Field) GetOwned() bool

func (*Field) GetType

func (x *Field) GetType() *ID

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) ProtoReflect

func (x *Field) ProtoReflect() protoreflect.Message

func (*Field) Reset

func (x *Field) Reset()

func (*Field) String

func (x *Field) String() string

type FunDep

type FunDep struct {
	From     []string  `protobuf:"bytes,1,rep,name=from" json:"from,omitempty"`
	To       []string  `protobuf:"bytes,2,rep,name=to" json:"to,omitempty"`
	Position *Position `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

FunDep states that some parameters determine others.

func (*FunDep) Descriptor deprecated

func (*FunDep) Descriptor() ([]byte, []int)

Deprecated: Use FunDep.ProtoReflect.Descriptor instead.

func (*FunDep) GetFrom

func (x *FunDep) GetFrom() []string

func (*FunDep) GetPosition

func (x *FunDep) GetPosition() *Position

func (*FunDep) GetTo

func (x *FunDep) GetTo() []string

func (*FunDep) ProtoMessage

func (*FunDep) ProtoMessage()

func (*FunDep) ProtoReflect

func (x *FunDep) ProtoReflect() protoreflect.Message

func (*FunDep) Reset

func (x *FunDep) Reset()

func (*FunDep) String

func (x *FunDep) String() string

type ID

type ID struct {
	Index int32  `protobuf:"varint,1,opt,name=index" json:"index,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
	// contains filtered or unexported fields
}

ID references a node by its index into a table and by its fully qualified name.

Lookups use the index. Diagnostics, dumps, and target paths use the name, which is stable across edits. The field holding an ID fixes which table it indexes.

An index of -1 means the name did not resolve; lowering reports it, and the name records what was written.

func (*ID) Descriptor deprecated

func (*ID) Descriptor() ([]byte, []int)

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) GetIndex

func (x *ID) GetIndex() int32

func (*ID) GetName

func (x *ID) GetName() string

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect

func (x *ID) ProtoReflect() protoreflect.Message

func (*ID) Reset

func (x *ID) Reset()

func (*ID) Resolved

func (x *ID) Resolved() bool

Resolved reports whether id points at a table entry.

func (*ID) String

func (x *ID) String() string

type Import

type Import struct {
	Path     string    `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"`       // as written
	Alias    string    `protobuf:"bytes,2,opt,name=alias" json:"alias,omitempty"`     // "_" merges the imported names into this scope
	Package  string    `protobuf:"bytes,3,opt,name=package" json:"package,omitempty"` // the package the imported file declares
	Position *Position `protobuf:"bytes,4,opt,name=position" json:"position,omitempty"`
	// directives are the block-scope directives of the dependency's target
	// blocks, so a backend can refer to the dependency as it is generated.
	Directives []*Directive `protobuf:"bytes,5,rep,name=directives" json:"directives,omitempty"`
	// contains filtered or unexported fields
}

Import is one `import "path" as alias` in the file.

func (*Import) Descriptor deprecated

func (*Import) Descriptor() ([]byte, []int)

Deprecated: Use Import.ProtoReflect.Descriptor instead.

func (*Import) GetAlias

func (x *Import) GetAlias() string

func (*Import) GetDirectives added in v0.2.11

func (x *Import) GetDirectives() []*Directive

func (*Import) GetPackage

func (x *Import) GetPackage() string

func (*Import) GetPath

func (x *Import) GetPath() string

func (*Import) GetPosition

func (x *Import) GetPosition() *Position

func (*Import) ProtoMessage

func (*Import) ProtoMessage()

func (*Import) ProtoReflect

func (x *Import) ProtoReflect() protoreflect.Message

func (*Import) Reset

func (x *Import) Reset()

func (*Import) String

func (x *Import) String() string

type Instance

type Instance struct {
	Meta     *Meta        `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"`
	Params   []*Param     `protobuf:"bytes,2,rep,name=params" json:"params,omitempty"`
	Class    *ClassRef    `protobuf:"bytes,3,opt,name=class" json:"class,omitempty"`
	Requires []*ClassRef  `protobuf:"bytes,4,rep,name=requires" json:"requires,omitempty"` // conditions on this instance
	Binds    []*AssocBind `protobuf:"bytes,5,rep,name=binds" json:"binds,omitempty"`
	// contains filtered or unexported fields
}

Instance declares that a type satisfies a class.

`instance C for T` is lowered to `instance C<T>`. An instance is not a type name, so it has its own table.

func (*Instance) Descriptor deprecated

func (*Instance) Descriptor() ([]byte, []int)

Deprecated: Use Instance.ProtoReflect.Descriptor instead.

func (*Instance) GetBinds

func (x *Instance) GetBinds() []*AssocBind

func (*Instance) GetClass

func (x *Instance) GetClass() *ClassRef

func (*Instance) GetMeta

func (x *Instance) GetMeta() *Meta

func (*Instance) GetParams

func (x *Instance) GetParams() []*Param

func (*Instance) GetRequires

func (x *Instance) GetRequires() []*ClassRef

func (*Instance) ProtoMessage

func (*Instance) ProtoMessage()

func (*Instance) ProtoReflect

func (x *Instance) ProtoReflect() protoreflect.Message

func (*Instance) Reset

func (x *Instance) Reset()

func (*Instance) String

func (x *Instance) String() string

type Kind

type Kind struct {
	Atom  KindAtom `protobuf:"varint,1,opt,name=atom,enum=tdl.ir.v1.KindAtom" json:"atom,omitempty"` // unset when paren is set
	Paren *Kind    `protobuf:"bytes,2,opt,name=paren" json:"paren,omitempty"`
	Arrow *Kind    `protobuf:"bytes,3,opt,name=arrow" json:"arrow,omitempty"` // unset for a bare atom
	// contains filtered or unexported fields
}

Kind is a kind expression: an atom, a parenthesized kind, or either of those followed by an arrow. Arrows associate to the right.

func (*Kind) Descriptor deprecated

func (*Kind) Descriptor() ([]byte, []int)

Deprecated: Use Kind.ProtoReflect.Descriptor instead.

func (*Kind) GetArrow

func (x *Kind) GetArrow() *Kind

func (*Kind) GetAtom

func (x *Kind) GetAtom() KindAtom

func (*Kind) GetParen

func (x *Kind) GetParen() *Kind

func (*Kind) ProtoMessage

func (*Kind) ProtoMessage()

func (*Kind) ProtoReflect

func (x *Kind) ProtoReflect() protoreflect.Message

func (*Kind) Reset

func (x *Kind) Reset()

func (*Kind) String

func (x *Kind) String() string

type KindAtom

type KindAtom int32

KindAtom is a base kind.

const (
	KindAtom_KIND_ATOM_UNSPECIFIED KindAtom = 0
	KindAtom_KIND_ATOM_TYPE        KindAtom = 1
	KindAtom_KIND_ATOM_UNIT        KindAtom = 2
)

func (KindAtom) Descriptor

func (KindAtom) Descriptor() protoreflect.EnumDescriptor

func (KindAtom) Enum

func (x KindAtom) Enum() *KindAtom

func (KindAtom) EnumDescriptor deprecated

func (KindAtom) EnumDescriptor() ([]byte, []int)

Deprecated: Use KindAtom.Descriptor instead.

func (KindAtom) Number

func (x KindAtom) Number() protoreflect.EnumNumber

func (KindAtom) String

func (x KindAtom) String() string

func (KindAtom) Type

type Literal

type Literal struct {
	Kind     LiteralKind `protobuf:"varint,1,opt,name=kind,enum=tdl.ir.v1.LiteralKind" json:"kind,omitempty"`
	Text     string      `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"`   // decoded for STRING, the pattern for REGEX, the name for NAME
	Items    []*Literal  `protobuf:"bytes,3,rep,name=items" json:"items,omitempty"` // set for LIST
	Range    *Range      `protobuf:"bytes,4,opt,name=range" json:"range,omitempty"` // set for RANGE
	Position *Position   `protobuf:"bytes,5,opt,name=position" json:"position,omitempty"`
	// variant names the enum variant a NAME literal resolves to, checked
	// against the field's type. Unset when it did not resolve.
	Variant *ID `protobuf:"bytes,6,opt,name=variant" json:"variant,omitempty"`
	// contains filtered or unexported fields
}

Literal is a value written in the source: a field default, a constraint argument, or a directive argument.

func (*Literal) Descriptor deprecated

func (*Literal) Descriptor() ([]byte, []int)

Deprecated: Use Literal.ProtoReflect.Descriptor instead.

func (*Literal) GetItems

func (x *Literal) GetItems() []*Literal

func (*Literal) GetKind

func (x *Literal) GetKind() LiteralKind

func (*Literal) GetPosition

func (x *Literal) GetPosition() *Position

func (*Literal) GetRange

func (x *Literal) GetRange() *Range

func (*Literal) GetText

func (x *Literal) GetText() string

func (*Literal) GetVariant

func (x *Literal) GetVariant() *ID

func (*Literal) ProtoMessage

func (*Literal) ProtoMessage()

func (*Literal) ProtoReflect

func (x *Literal) ProtoReflect() protoreflect.Message

func (*Literal) Reset

func (x *Literal) Reset()

func (*Literal) String

func (x *Literal) String() string

type LiteralKind

type LiteralKind int32

LiteralKind identifies which form a Literal takes.

const (
	LiteralKind_LITERAL_KIND_UNSPECIFIED LiteralKind = 0
	LiteralKind_LITERAL_KIND_STRING      LiteralKind = 1
	LiteralKind_LITERAL_KIND_INT         LiteralKind = 2
	LiteralKind_LITERAL_KIND_FLOAT       LiteralKind = 3
	LiteralKind_LITERAL_KIND_BOOL        LiteralKind = 4
	LiteralKind_LITERAL_KIND_NAME        LiteralKind = 5 // a name denoting an enum variant
	LiteralKind_LITERAL_KIND_REGEX       LiteralKind = 6
	LiteralKind_LITERAL_KIND_LIST        LiteralKind = 7
	LiteralKind_LITERAL_KIND_RANGE       LiteralKind = 8
)

func (LiteralKind) Descriptor

func (LiteralKind) Enum

func (x LiteralKind) Enum() *LiteralKind

func (LiteralKind) EnumDescriptor deprecated

func (LiteralKind) EnumDescriptor() ([]byte, []int)

Deprecated: Use LiteralKind.Descriptor instead.

func (LiteralKind) Number

func (x LiteralKind) Number() protoreflect.EnumNumber

func (LiteralKind) String

func (x LiteralKind) String() string

func (LiteralKind) Type

type Meta

type Meta struct {
	Name       string       `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // fully qualified for a declaration, bare for a member
	Doc        []string     `protobuf:"bytes,2,rep,name=doc" json:"doc,omitempty"`
	Position   *Position    `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	Deprecated *Deprecation `protobuf:"bytes,4,opt,name=deprecated" json:"deprecated,omitempty"` // unset when not deprecated
	Order      int32        `protobuf:"varint,5,opt,name=order" json:"order,omitempty"`
	// contains filtered or unexported fields
}

Meta is the source information every node carries.

order is the position among siblings, so generated output is stable.

func (*Meta) Descriptor deprecated

func (*Meta) Descriptor() ([]byte, []int)

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetDeprecated

func (x *Meta) GetDeprecated() *Deprecation

func (*Meta) GetDoc

func (x *Meta) GetDoc() []string

func (*Meta) GetName

func (x *Meta) GetName() string

func (*Meta) GetOrder

func (x *Meta) GetOrder() int32

func (*Meta) GetPosition

func (x *Meta) GetPosition() *Position

func (*Meta) IsDeprecated

func (m *Meta) IsDeprecated() bool

IsDeprecated reports whether the node is marked deprecated.

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

func (x *Meta) ProtoReflect() protoreflect.Message

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type Model

type Model struct {
	Package   string          `protobuf:"bytes,1,opt,name=package" json:"package,omitempty"`
	Decls     []*Decl         `protobuf:"bytes,2,rep,name=decls" json:"decls,omitempty"`
	Types     []*Type         `protobuf:"bytes,3,rep,name=types" json:"types,omitempty"`
	Imports   []*Import       `protobuf:"bytes,4,rep,name=imports" json:"imports,omitempty"`
	Externs   []*Extern       `protobuf:"bytes,5,rep,name=externs" json:"externs,omitempty"`
	Instances []*Instance     `protobuf:"bytes,6,rep,name=instances" json:"instances,omitempty"`
	Satisfies []*Satisfaction `protobuf:"bytes,7,rep,name=satisfies" json:"satisfies,omitempty"`
	Targets   []*TargetBlock  `protobuf:"bytes,8,rep,name=targets" json:"targets,omitempty"`
	Units     []*Unit         `protobuf:"bytes,9,rep,name=units" json:"units,omitempty"` // the interned unit table
	// contains filtered or unexported fields
}

Model is one package: every declaration in it, and every type reference those declarations use.

Each table is its own ID space. Declarations from imported packages are not inlined; a reference into a dependency is an ID whose name carries that package.

func (*Model) Decl

func (x *Model) Decl(id *ID) *Decl

Decl returns the declaration id references, or nil if it does not resolve to one.

func (*Model) Descriptor deprecated

func (*Model) Descriptor() ([]byte, []int)

Deprecated: Use Model.ProtoReflect.Descriptor instead.

func (*Model) FindDecl

func (x *Model) FindDecl(name string) (*Decl, *ID, bool)

FindDecl returns the declaration with the given fully qualified name and its ID, reporting false when there is none.

func (*Model) GetDecls

func (x *Model) GetDecls() []*Decl

func (*Model) GetExterns

func (x *Model) GetExterns() []*Extern

func (*Model) GetImports

func (x *Model) GetImports() []*Import

func (*Model) GetInstances

func (x *Model) GetInstances() []*Instance

func (*Model) GetPackage

func (x *Model) GetPackage() string

func (*Model) GetSatisfies

func (x *Model) GetSatisfies() []*Satisfaction

func (*Model) GetTargets

func (x *Model) GetTargets() []*TargetBlock

func (*Model) GetTypes

func (x *Model) GetTypes() []*Type

func (*Model) GetUnits added in v0.1.4

func (x *Model) GetUnits() []*Unit

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) ProtoReflect

func (x *Model) ProtoReflect() protoreflect.Message

func (*Model) Reset

func (x *Model) Reset()

func (*Model) Satisfying

func (x *Model) Satisfying(class *ID) []*ID

Satisfying returns the declarations in this model satisfying a class, closed over the classes that class requires.

func (*Model) SatisfyingTypes

func (x *Model) SatisfyingTypes(class *ID) []*ID

SatisfyingTypes returns the instantiated types that satisfy a class through a conditional instance, such as `Page<Order>` given `instance <T> Auditable<Page<T>> requires Auditable<T>`.

func (*Model) String

func (x *Model) String() string

func (*Model) Type

func (x *Model) Type(id *ID) *Type

Type returns the type reference id points at, or nil if it does not resolve to one.

func (*Model) Unit added in v0.1.4

func (x *Model) Unit(id *ID) *Unit

Unit returns the unit an ID indexes, or nil when the ID did not resolve.

type Newtype

type Newtype struct {
	Params           []*Param      `protobuf:"bytes,1,rep,name=params" json:"params,omitempty"`
	Base             *ID           `protobuf:"bytes,2,opt,name=base" json:"base,omitempty"`                                                 // indexes Model.types
	Constraints      []*ClassRef   `protobuf:"bytes,3,rep,name=constraints" json:"constraints,omitempty"`                                   // the `requires` clause on its parameters
	ValueConstraints []*Constraint `protobuf:"bytes,4,rep,name=value_constraints,json=valueConstraints" json:"value_constraints,omitempty"` // the `where` block, accumulated down the chain
	// contains filtered or unexported fields
}

Newtype is a distinct type over another, not interchangeable with it.

func (*Newtype) Descriptor deprecated

func (*Newtype) Descriptor() ([]byte, []int)

Deprecated: Use Newtype.ProtoReflect.Descriptor instead.

func (*Newtype) GetBase

func (x *Newtype) GetBase() *ID

func (*Newtype) GetConstraints

func (x *Newtype) GetConstraints() []*ClassRef

func (*Newtype) GetParams

func (x *Newtype) GetParams() []*Param

func (*Newtype) GetValueConstraints

func (x *Newtype) GetValueConstraints() []*Constraint

func (*Newtype) ProtoMessage

func (*Newtype) ProtoMessage()

func (*Newtype) ProtoReflect

func (x *Newtype) ProtoReflect() protoreflect.Message

func (*Newtype) Reset

func (x *Newtype) Reset()

func (*Newtype) String

func (x *Newtype) String() string

type Param

type Param struct {
	Name     string    `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Kind     *Kind     `protobuf:"bytes,2,opt,name=kind" json:"kind,omitempty"` // unset when inferred from use
	Position *Position `protobuf:"bytes,3,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

Param is one type parameter.

func (*Param) Descriptor deprecated

func (*Param) Descriptor() ([]byte, []int)

Deprecated: Use Param.ProtoReflect.Descriptor instead.

func (*Param) GetKind

func (x *Param) GetKind() *Kind

func (*Param) GetName

func (x *Param) GetName() string

func (*Param) GetPosition

func (x *Param) GetPosition() *Position

func (*Param) ProtoMessage

func (*Param) ProtoMessage()

func (*Param) ProtoReflect

func (x *Param) ProtoReflect() protoreflect.Message

func (*Param) Reset

func (x *Param) Reset()

func (*Param) String

func (x *Param) String() string

type ParamRef

type ParamRef struct {
	Name  string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Index int32  `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` // into the declaring node's params
	Owner *ID    `protobuf:"bytes,3,opt,name=owner" json:"owner,omitempty"`  // the declaration that declares it
	// contains filtered or unexported fields
}

ParamRef is a use of a type parameter.

Parameters are not monomorphized; a backend without generics instantiates them itself.

func (*ParamRef) Descriptor deprecated

func (*ParamRef) Descriptor() ([]byte, []int)

Deprecated: Use ParamRef.ProtoReflect.Descriptor instead.

func (*ParamRef) GetIndex

func (x *ParamRef) GetIndex() int32

func (*ParamRef) GetName

func (x *ParamRef) GetName() string

func (*ParamRef) GetOwner

func (x *ParamRef) GetOwner() *ID

func (*ParamRef) ProtoMessage

func (*ParamRef) ProtoMessage()

func (*ParamRef) ProtoReflect

func (x *ParamRef) ProtoReflect() protoreflect.Message

func (*ParamRef) Reset

func (x *ParamRef) Reset()

func (*ParamRef) String

func (x *ParamRef) String() string

type Position

type Position struct {
	Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"`
	Line     int32  `protobuf:"varint,2,opt,name=line" json:"line,omitempty"`
	Column   int32  `protobuf:"varint,3,opt,name=column" json:"column,omitempty"`
	// contains filtered or unexported fields
}

Position is a location in a source file.

func (*Position) Descriptor deprecated

func (*Position) Descriptor() ([]byte, []int)

Deprecated: Use Position.ProtoReflect.Descriptor instead.

func (*Position) GetColumn

func (x *Position) GetColumn() int32

func (*Position) GetFilename

func (x *Position) GetFilename() string

func (*Position) GetLine

func (x *Position) GetLine() int32

func (*Position) ProtoMessage

func (*Position) ProtoMessage()

func (*Position) ProtoReflect

func (x *Position) ProtoReflect() protoreflect.Message

func (*Position) Reset

func (x *Position) Reset()

func (*Position) String

func (x *Position) String() string

type Primitive

type Primitive struct {
	Kind *Kind `protobuf:"bytes,1,opt,name=kind" json:"kind,omitempty"` // unset when the kind is left to inference
	// contains filtered or unexported fields
}

Primitive is an opaque, irreducible root type.

func (*Primitive) Descriptor deprecated

func (*Primitive) Descriptor() ([]byte, []int)

Deprecated: Use Primitive.ProtoReflect.Descriptor instead.

func (*Primitive) GetKind

func (x *Primitive) GetKind() *Kind

func (*Primitive) ProtoMessage

func (*Primitive) ProtoMessage()

func (*Primitive) ProtoReflect

func (x *Primitive) ProtoReflect() protoreflect.Message

func (*Primitive) Reset

func (x *Primitive) Reset()

func (*Primitive) String

func (x *Primitive) String() string

type Range

type Range struct {
	Low  *int64 `protobuf:"varint,1,opt,name=low" json:"low,omitempty"`
	High *int64 `protobuf:"varint,2,opt,name=high" json:"high,omitempty"`
	// contains filtered or unexported fields
}

Range is a bound with either end optional: `3..254`, `1..`, `..64`.

func (*Range) Descriptor deprecated

func (*Range) Descriptor() ([]byte, []int)

Deprecated: Use Range.ProtoReflect.Descriptor instead.

func (*Range) GetHigh

func (x *Range) GetHigh() int64

func (*Range) GetLow

func (x *Range) GetLow() int64

func (*Range) ProtoMessage

func (*Range) ProtoMessage()

func (*Range) ProtoReflect

func (x *Range) ProtoReflect() protoreflect.Message

func (*Range) Reset

func (x *Range) Reset()

func (*Range) String

func (x *Range) String() string

type Satisfaction

type Satisfaction struct {
	Class *ID   `protobuf:"bytes,1,opt,name=class" json:"class,omitempty"` // indexes Model.decls
	Decls []*ID `protobuf:"bytes,2,rep,name=decls" json:"decls,omitempty"` // indexes Model.decls
	// types lists instantiated types that satisfy the class through a
	// conditional instance, as in `Page<Order>` given
	// `instance <T> Auditable<Page<T>> requires Auditable<T>`.
	//
	// `Page` alone satisfies nothing, so these cannot be listed in decls.
	Types []*ID `protobuf:"bytes,3,rep,name=types" json:"types,omitempty"` // indexes Model.types
	// contains filtered or unexported fields
}

Satisfaction is the computed answer to "what satisfies this class", closed over the classes a class requires.

A backend applying a class-scoped target directive reads this instead of reasoning about instances.

func (*Satisfaction) Descriptor deprecated

func (*Satisfaction) Descriptor() ([]byte, []int)

Deprecated: Use Satisfaction.ProtoReflect.Descriptor instead.

func (*Satisfaction) GetClass

func (x *Satisfaction) GetClass() *ID

func (*Satisfaction) GetDecls

func (x *Satisfaction) GetDecls() []*ID

func (*Satisfaction) GetTypes

func (x *Satisfaction) GetTypes() []*ID

func (*Satisfaction) ProtoMessage

func (*Satisfaction) ProtoMessage()

func (*Satisfaction) ProtoReflect

func (x *Satisfaction) ProtoReflect() protoreflect.Message

func (*Satisfaction) Reset

func (x *Satisfaction) Reset()

func (*Satisfaction) String

func (x *Satisfaction) String() string

type Struct

type Struct struct {
	Kind        StructKind  `protobuf:"varint,1,opt,name=kind,enum=tdl.ir.v1.StructKind" json:"kind,omitempty"`
	Params      []*Param    `protobuf:"bytes,2,rep,name=params" json:"params,omitempty"`
	Fields      []*Field    `protobuf:"bytes,3,rep,name=fields" json:"fields,omitempty"`
	Conforms    []*ClassRef `protobuf:"bytes,4,rep,name=conforms" json:"conforms,omitempty"`       // classes this declaration says it satisfies
	Constraints []*ClassRef `protobuf:"bytes,5,rep,name=constraints" json:"constraints,omitempty"` // the `requires` clause on its parameters
	// contains filtered or unexported fields
}

Struct is an entity, a value, or a mixin.

func (*Struct) Descriptor deprecated

func (*Struct) Descriptor() ([]byte, []int)

Deprecated: Use Struct.ProtoReflect.Descriptor instead.

func (*Struct) GetConforms

func (x *Struct) GetConforms() []*ClassRef

func (*Struct) GetConstraints

func (x *Struct) GetConstraints() []*ClassRef

func (*Struct) GetFields

func (x *Struct) GetFields() []*Field

func (*Struct) GetKind

func (x *Struct) GetKind() StructKind

func (*Struct) GetParams

func (x *Struct) GetParams() []*Param

func (*Struct) ProtoMessage

func (*Struct) ProtoMessage()

func (*Struct) ProtoReflect

func (x *Struct) ProtoReflect() protoreflect.Message

func (*Struct) Reset

func (x *Struct) Reset()

func (*Struct) String

func (x *Struct) String() string

type StructKind

type StructKind int32

StructKind distinguishes the three declarations that share a body. The compiler computes it: MIXIN for a mixin, ENTITY for any other struct satisfying std.Entity, and VALUE for the rest.

const (
	StructKind_STRUCT_KIND_UNSPECIFIED StructKind = 0
	StructKind_STRUCT_KIND_ENTITY      StructKind = 1 // identity that survives changes to its contents
	StructKind_STRUCT_KIND_VALUE       StructKind = 2 // defined entirely by its contents
	StructKind_STRUCT_KIND_MIXIN       StructKind = 3 // reuse, copied into the including declaration
)

func (StructKind) Descriptor

func (StructKind) Descriptor() protoreflect.EnumDescriptor

func (StructKind) Enum

func (x StructKind) Enum() *StructKind

func (StructKind) EnumDescriptor deprecated

func (StructKind) EnumDescriptor() ([]byte, []int)

Deprecated: Use StructKind.Descriptor instead.

func (StructKind) Number

func (x StructKind) Number() protoreflect.EnumNumber

func (StructKind) String

func (x StructKind) String() string

func (StructKind) Type

type SyntacticForm

type SyntacticForm int32

SyntacticForm records how a type reference was written.

The form is advisory: `[T]` is `List<T>` and `T?` is `Option<T>` regardless. A backend may use it to emit `*T` for `T?` and a wrapper for an explicit `Option<T>`.

const (
	SyntacticForm_SYNTACTIC_FORM_UNSPECIFIED SyntacticForm = 0
	SyntacticForm_SYNTACTIC_FORM_NAMED       SyntacticForm = 1 // User, List<T>
	SyntacticForm_SYNTACTIC_FORM_BRACKETS    SyntacticForm = 2 // [T]
	SyntacticForm_SYNTACTIC_FORM_BRACES      SyntacticForm = 3 // {T}
	SyntacticForm_SYNTACTIC_FORM_ARROW       SyntacticForm = 4 // {K -> V}
	SyntacticForm_SYNTACTIC_FORM_QUESTION    SyntacticForm = 5 // T?
	SyntacticForm_SYNTACTIC_FORM_OR_NULL     SyntacticForm = 6 // T | null
)

func (SyntacticForm) Descriptor

func (SyntacticForm) Enum

func (x SyntacticForm) Enum() *SyntacticForm

func (SyntacticForm) EnumDescriptor deprecated

func (SyntacticForm) EnumDescriptor() ([]byte, []int)

Deprecated: Use SyntacticForm.Descriptor instead.

func (SyntacticForm) Number

func (SyntacticForm) String

func (x SyntacticForm) String() string

func (SyntacticForm) Type

type TargetBlock

type TargetBlock struct {
	Meta       *Meta        `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"` // name is the target name, such as "go"
	ForPackage string       `protobuf:"bytes,2,opt,name=for_package,json=forPackage" json:"for_package,omitempty"`
	Directives []*Directive `protobuf:"bytes,3,rep,name=directives" json:"directives,omitempty"`
	// contains filtered or unexported fields
}

TargetBlock is one `target go for billing { ... }` block.

Resolved directives are attached to the nodes they apply to. This holds only the directives that apply to the package as a whole.

func (*TargetBlock) Descriptor deprecated

func (*TargetBlock) Descriptor() ([]byte, []int)

Deprecated: Use TargetBlock.ProtoReflect.Descriptor instead.

func (*TargetBlock) GetDirectives

func (x *TargetBlock) GetDirectives() []*Directive

func (*TargetBlock) GetForPackage

func (x *TargetBlock) GetForPackage() string

func (*TargetBlock) GetMeta

func (x *TargetBlock) GetMeta() *Meta

func (*TargetBlock) ProtoMessage

func (*TargetBlock) ProtoMessage()

func (*TargetBlock) ProtoReflect

func (x *TargetBlock) ProtoReflect() protoreflect.Message

func (*TargetBlock) Reset

func (x *TargetBlock) Reset()

func (*TargetBlock) String

func (x *TargetBlock) String() string

type Type

type Type struct {
	Ctor     *ID           `protobuf:"bytes,1,opt,name=ctor" json:"ctor,omitempty"` // indexes Model.decls; unset when param or extern is set
	Args     []*ID         `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` // indexes Model.types
	Wrote    SyntacticForm `protobuf:"varint,3,opt,name=wrote,enum=tdl.ir.v1.SyntacticForm" json:"wrote,omitempty"`
	Position *Position     `protobuf:"bytes,4,opt,name=position" json:"position,omitempty"`
	Param    *ParamRef     `protobuf:"bytes,5,opt,name=param" json:"param,omitempty"`   // set instead of ctor for a type parameter
	Extern   *ID           `protobuf:"bytes,6,opt,name=extern" json:"extern,omitempty"` // set instead of ctor; indexes Model.externs
	Unit     *ID           `protobuf:"bytes,7,opt,name=unit" json:"unit,omitempty"`     // set instead of ctor; indexes Model.units
	// contains filtered or unexported fields
}

Type is one interned type reference: a constructor applied to arguments, or a reference to a type parameter.

Equal types share an entry, so comparing IDs compares types.

func (*Type) Descriptor deprecated

func (*Type) Descriptor() ([]byte, []int)

Deprecated: Use Type.ProtoReflect.Descriptor instead.

func (*Type) GetArgs

func (x *Type) GetArgs() []*ID

func (*Type) GetCtor

func (x *Type) GetCtor() *ID

func (*Type) GetExtern

func (x *Type) GetExtern() *ID

func (*Type) GetParam

func (x *Type) GetParam() *ParamRef

func (*Type) GetPosition

func (x *Type) GetPosition() *Position

func (*Type) GetUnit added in v0.1.4

func (x *Type) GetUnit() *ID

func (*Type) GetWrote

func (x *Type) GetWrote() SyntacticForm

func (*Type) ProtoMessage

func (*Type) ProtoMessage()

func (*Type) ProtoReflect

func (x *Type) ProtoReflect() protoreflect.Message

func (*Type) Reset

func (x *Type) Reset()

func (*Type) String

func (x *Type) String() string

type Unit added in v0.1.4

type Unit struct {
	Dims     []*Dimension `protobuf:"bytes,1,rep,name=dims" json:"dims,omitempty"`
	Decl     *ID          `protobuf:"bytes,2,opt,name=decl" json:"decl,omitempty"`   // the UnitDef first naming this quantity; unset for a bare expression
	Wrote    string       `protobuf:"bytes,3,opt,name=wrote" json:"wrote,omitempty"` // the source text, as written
	Position *Position    `protobuf:"bytes,4,opt,name=position" json:"position,omitempty"`
	// contains filtered or unexported fields
}

Unit is a quantity reduced to base dimensions.

A unit is interned on `dims` alone, so decimal<N> and decimal<kg*m/s^2> reach one entry. `decl` and `wrote` record the first spelling and take no part in identity.

`dims` is sorted by base index with zero exponents removed.

func (*Unit) Descriptor deprecated added in v0.1.4

func (*Unit) Descriptor() ([]byte, []int)

Deprecated: Use Unit.ProtoReflect.Descriptor instead.

func (*Unit) GetDecl added in v0.1.4

func (x *Unit) GetDecl() *ID

func (*Unit) GetDims added in v0.1.4

func (x *Unit) GetDims() []*Dimension

func (*Unit) GetPosition added in v0.1.4

func (x *Unit) GetPosition() *Position

func (*Unit) GetWrote added in v0.1.4

func (x *Unit) GetWrote() string

func (*Unit) ProtoMessage added in v0.1.4

func (*Unit) ProtoMessage()

func (*Unit) ProtoReflect added in v0.1.4

func (x *Unit) ProtoReflect() protoreflect.Message

func (*Unit) Reset added in v0.1.4

func (x *Unit) Reset()

func (*Unit) String added in v0.1.4

func (x *Unit) String() string

type UnitDef added in v0.1.4

type UnitDef struct {
	Unit *ID  `protobuf:"bytes,1,opt,name=unit" json:"unit,omitempty"`  // indexes Model.units
	Base bool `protobuf:"varint,2,opt,name=base" json:"base,omitempty"` // written without an expression
	// contains filtered or unexported fields
}

UnitDef is a `unit kg` or `unit N = kg*m/s^2` declaration.

This is the name the source gave; `unit` points at the entry in Model.units that says what it measures.

func (*UnitDef) Descriptor deprecated added in v0.1.4

func (*UnitDef) Descriptor() ([]byte, []int)

Deprecated: Use UnitDef.ProtoReflect.Descriptor instead.

func (*UnitDef) GetBase added in v0.1.4

func (x *UnitDef) GetBase() bool

func (*UnitDef) GetUnit added in v0.1.4

func (x *UnitDef) GetUnit() *ID

func (*UnitDef) ProtoMessage added in v0.1.4

func (*UnitDef) ProtoMessage()

func (*UnitDef) ProtoReflect added in v0.1.4

func (x *UnitDef) ProtoReflect() protoreflect.Message

func (*UnitDef) Reset added in v0.1.4

func (x *UnitDef) Reset()

func (*UnitDef) String added in v0.1.4

func (x *UnitDef) String() string

type Variant

type Variant struct {
	Meta       *Meta        `protobuf:"bytes,1,opt,name=meta" json:"meta,omitempty"`
	Fields     []*Field     `protobuf:"bytes,2,rep,name=fields" json:"fields,omitempty"`
	Directives []*Directive `protobuf:"bytes,3,rep,name=directives" json:"directives,omitempty"` // resolved from every target block, tagged with the block
	// contains filtered or unexported fields
}

Variant is one alternative in an Enum.

func (*Variant) Descriptor deprecated

func (*Variant) Descriptor() ([]byte, []int)

Deprecated: Use Variant.ProtoReflect.Descriptor instead.

func (*Variant) GetDirectives added in v0.2.1

func (x *Variant) GetDirectives() []*Directive

func (*Variant) GetFields

func (x *Variant) GetFields() []*Field

func (*Variant) GetMeta

func (x *Variant) GetMeta() *Meta

func (*Variant) ProtoMessage

func (*Variant) ProtoMessage()

func (*Variant) ProtoReflect

func (x *Variant) ProtoReflect() protoreflect.Message

func (*Variant) Reset

func (x *Variant) Reset()

func (*Variant) String

func (x *Variant) String() string

Jump to

Keyboard shortcuts

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