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
- Variables
- func Dump(m *Model) string
- func KindName(k LiteralKind) string
- type Alias
- type AssocBind
- func (*AssocBind) Descriptor() ([]byte, []int)deprecated
- func (x *AssocBind) GetName() string
- func (x *AssocBind) GetPosition() *Position
- func (x *AssocBind) GetType() *ID
- func (*AssocBind) ProtoMessage()
- func (x *AssocBind) ProtoReflect() protoreflect.Message
- func (x *AssocBind) Reset()
- func (x *AssocBind) String() string
- type AssocType
- type Class
- func (*Class) Descriptor() ([]byte, []int)deprecated
- func (x *Class) GetAssocTypes() []*AssocType
- func (x *Class) GetConstraints() []*ClassRef
- func (x *Class) GetFields() []*Field
- func (x *Class) GetFunDeps() []*FunDep
- func (x *Class) GetParams() []*Param
- func (x *Class) GetRequiresClasses() []*ClassRef
- func (*Class) ProtoMessage()
- func (x *Class) ProtoReflect() protoreflect.Message
- func (x *Class) Reset()
- func (x *Class) String() string
- type ClassRef
- func (*ClassRef) Descriptor() ([]byte, []int)deprecated
- func (x *ClassRef) GetArgs() []*ID
- func (x *ClassRef) GetClass() *ID
- func (x *ClassRef) GetExtern() *ID
- func (x *ClassRef) GetPosition() *Position
- func (*ClassRef) ProtoMessage()
- func (x *ClassRef) ProtoReflect() protoreflect.Message
- func (x *ClassRef) Reset()
- func (x *ClassRef) String() string
- type Constraint
- func (*Constraint) Descriptor() ([]byte, []int)deprecated
- func (x *Constraint) GetArgs() []*Literal
- func (x *Constraint) GetFrom() *ID
- func (x *Constraint) GetName() string
- func (x *Constraint) GetPosition() *Position
- func (*Constraint) ProtoMessage()
- func (x *Constraint) ProtoReflect() protoreflect.Message
- func (x *Constraint) Reset()
- func (x *Constraint) String() string
- type Decl
- func (d *Decl) Constraints() []*ClassRef
- func (*Decl) Descriptor() ([]byte, []int)deprecated
- func (d *Decl) Fields() []*Field
- func (x *Decl) GetAlias() *Alias
- func (x *Decl) GetClass() *Class
- func (x *Decl) GetDirectives() []*Directive
- func (x *Decl) GetEnumeration() *Enum
- func (x *Decl) GetMeta() *Meta
- func (x *Decl) GetNewtype() *Newtype
- func (x *Decl) GetNode() isDecl_Node
- func (x *Decl) GetPrimitive() *Primitive
- func (x *Decl) GetStructure() *Struct
- func (x *Decl) GetUnit() *UnitDef
- func (d *Decl) Params() []*Param
- func (*Decl) ProtoMessage()
- func (x *Decl) ProtoReflect() protoreflect.Message
- func (x *Decl) Reset()
- func (x *Decl) String() string
- type Decl_Alias
- type Decl_Class
- type Decl_Enumeration
- type Decl_Newtype
- type Decl_Primitive
- type Decl_Structure
- type Decl_Unit
- type Deprecation
- func (*Deprecation) Descriptor() ([]byte, []int)deprecated
- func (x *Deprecation) GetPosition() *Position
- func (x *Deprecation) GetReason() string
- func (*Deprecation) ProtoMessage()
- func (x *Deprecation) ProtoReflect() protoreflect.Message
- func (x *Deprecation) Reset()
- func (x *Deprecation) String() string
- type Dimension
- type Directive
- func (*Directive) Descriptor() ([]byte, []int)deprecated
- func (x *Directive) GetArgs() []*Literal
- func (x *Directive) GetFromClass() *ID
- func (x *Directive) GetName() string
- func (x *Directive) GetPosition() *Position
- func (x *Directive) GetTarget() string
- func (*Directive) ProtoMessage()
- func (x *Directive) ProtoReflect() protoreflect.Message
- func (x *Directive) Reset()
- func (x *Directive) String() string
- type Enum
- func (*Enum) Descriptor() ([]byte, []int)deprecated
- func (x *Enum) GetConforms() []*ClassRef
- func (x *Enum) GetConstraints() []*ClassRef
- func (x *Enum) GetParams() []*Param
- func (x *Enum) GetVariants() []*Variant
- func (*Enum) ProtoMessage()
- func (x *Enum) ProtoReflect() protoreflect.Message
- func (x *Enum) Reset()
- func (x *Enum) String() string
- type Extern
- func (*Extern) Descriptor() ([]byte, []int)deprecated
- func (x *Extern) GetDirectives() []*Directive
- func (x *Extern) GetName() string
- func (x *Extern) GetPackage() string
- func (x *Extern) GetPosition() *Position
- func (*Extern) ProtoMessage()
- func (x *Extern) ProtoReflect() protoreflect.Message
- func (x *Extern) Reset()
- func (x *Extern) String() string
- type Field
- func (*Field) Descriptor() ([]byte, []int)deprecated
- func (x *Field) GetConstraints() []*Constraint
- func (x *Field) GetDefaultValue() *Literal
- func (x *Field) GetDirectives() []*Directive
- func (x *Field) GetIncludedFrom() *ID
- func (x *Field) GetMeta() *Meta
- func (x *Field) GetOwned() bool
- func (x *Field) GetType() *ID
- func (*Field) ProtoMessage()
- func (x *Field) ProtoReflect() protoreflect.Message
- func (x *Field) Reset()
- func (x *Field) String() string
- type FunDep
- func (*FunDep) Descriptor() ([]byte, []int)deprecated
- func (x *FunDep) GetFrom() []string
- func (x *FunDep) GetPosition() *Position
- func (x *FunDep) GetTo() []string
- func (*FunDep) ProtoMessage()
- func (x *FunDep) ProtoReflect() protoreflect.Message
- func (x *FunDep) Reset()
- func (x *FunDep) String() string
- type ID
- type Import
- func (*Import) Descriptor() ([]byte, []int)deprecated
- func (x *Import) GetAlias() string
- func (x *Import) GetDirectives() []*Directive
- func (x *Import) GetPackage() string
- func (x *Import) GetPath() string
- func (x *Import) GetPosition() *Position
- func (*Import) ProtoMessage()
- func (x *Import) ProtoReflect() protoreflect.Message
- func (x *Import) Reset()
- func (x *Import) String() string
- type Instance
- func (*Instance) Descriptor() ([]byte, []int)deprecated
- func (x *Instance) GetBinds() []*AssocBind
- func (x *Instance) GetClass() *ClassRef
- func (x *Instance) GetMeta() *Meta
- func (x *Instance) GetParams() []*Param
- func (x *Instance) GetRequires() []*ClassRef
- func (*Instance) ProtoMessage()
- func (x *Instance) ProtoReflect() protoreflect.Message
- func (x *Instance) Reset()
- func (x *Instance) String() string
- type Kind
- type KindAtom
- type Literal
- func (*Literal) Descriptor() ([]byte, []int)deprecated
- func (x *Literal) GetItems() []*Literal
- func (x *Literal) GetKind() LiteralKind
- func (x *Literal) GetPosition() *Position
- func (x *Literal) GetRange() *Range
- func (x *Literal) GetText() string
- func (x *Literal) GetVariant() *ID
- func (*Literal) ProtoMessage()
- func (x *Literal) ProtoReflect() protoreflect.Message
- func (x *Literal) Reset()
- func (x *Literal) String() string
- type LiteralKind
- func (LiteralKind) Descriptor() protoreflect.EnumDescriptor
- func (x LiteralKind) Enum() *LiteralKind
- func (LiteralKind) EnumDescriptor() ([]byte, []int)deprecated
- func (x LiteralKind) Number() protoreflect.EnumNumber
- func (x LiteralKind) String() string
- func (LiteralKind) Type() protoreflect.EnumType
- type Meta
- func (*Meta) Descriptor() ([]byte, []int)deprecated
- func (x *Meta) GetDeprecated() *Deprecation
- func (x *Meta) GetDoc() []string
- func (x *Meta) GetName() string
- func (x *Meta) GetOrder() int32
- func (x *Meta) GetPosition() *Position
- func (m *Meta) IsDeprecated() bool
- func (*Meta) ProtoMessage()
- func (x *Meta) ProtoReflect() protoreflect.Message
- func (x *Meta) Reset()
- func (x *Meta) String() string
- type Model
- func (x *Model) Decl(id *ID) *Decl
- func (*Model) Descriptor() ([]byte, []int)deprecated
- func (x *Model) FindDecl(name string) (*Decl, *ID, bool)
- func (x *Model) GetDecls() []*Decl
- func (x *Model) GetExterns() []*Extern
- func (x *Model) GetImports() []*Import
- func (x *Model) GetInstances() []*Instance
- func (x *Model) GetPackage() string
- func (x *Model) GetSatisfies() []*Satisfaction
- func (x *Model) GetTargets() []*TargetBlock
- func (x *Model) GetTypes() []*Type
- func (x *Model) GetUnits() []*Unit
- func (*Model) ProtoMessage()
- func (x *Model) ProtoReflect() protoreflect.Message
- func (x *Model) Reset()
- func (x *Model) Satisfying(class *ID) []*ID
- func (x *Model) SatisfyingTypes(class *ID) []*ID
- func (x *Model) String() string
- func (x *Model) Type(id *ID) *Type
- func (x *Model) Unit(id *ID) *Unit
- type Newtype
- func (*Newtype) Descriptor() ([]byte, []int)deprecated
- func (x *Newtype) GetBase() *ID
- func (x *Newtype) GetConstraints() []*ClassRef
- func (x *Newtype) GetParams() []*Param
- func (x *Newtype) GetValueConstraints() []*Constraint
- func (*Newtype) ProtoMessage()
- func (x *Newtype) ProtoReflect() protoreflect.Message
- func (x *Newtype) Reset()
- func (x *Newtype) String() string
- type Param
- type ParamRef
- func (*ParamRef) Descriptor() ([]byte, []int)deprecated
- func (x *ParamRef) GetIndex() int32
- func (x *ParamRef) GetName() string
- func (x *ParamRef) GetOwner() *ID
- func (*ParamRef) ProtoMessage()
- func (x *ParamRef) ProtoReflect() protoreflect.Message
- func (x *ParamRef) Reset()
- func (x *ParamRef) String() string
- type Position
- func (*Position) Descriptor() ([]byte, []int)deprecated
- func (x *Position) GetColumn() int32
- func (x *Position) GetFilename() string
- func (x *Position) GetLine() int32
- func (*Position) ProtoMessage()
- func (x *Position) ProtoReflect() protoreflect.Message
- func (x *Position) Reset()
- func (x *Position) String() string
- type Primitive
- type Range
- type Satisfaction
- func (*Satisfaction) Descriptor() ([]byte, []int)deprecated
- func (x *Satisfaction) GetClass() *ID
- func (x *Satisfaction) GetDecls() []*ID
- func (x *Satisfaction) GetTypes() []*ID
- func (*Satisfaction) ProtoMessage()
- func (x *Satisfaction) ProtoReflect() protoreflect.Message
- func (x *Satisfaction) Reset()
- func (x *Satisfaction) String() string
- type Struct
- func (*Struct) Descriptor() ([]byte, []int)deprecated
- func (x *Struct) GetConforms() []*ClassRef
- func (x *Struct) GetConstraints() []*ClassRef
- func (x *Struct) GetFields() []*Field
- func (x *Struct) GetKind() StructKind
- func (x *Struct) GetParams() []*Param
- func (*Struct) ProtoMessage()
- func (x *Struct) ProtoReflect() protoreflect.Message
- func (x *Struct) Reset()
- func (x *Struct) String() string
- type StructKind
- type SyntacticForm
- func (SyntacticForm) Descriptor() protoreflect.EnumDescriptor
- func (x SyntacticForm) Enum() *SyntacticForm
- func (SyntacticForm) EnumDescriptor() ([]byte, []int)deprecated
- func (x SyntacticForm) Number() protoreflect.EnumNumber
- func (x SyntacticForm) String() string
- func (SyntacticForm) Type() protoreflect.EnumType
- type TargetBlock
- func (*TargetBlock) Descriptor() ([]byte, []int)deprecated
- func (x *TargetBlock) GetDirectives() []*Directive
- func (x *TargetBlock) GetForPackage() string
- func (x *TargetBlock) GetMeta() *Meta
- func (*TargetBlock) ProtoMessage()
- func (x *TargetBlock) ProtoReflect() protoreflect.Message
- func (x *TargetBlock) Reset()
- func (x *TargetBlock) String() string
- type Type
- func (*Type) Descriptor() ([]byte, []int)deprecated
- func (x *Type) GetArgs() []*ID
- func (x *Type) GetCtor() *ID
- func (x *Type) GetExtern() *ID
- func (x *Type) GetParam() *ParamRef
- func (x *Type) GetPosition() *Position
- func (x *Type) GetUnit() *ID
- func (x *Type) GetWrote() SyntacticForm
- func (*Type) ProtoMessage()
- func (x *Type) ProtoReflect() protoreflect.Message
- func (x *Type) Reset()
- func (x *Type) String() string
- type Unit
- func (*Unit) Descriptor() ([]byte, []int)deprecated
- func (x *Unit) GetDecl() *ID
- func (x *Unit) GetDims() []*Dimension
- func (x *Unit) GetPosition() *Position
- func (x *Unit) GetWrote() string
- func (*Unit) ProtoMessage()
- func (x *Unit) ProtoReflect() protoreflect.Message
- func (x *Unit) Reset()
- func (x *Unit) String() string
- type UnitDef
- type Variant
- func (*Variant) Descriptor() ([]byte, []int)deprecated
- func (x *Variant) GetDirectives() []*Directive
- func (x *Variant) GetFields() []*Field
- func (x *Variant) GetMeta() *Meta
- func (*Variant) ProtoMessage()
- func (x *Variant) ProtoReflect() protoreflect.Message
- func (x *Variant) Reset()
- func (x *Variant) String() string
Constants ¶
const Unresolved = -1
Unresolved is the index an ID carries when its name did not resolve. The ID keeps the name as written.
Variables ¶
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.
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.
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.
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.
var File_tdl_ir_v1_ir_proto protoreflect.FileDescriptor
Functions ¶
func Dump ¶
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) ProtoMessage ¶
func (*Alias) ProtoMessage()
func (*Alias) ProtoReflect ¶
func (x *Alias) ProtoReflect() protoreflect.Message
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) GetPosition ¶
func (*AssocBind) ProtoMessage ¶
func (*AssocBind) ProtoMessage()
func (*AssocBind) ProtoReflect ¶
func (x *AssocBind) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*AssocType) ProtoMessage()
func (*AssocType) ProtoReflect ¶
func (x *AssocType) ProtoReflect() protoreflect.Message
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) GetAssocTypes ¶
func (*Class) GetConstraints ¶
func (*Class) GetFunDeps ¶
func (*Class) GetRequiresClasses ¶
func (*Class) ProtoMessage ¶
func (*Class) ProtoMessage()
func (*Class) ProtoReflect ¶
func (x *Class) ProtoReflect() protoreflect.Message
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) GetPosition ¶
func (*ClassRef) ProtoMessage ¶
func (*ClassRef) ProtoMessage()
func (*ClassRef) ProtoReflect ¶
func (x *ClassRef) ProtoReflect() protoreflect.Message
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
Constraints returns the `requires` clause on a declaration's type parameters, or nil.
func (*Decl) Descriptor
deprecated
func (*Decl) Fields ¶
Fields returns a struct declaration's fields, or nil. An enum's fields belong to its variants.
func (*Decl) GetDirectives ¶
func (*Decl) GetEnumeration ¶
func (*Decl) GetNewtype ¶
func (*Decl) GetPrimitive ¶
func (*Decl) GetStructure ¶
func (*Decl) ProtoMessage ¶
func (*Decl) ProtoMessage()
func (*Decl) ProtoReflect ¶
func (x *Decl) ProtoReflect() protoreflect.Message
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) GetExponent ¶ added in v0.1.4
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
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) GetFromClass ¶
func (*Directive) GetPosition ¶
func (*Directive) ProtoMessage ¶
func (*Directive) ProtoMessage()
func (*Directive) ProtoReflect ¶
func (x *Directive) ProtoReflect() protoreflect.Message
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) GetConforms ¶
func (*Enum) GetConstraints ¶
func (*Enum) GetVariants ¶
func (*Enum) ProtoMessage ¶
func (*Enum) ProtoMessage()
func (*Enum) ProtoReflect ¶
func (x *Enum) ProtoReflect() protoreflect.Message
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) GetDirectives ¶ added in v0.2.11
func (*Extern) GetPackage ¶
func (*Extern) GetPosition ¶
func (*Extern) ProtoMessage ¶
func (*Extern) ProtoMessage()
func (*Extern) ProtoReflect ¶
func (x *Extern) ProtoReflect() protoreflect.Message
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) GetConstraints ¶
func (x *Field) GetConstraints() []*Constraint
func (*Field) GetDefaultValue ¶
func (*Field) GetDirectives ¶
func (*Field) GetIncludedFrom ¶
func (*Field) ProtoMessage ¶
func (*Field) ProtoMessage()
func (*Field) ProtoReflect ¶
func (x *Field) ProtoReflect() protoreflect.Message
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) GetPosition ¶
func (*FunDep) ProtoMessage ¶
func (*FunDep) ProtoMessage()
func (*FunDep) ProtoReflect ¶
func (x *FunDep) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*ID) ProtoMessage()
func (*ID) ProtoReflect ¶
func (x *ID) ProtoReflect() protoreflect.Message
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) GetDirectives ¶ added in v0.2.11
func (*Import) GetPackage ¶
func (*Import) GetPosition ¶
func (*Import) ProtoMessage ¶
func (*Import) ProtoMessage()
func (*Import) ProtoReflect ¶
func (x *Import) ProtoReflect() protoreflect.Message
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) GetRequires ¶
func (*Instance) ProtoMessage ¶
func (*Instance) ProtoMessage()
func (*Instance) ProtoReflect ¶
func (x *Instance) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*Kind) ProtoMessage()
func (*Kind) ProtoReflect ¶
func (x *Kind) ProtoReflect() protoreflect.Message
type KindAtom ¶
type KindAtom int32
KindAtom is a base kind.
func (KindAtom) Descriptor ¶
func (KindAtom) Descriptor() protoreflect.EnumDescriptor
func (KindAtom) EnumDescriptor
deprecated
func (KindAtom) Number ¶
func (x KindAtom) Number() protoreflect.EnumNumber
func (KindAtom) Type ¶
func (KindAtom) Type() protoreflect.EnumType
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) GetKind ¶
func (x *Literal) GetKind() LiteralKind
func (*Literal) GetPosition ¶
func (*Literal) GetVariant ¶
func (*Literal) ProtoMessage ¶
func (*Literal) ProtoMessage()
func (*Literal) ProtoReflect ¶
func (x *Literal) ProtoReflect() protoreflect.Message
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) Descriptor() protoreflect.EnumDescriptor
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 ¶
func (LiteralKind) Type() protoreflect.EnumType
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) GetDeprecated ¶
func (x *Meta) GetDeprecated() *Deprecation
func (*Meta) GetPosition ¶
func (*Meta) IsDeprecated ¶
IsDeprecated reports whether the node is marked deprecated.
func (*Meta) ProtoMessage ¶
func (*Meta) ProtoMessage()
func (*Meta) ProtoReflect ¶
func (x *Meta) ProtoReflect() protoreflect.Message
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 ¶
Decl returns the declaration id references, or nil if it does not resolve to one.
func (*Model) Descriptor
deprecated
func (*Model) FindDecl ¶
FindDecl returns the declaration with the given fully qualified name and its ID, reporting false when there is none.
func (*Model) GetExterns ¶
func (*Model) GetImports ¶
func (*Model) GetInstances ¶
func (*Model) GetPackage ¶
func (*Model) GetSatisfies ¶
func (x *Model) GetSatisfies() []*Satisfaction
func (*Model) GetTargets ¶
func (x *Model) GetTargets() []*TargetBlock
func (*Model) ProtoMessage ¶
func (*Model) ProtoMessage()
func (*Model) ProtoReflect ¶
func (x *Model) ProtoReflect() protoreflect.Message
func (*Model) Satisfying ¶
Satisfying returns the declarations in this model satisfying a class, closed over the classes that class requires.
func (*Model) SatisfyingTypes ¶
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>`.
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) GetConstraints ¶
func (*Newtype) GetValueConstraints ¶
func (x *Newtype) GetValueConstraints() []*Constraint
func (*Newtype) ProtoMessage ¶
func (*Newtype) ProtoMessage()
func (*Newtype) ProtoReflect ¶
func (x *Newtype) ProtoReflect() protoreflect.Message
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) GetPosition ¶
func (*Param) ProtoMessage ¶
func (*Param) ProtoMessage()
func (*Param) ProtoReflect ¶
func (x *Param) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*ParamRef) ProtoMessage()
func (*ParamRef) ProtoReflect ¶
func (x *ParamRef) ProtoReflect() protoreflect.Message
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) GetFilename ¶
func (*Position) ProtoMessage ¶
func (*Position) ProtoMessage()
func (*Position) ProtoReflect ¶
func (x *Position) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*Primitive) ProtoMessage()
func (*Primitive) ProtoReflect ¶
func (x *Primitive) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*Range) ProtoMessage()
func (*Range) ProtoReflect ¶
func (x *Range) ProtoReflect() protoreflect.Message
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) GetConforms ¶
func (*Struct) GetConstraints ¶
func (*Struct) GetKind ¶
func (x *Struct) GetKind() StructKind
func (*Struct) ProtoMessage ¶
func (*Struct) ProtoMessage()
func (*Struct) ProtoReflect ¶
func (x *Struct) ProtoReflect() protoreflect.Message
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 ¶
func (StructKind) Type() protoreflect.EnumType
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) Descriptor() protoreflect.EnumDescriptor
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 (x SyntacticForm) Number() protoreflect.EnumNumber
func (SyntacticForm) String ¶
func (x SyntacticForm) String() string
func (SyntacticForm) Type ¶
func (SyntacticForm) Type() protoreflect.EnumType
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) GetPosition ¶
func (*Type) GetWrote ¶
func (x *Type) GetWrote() SyntacticForm
func (*Type) ProtoMessage ¶
func (*Type) ProtoMessage()
func (*Type) ProtoReflect ¶
func (x *Type) ProtoReflect() protoreflect.Message
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) GetPosition ¶ added in v0.1.4
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
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) ProtoMessage ¶ added in v0.1.4
func (*UnitDef) ProtoMessage()
func (*UnitDef) ProtoReflect ¶ added in v0.1.4
func (x *UnitDef) ProtoReflect() protoreflect.Message
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) GetDirectives ¶ added in v0.2.1
func (*Variant) ProtoMessage ¶
func (*Variant) ProtoMessage()
func (*Variant) ProtoReflect ¶
func (x *Variant) ProtoReflect() protoreflect.Message