semantic

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 17 Imported by: 21

Documentation

Overview

The semantic package provides a graph structure that represents the meaning of a Flux script. An AST is converted into a semantic graph for use with other systems. Using a semantic graph representation of the Flux, enables highlevel meaning to be specified programatically.

The semantic structures are to be designed to facilitate the interpretation and compilation of Flux.

For example since Flux uses the javascript AST structures, arguments to a function are represented as a single positional argument that is always an object expression. The semantic graph validates that the AST correctly follows these semantics, and use structures that are strongly typed for this expectation.

Index

Constants

View Source
const PackageMain = "main"

Variables

View Source
var EmptyArrayType = NewArrayType(Nil)

TODO(nathanielc): Make empty array types polymorphic over element type?

View Source
var EmptyObject = NewObjectType(nil)

Functions

func Formatted added in v0.50.0

func Formatted(n Node, opts ...FormatOption) fmt.Formatter

Formatted produces a Formatter object suitable for printing using the standard fmt package. Currently only works for some expressions.

func SortNodes added in v0.16.0

func SortNodes(nodes []Node)

SortNodes sorts a list of nodes by their source locations.

func Walk

func Walk(v Visitor, node Node)

Types

type Addable

type Addable struct{}

type Annotator

type Annotator struct {
	// contains filtered or unexported fields
}

Annotator implements Visitor to walk the graph.

func Annotate

func Annotate(node Node) Annotator

Annotate walks a graph and assigns each expression a type variable annotation.

func (Annotator) Done

func (v Annotator) Done(node Node)

func (Annotator) Visit

func (v Annotator) Visit(node Node) Visitor

type ArrayExpression

type ArrayExpression struct {
	Elements []Expression `json:"elements"`
	// contains filtered or unexported fields
}

func (*ArrayExpression) Copy

func (e *ArrayExpression) Copy() Node

func (*ArrayExpression) FromBuf added in v0.57.0

func (rcv *ArrayExpression) FromBuf(fb *fbsemantic.ArrayExpression) error

func (ArrayExpression) Location

func (l ArrayExpression) Location() ast.SourceLocation

func (*ArrayExpression) MarshalJSON

func (e *ArrayExpression) MarshalJSON() ([]byte, error)

func (*ArrayExpression) NodeType

func (*ArrayExpression) NodeType() string

func (*ArrayExpression) TypeOf added in v0.58.0

func (e *ArrayExpression) TypeOf() *types.MonoType

func (*ArrayExpression) UnmarshalJSON

func (e *ArrayExpression) UnmarshalJSON(data []byte) error

type Assignment added in v0.14.0

type Assignment interface {
	Statement
	// contains filtered or unexported methods
}

type BinaryExpression

type BinaryExpression struct {
	Operator ast.OperatorKind `json:"operator"`
	Left     Expression       `json:"left"`
	Right    Expression       `json:"right"`
	// contains filtered or unexported fields
}

func (*BinaryExpression) Copy

func (e *BinaryExpression) Copy() Node

func (*BinaryExpression) FromBuf added in v0.57.0

func (BinaryExpression) Location

func (l BinaryExpression) Location() ast.SourceLocation

func (*BinaryExpression) MarshalJSON

func (e *BinaryExpression) MarshalJSON() ([]byte, error)

func (*BinaryExpression) NodeType

func (*BinaryExpression) NodeType() string

func (*BinaryExpression) TypeOf added in v0.58.0

func (e *BinaryExpression) TypeOf() *types.MonoType

func (*BinaryExpression) UnmarshalJSON

func (e *BinaryExpression) UnmarshalJSON(data []byte) error

type Block added in v0.8.0

type Block struct {
	Body []Statement `json:"body"`
	// contains filtered or unexported fields
}

func (*Block) Copy added in v0.8.0

func (s *Block) Copy() Node

func (*Block) FromBuf added in v0.57.0

func (rcv *Block) FromBuf(fb *fbsemantic.Block) error

func (Block) Location added in v0.8.0

func (l Block) Location() ast.SourceLocation

func (*Block) MarshalJSON added in v0.8.0

func (s *Block) MarshalJSON() ([]byte, error)

func (*Block) NodeType added in v0.8.0

func (*Block) NodeType() string

func (*Block) ReturnStatement added in v0.8.0

func (s *Block) ReturnStatement() *ReturnStatement

func (*Block) UnmarshalJSON added in v0.8.0

func (s *Block) UnmarshalJSON(data []byte) error

type BooleanLiteral

type BooleanLiteral struct {
	Value bool `json:"value"`
	// contains filtered or unexported fields
}

func (*BooleanLiteral) Copy

func (l *BooleanLiteral) Copy() Node

func (*BooleanLiteral) FromBuf added in v0.57.0

func (rcv *BooleanLiteral) FromBuf(fb *fbsemantic.BooleanLiteral) error

func (BooleanLiteral) Location

func (l BooleanLiteral) Location() ast.SourceLocation

func (*BooleanLiteral) MarshalJSON

func (l *BooleanLiteral) MarshalJSON() ([]byte, error)

func (*BooleanLiteral) NodeType

func (*BooleanLiteral) NodeType() string

func (*BooleanLiteral) TypeOf added in v0.58.0

func (e *BooleanLiteral) TypeOf() *types.MonoType

type BuiltinStatement added in v0.14.0

type BuiltinStatement struct {
	ID *Identifier `json:"id"`
	// contains filtered or unexported fields
}

func (*BuiltinStatement) Copy added in v0.14.0

func (s *BuiltinStatement) Copy() Node

func (*BuiltinStatement) FromBuf added in v0.57.0

func (BuiltinStatement) Location added in v0.14.0

func (l BuiltinStatement) Location() ast.SourceLocation

func (*BuiltinStatement) MarshalJSON added in v0.14.0

func (s *BuiltinStatement) MarshalJSON() ([]byte, error)

func (*BuiltinStatement) NodeType added in v0.14.0

func (s *BuiltinStatement) NodeType() string

type CallExpression

type CallExpression struct {
	Callee    Expression        `json:"callee"`
	Arguments *ObjectExpression `json:"arguments"`
	Pipe      Expression        `json:"pipe,omitempty"`
	// contains filtered or unexported fields
}

func (*CallExpression) Copy

func (e *CallExpression) Copy() Node

func (*CallExpression) FromBuf added in v0.57.0

func (rcv *CallExpression) FromBuf(fb *fbsemantic.CallExpression) error

func (CallExpression) Location

func (l CallExpression) Location() ast.SourceLocation

func (*CallExpression) MarshalJSON

func (e *CallExpression) MarshalJSON() ([]byte, error)

func (*CallExpression) NodeType

func (*CallExpression) NodeType() string

func (*CallExpression) TypeOf added in v0.58.0

func (e *CallExpression) TypeOf() *types.MonoType

func (*CallExpression) UnmarshalJSON

func (e *CallExpression) UnmarshalJSON(data []byte) error

type Comparable

type Comparable struct{}

type ConditionalExpression

type ConditionalExpression struct {
	Test       Expression `json:"test"`
	Alternate  Expression `json:"alternate"`
	Consequent Expression `json:"consequent"`
	// contains filtered or unexported fields
}

func (*ConditionalExpression) Copy

func (e *ConditionalExpression) Copy() Node

func (*ConditionalExpression) FromBuf added in v0.57.0

func (ConditionalExpression) Location

func (l ConditionalExpression) Location() ast.SourceLocation

func (*ConditionalExpression) MarshalJSON

func (e *ConditionalExpression) MarshalJSON() ([]byte, error)

func (*ConditionalExpression) NodeType

func (*ConditionalExpression) NodeType() string

func (*ConditionalExpression) TypeOf added in v0.58.0

func (e *ConditionalExpression) TypeOf() *types.MonoType

func (*ConditionalExpression) UnmarshalJSON

func (e *ConditionalExpression) UnmarshalJSON(data []byte) error

type ConstraintGenerator

type ConstraintGenerator struct {
	// contains filtered or unexported fields
}

ConstraintGenerator implements NestingVisitor and generates constraints as it walks the graph.

func (ConstraintGenerator) Done

func (v ConstraintGenerator) Done(node Node)

Done visits nodes after all children of the node have been visited.

func (ConstraintGenerator) Nest

Nest nests the internal type environment to obey scoping rules.

func (ConstraintGenerator) Visit

func (v ConstraintGenerator) Visit(node Node) Visitor

Visit visits each node, the algorithm is depth first so nothing is performed in Visit except for an error check.

type Constraints

type Constraints struct {
	// contains filtered or unexported fields
}

Constraints is a set of constraints.

func GenerateConstraints

func GenerateConstraints(node Node, annotator Annotator, importer Importer) (*Constraints, error)

GenerateConstraints walks the graph and generates constraints between type vairables provided in the annotations.

func (*Constraints) AddKindConst

func (c *Constraints) AddKindConst(tv Tvar, k Kind)

func (*Constraints) AddTypeConst

func (c *Constraints) AddTypeConst(l, r PolyType, loc ast.SourceLocation)

func (*Constraints) Copy

func (c *Constraints) Copy() *Constraints

func (*Constraints) Instantiate

func (c *Constraints) Instantiate(s Scheme, loc ast.SourceLocation) (t PolyType)

Instantiate produces a new poly type where the free variables from the scheme have been made fresh. This way each new instantiation of a scheme is independent of the other but all have the same constraint structure.

func (*Constraints) String

func (c *Constraints) String() string

type DateTimeLiteral

type DateTimeLiteral struct {
	Value time.Time `json:"value"`
	// contains filtered or unexported fields
}

func (*DateTimeLiteral) Copy

func (l *DateTimeLiteral) Copy() Node

func (*DateTimeLiteral) FromBuf added in v0.57.0

func (rcv *DateTimeLiteral) FromBuf(fb *fbsemantic.DateTimeLiteral) error

func (DateTimeLiteral) Location

func (l DateTimeLiteral) Location() ast.SourceLocation

func (*DateTimeLiteral) MarshalJSON

func (l *DateTimeLiteral) MarshalJSON() ([]byte, error)

func (*DateTimeLiteral) NodeType

func (*DateTimeLiteral) NodeType() string

func (*DateTimeLiteral) TypeOf added in v0.58.0

func (e *DateTimeLiteral) TypeOf() *types.MonoType

type DurationLiteral

type DurationLiteral struct {
	Values []ast.Duration `json:"values"`
	// contains filtered or unexported fields
}

func (*DurationLiteral) Copy

func (l *DurationLiteral) Copy() Node

func (*DurationLiteral) FromBuf added in v0.57.0

func (rcv *DurationLiteral) FromBuf(fb *fbsemantic.DurationLiteral) error

func (DurationLiteral) Location

func (l DurationLiteral) Location() ast.SourceLocation

func (*DurationLiteral) MarshalJSON

func (l *DurationLiteral) MarshalJSON() ([]byte, error)

func (*DurationLiteral) NodeType

func (*DurationLiteral) NodeType() string

func (*DurationLiteral) TypeOf added in v0.58.0

func (e *DurationLiteral) TypeOf() *types.MonoType

type Env

type Env struct {
	// contains filtered or unexported fields
}

Env is a type environment mapping identifiers in scope to their type schemes.

func NewEnv

func NewEnv() *Env

func (*Env) LocalLookup

func (e *Env) LocalLookup(ident string) (Scheme, bool)

LocalLookup search for the identifier in the local scope only, it does not recurse to parents.

func (*Env) Lookup

func (e *Env) Lookup(ident string) (Scheme, bool)

Lookup searchs for the closest identifier in scope.

func (*Env) Nest

func (e *Env) Nest() *Env

Nest creates a child env.

func (*Env) RangeSet

func (e *Env) RangeSet(f func(k string, v Scheme) Scheme)

RangeSet updates the env recursing through parents.

func (*Env) Set

func (e *Env) Set(ident string, s Scheme)

Set writes the scheme to the scope with the identifier.

type Expression

type Expression interface {
	Node

	TypeOf() *types.MonoType
	// contains filtered or unexported methods
}

func ConjunctionsToExprSlice

func ConjunctionsToExprSlice(expr Expression) []Expression

ConjunctionsToExprSlice finds all children of AndOperators that are not themselves AndOperators, and returns them in a slice. If the root node of expr is not an AndOperator, just returns expr.

    AND
   /   \
  AND   r    =>   {p, q, r}
 /   \
p     q

func ExprsToConjunction

func ExprsToConjunction(exprs ...Expression) Expression

ExprsToConjunction accepts a variable number of expressions and ANDs them together into a single expression.

                     AND
                    /   \
{p, q, r}    =>    AND   r
                  /   \
                 p     q

func PartitionPredicates

func PartitionPredicates(expr Expression, partitionFn func(expression Expression) (bool, error)) (passExpr, failExpr Expression, err error)

PartitionPredicates accepts a predicate expression, separates it into components that have been logically ANDed together, and applies partitionFn to them. Returns two expressions: one AND tree of the expressions for which partitionFn returned true, and an AND tree of expressions for which partitionFn returned false.

Suppose partitonFn returns true for p and r, and false for q:

    AND           passExpr     failExpr
   /   \
  AND   r    =>     AND           q
 /   \             /   \
p     q           p     r

type ExpressionStatement

type ExpressionStatement struct {
	Expression Expression `json:"expression"`
	// contains filtered or unexported fields
}

func (*ExpressionStatement) Copy

func (s *ExpressionStatement) Copy() Node

func (*ExpressionStatement) FromBuf added in v0.57.0

func (ExpressionStatement) Location

func (l ExpressionStatement) Location() ast.SourceLocation

func (*ExpressionStatement) MarshalJSON

func (s *ExpressionStatement) MarshalJSON() ([]byte, error)

func (*ExpressionStatement) NodeType

func (*ExpressionStatement) NodeType() string

func (*ExpressionStatement) UnmarshalJSON

func (s *ExpressionStatement) UnmarshalJSON(data []byte) error

type Extern

type Extern struct {
	Assignments []*ExternalVariableAssignment `json:"assignments"`
	Block       *ExternBlock                  `json:"block"`
	// contains filtered or unexported fields
}

Extern is a node that represents a node with a set of external assignments defined.

func (*Extern) Copy

func (e *Extern) Copy() Node

func (*Extern) FromBuf added in v0.57.0

func (l *Extern) FromBuf(fb *fbsemantic.SourceLocation) error

func (Extern) Location

func (l Extern) Location() ast.SourceLocation

func (*Extern) MarshalJSON

func (e *Extern) MarshalJSON() ([]byte, error)

func (*Extern) NodeType

func (*Extern) NodeType() string

type ExternBlock

type ExternBlock struct {
	Node Node
	// contains filtered or unexported fields
}

ExternBlock is a node that represents a node with a set of external declarations defined.

func (*ExternBlock) Copy

func (e *ExternBlock) Copy() Node

func (*ExternBlock) FromBuf added in v0.57.0

func (l *ExternBlock) FromBuf(fb *fbsemantic.SourceLocation) error

func (ExternBlock) Location

func (l ExternBlock) Location() ast.SourceLocation

func (*ExternBlock) MarshalJSON

func (e *ExternBlock) MarshalJSON() ([]byte, error)

func (*ExternBlock) NodeType

func (*ExternBlock) NodeType() string

func (*ExternBlock) UnmarshalJSON

func (e *ExternBlock) UnmarshalJSON(data []byte) error

type ExternalVariableAssignment added in v0.8.0

type ExternalVariableAssignment struct {
	Identifier *Identifier `json:"identifier"`
	ExternType PolyType    `json:""`
	// contains filtered or unexported fields
}

ExternalVariableAssignment represents an externaly defined identifier and its type.

func (*ExternalVariableAssignment) Copy added in v0.8.0

func (s *ExternalVariableAssignment) Copy() Node

func (*ExternalVariableAssignment) FromBuf added in v0.57.0

func (l *ExternalVariableAssignment) FromBuf(fb *fbsemantic.SourceLocation) error

func (ExternalVariableAssignment) Location added in v0.8.0

func (l ExternalVariableAssignment) Location() ast.SourceLocation

func (*ExternalVariableAssignment) MarshalJSON added in v0.8.0

func (d *ExternalVariableAssignment) MarshalJSON() ([]byte, error)

func (*ExternalVariableAssignment) NodeType added in v0.8.0

func (*ExternalVariableAssignment) NodeType() string

type File added in v0.13.0

type File struct {
	Package *PackageClause       `json:"package"`
	Imports []*ImportDeclaration `json:"imports"`
	Body    []Statement          `json:"body"`
	// contains filtered or unexported fields
}

func (*File) Copy added in v0.13.0

func (p *File) Copy() Node

func (*File) FromBuf added in v0.57.0

func (rcv *File) FromBuf(fb *fbsemantic.File) error

func (File) Location added in v0.13.0

func (l File) Location() ast.SourceLocation

func (*File) MarshalJSON added in v0.13.0

func (p *File) MarshalJSON() ([]byte, error)

func (*File) NodeType added in v0.13.0

func (*File) NodeType() string

func (*File) UnmarshalJSON added in v0.13.0

func (p *File) UnmarshalJSON(data []byte) error

type FloatLiteral

type FloatLiteral struct {
	Value float64 `json:"value"`
	// contains filtered or unexported fields
}

func (*FloatLiteral) Copy

func (l *FloatLiteral) Copy() Node

func (*FloatLiteral) FromBuf added in v0.57.0

func (rcv *FloatLiteral) FromBuf(fb *fbsemantic.FloatLiteral) error

func (FloatLiteral) Location

func (l FloatLiteral) Location() ast.SourceLocation

func (*FloatLiteral) MarshalJSON

func (l *FloatLiteral) MarshalJSON() ([]byte, error)

func (*FloatLiteral) NodeType

func (*FloatLiteral) NodeType() string

func (*FloatLiteral) TypeOf added in v0.58.0

func (e *FloatLiteral) TypeOf() *types.MonoType

type FormatOption added in v0.50.0

type FormatOption func(*formatter)

type Fresher

type Fresher interface {
	// Fresh produces a new unused type variable.
	Fresh() Tvar
}

Fresher produces fresh type variables.

func NewFresher

func NewFresher() Fresher

type FunctionBlock

type FunctionBlock struct {
	Parameters *FunctionParameters `json:"parameters"`
	Body       Node                `json:"body"`
	// contains filtered or unexported fields
}

FunctionBlock represents the function parameters and the function body.

func (*FunctionBlock) Copy

func (b *FunctionBlock) Copy() Node

func (*FunctionBlock) FromBuf added in v0.57.0

func (l *FunctionBlock) FromBuf(fb *fbsemantic.SourceLocation) error

func (FunctionBlock) Location

func (l FunctionBlock) Location() ast.SourceLocation

func (*FunctionBlock) MarshalJSON

func (e *FunctionBlock) MarshalJSON() ([]byte, error)

func (*FunctionBlock) NodeType

func (*FunctionBlock) NodeType() string

func (*FunctionBlock) UnmarshalJSON

func (e *FunctionBlock) UnmarshalJSON(data []byte) error

type FunctionExpression

type FunctionExpression struct {
	Defaults *ObjectExpression `json:"defaults,omitempty"`
	Block    *FunctionBlock    `json:"block"`
	// contains filtered or unexported fields
}

FunctionExpression represents the definition of a function

func (*FunctionExpression) Copy

func (e *FunctionExpression) Copy() Node

func (*FunctionExpression) FromBuf added in v0.57.0

func (FunctionExpression) Location

func (l FunctionExpression) Location() ast.SourceLocation

func (*FunctionExpression) MarshalJSON

func (e *FunctionExpression) MarshalJSON() ([]byte, error)

func (*FunctionExpression) NodeType

func (*FunctionExpression) NodeType() string

func (*FunctionExpression) TypeOf added in v0.58.0

func (e *FunctionExpression) TypeOf() *types.MonoType

type FunctionParameter

type FunctionParameter struct {
	Key *Identifier `json:"key"`
	// contains filtered or unexported fields
}

FunctionParameter represents a function parameter.

func (*FunctionParameter) Copy

func (p *FunctionParameter) Copy() Node

func (*FunctionParameter) FromBuf added in v0.57.0

func (FunctionParameter) Location

func (l FunctionParameter) Location() ast.SourceLocation

func (*FunctionParameter) MarshalJSON

func (e *FunctionParameter) MarshalJSON() ([]byte, error)

func (*FunctionParameter) NodeType

func (*FunctionParameter) NodeType() string

type FunctionParameters

type FunctionParameters struct {
	List []*FunctionParameter `json:"list"`
	Pipe *Identifier          `json:"pipe"`
	// contains filtered or unexported fields
}

FunctionParameters represents the list of function parameters and which if any parameter is the pipe parameter.

func (*FunctionParameters) Copy

func (p *FunctionParameters) Copy() Node

func (*FunctionParameters) FromBuf added in v0.57.0

func (l *FunctionParameters) FromBuf(fb *fbsemantic.SourceLocation) error

func (FunctionParameters) Location

func (l FunctionParameters) Location() ast.SourceLocation

func (*FunctionParameters) MarshalJSON

func (e *FunctionParameters) MarshalJSON() ([]byte, error)

func (*FunctionParameters) NodeType

func (*FunctionParameters) NodeType() string

type FunctionPolySignature

type FunctionPolySignature struct {
	Parameters   map[string]PolyType
	Required     LabelSet
	Return       PolyType
	PipeArgument string
}

type FunctionSignature

type FunctionSignature struct {
	Parameters   map[string]Type
	Required     []string
	Return       Type
	PipeArgument string
}

type Identifier

type Identifier struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

func (*Identifier) Copy

func (i *Identifier) Copy() Node

func (*Identifier) FromBuf added in v0.57.0

func (rcv *Identifier) FromBuf(fb *fbsemantic.Identifier) error

func (*Identifier) Key added in v0.12.0

func (n *Identifier) Key() string

func (Identifier) Location

func (l Identifier) Location() ast.SourceLocation

func (*Identifier) MarshalJSON

func (i *Identifier) MarshalJSON() ([]byte, error)

func (*Identifier) NodeType

func (*Identifier) NodeType() string

type IdentifierExpression

type IdentifierExpression struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

func (*IdentifierExpression) Copy

func (e *IdentifierExpression) Copy() Node

func (*IdentifierExpression) FromBuf added in v0.57.0

func (IdentifierExpression) Location

func (l IdentifierExpression) Location() ast.SourceLocation

func (*IdentifierExpression) MarshalJSON

func (e *IdentifierExpression) MarshalJSON() ([]byte, error)

func (*IdentifierExpression) NodeType

func (*IdentifierExpression) NodeType() string

func (*IdentifierExpression) TypeOf added in v0.58.0

func (e *IdentifierExpression) TypeOf() *types.MonoType

type ImportDeclaration added in v0.8.0

type ImportDeclaration struct {
	As   *Identifier    `json:"as"`
	Path *StringLiteral `json:"path"`
	// contains filtered or unexported fields
}

func (*ImportDeclaration) Copy added in v0.8.0

func (d *ImportDeclaration) Copy() Node

func (*ImportDeclaration) FromBuf added in v0.57.0

func (ImportDeclaration) Location added in v0.8.0

func (l ImportDeclaration) Location() ast.SourceLocation

func (*ImportDeclaration) MarshalJSON added in v0.8.0

func (p *ImportDeclaration) MarshalJSON() ([]byte, error)

func (*ImportDeclaration) NodeType added in v0.8.0

func (*ImportDeclaration) NodeType() string

type Importer added in v0.8.0

type Importer interface {
	Import(path string) (PackageType, bool)
}

Importer produces a package given an import path.

type IndexExpression added in v0.7.1

type IndexExpression struct {
	Array Expression `json:"array"`
	Index Expression `json:"index"`
	// contains filtered or unexported fields
}

func (*IndexExpression) Copy added in v0.7.1

func (e *IndexExpression) Copy() Node

func (*IndexExpression) FromBuf added in v0.57.0

func (rcv *IndexExpression) FromBuf(fb *fbsemantic.IndexExpression) error

func (IndexExpression) Location added in v0.7.1

func (l IndexExpression) Location() ast.SourceLocation

func (*IndexExpression) MarshalJSON added in v0.7.1

func (e *IndexExpression) MarshalJSON() ([]byte, error)

func (*IndexExpression) NodeType added in v0.7.1

func (*IndexExpression) NodeType() string

func (*IndexExpression) TypeOf added in v0.58.0

func (e *IndexExpression) TypeOf() *types.MonoType

func (*IndexExpression) UnmarshalJSON added in v0.7.1

func (e *IndexExpression) UnmarshalJSON(data []byte) error

type IntegerLiteral

type IntegerLiteral struct {
	Value int64 `json:"value"`
	// contains filtered or unexported fields
}

func (*IntegerLiteral) Copy

func (l *IntegerLiteral) Copy() Node

func (*IntegerLiteral) FromBuf added in v0.57.0

func (rcv *IntegerLiteral) FromBuf(fb *fbsemantic.IntegerLiteral) error

func (IntegerLiteral) Location

func (l IntegerLiteral) Location() ast.SourceLocation

func (*IntegerLiteral) MarshalJSON

func (l *IntegerLiteral) MarshalJSON() ([]byte, error)

func (*IntegerLiteral) NodeType

func (*IntegerLiteral) NodeType() string

func (*IntegerLiteral) TypeOf added in v0.58.0

func (e *IntegerLiteral) TypeOf() *types.MonoType

func (*IntegerLiteral) UnmarshalJSON

func (l *IntegerLiteral) UnmarshalJSON(data []byte) error

type InterpolatedPart added in v0.41.0

type InterpolatedPart struct {
	Expression Expression `json:"expression"`
	// contains filtered or unexported fields
}

func (*InterpolatedPart) Copy added in v0.41.0

func (p *InterpolatedPart) Copy() Node

func (*InterpolatedPart) FromBuf added in v0.57.0

func (l *InterpolatedPart) FromBuf(fb *fbsemantic.SourceLocation) error

func (InterpolatedPart) Location added in v0.41.0

func (l InterpolatedPart) Location() ast.SourceLocation

func (*InterpolatedPart) MarshalJSON added in v0.41.0

func (e *InterpolatedPart) MarshalJSON() ([]byte, error)

func (*InterpolatedPart) NodeType added in v0.41.0

func (*InterpolatedPart) NodeType() string

func (*InterpolatedPart) UnmarshalJSON added in v0.41.0

func (e *InterpolatedPart) UnmarshalJSON(data []byte) error

type KClass

type KClass struct{}

func (KClass) MonoType

func (k KClass) MonoType() (Type, bool)

type Kind

type Kind interface {
	TypeExpression
	// contains filtered or unexported methods
}

Kind is a constraint in the kind domain.

type KindConstrainter

type KindConstrainter interface {
	KindConstraint() Kind
}

type LabelSet

type LabelSet []string

LabelSet is a set of string labels.

func AllLabels

func AllLabels() LabelSet

AllLabels returns a label set that represents the infinite set of all possible string labels.

func (LabelSet) String

func (s LabelSet) String() string

type Literal

type Literal interface {
	Expression
	// contains filtered or unexported methods
}

type LogicalExpression

type LogicalExpression struct {
	Operator ast.LogicalOperatorKind `json:"operator"`
	Left     Expression              `json:"left"`
	Right    Expression              `json:"right"`
	// contains filtered or unexported fields
}

func (*LogicalExpression) Copy

func (e *LogicalExpression) Copy() Node

func (*LogicalExpression) FromBuf added in v0.57.0

func (LogicalExpression) Location

func (l LogicalExpression) Location() ast.SourceLocation

func (*LogicalExpression) MarshalJSON

func (e *LogicalExpression) MarshalJSON() ([]byte, error)

func (*LogicalExpression) NodeType

func (*LogicalExpression) NodeType() string

func (*LogicalExpression) TypeOf added in v0.58.0

func (e *LogicalExpression) TypeOf() *types.MonoType

func (*LogicalExpression) UnmarshalJSON

func (e *LogicalExpression) UnmarshalJSON(data []byte) error

type MemberAssignment added in v0.14.0

type MemberAssignment struct {
	Member *MemberExpression `json:"member"`
	Init   Expression        `json:"init"`
	// contains filtered or unexported fields
}

func (*MemberAssignment) Copy added in v0.14.0

func (s *MemberAssignment) Copy() Node

func (*MemberAssignment) FromBuf added in v0.57.0

func (MemberAssignment) Location added in v0.14.0

func (l MemberAssignment) Location() ast.SourceLocation

func (*MemberAssignment) MarshalJSON added in v0.14.0

func (s *MemberAssignment) MarshalJSON() ([]byte, error)

func (*MemberAssignment) NodeType added in v0.14.0

func (*MemberAssignment) NodeType() string

func (*MemberAssignment) UnmarshalJSON added in v0.14.0

func (s *MemberAssignment) UnmarshalJSON(data []byte) error

type MemberExpression

type MemberExpression struct {
	Object   Expression `json:"object"`
	Property string     `json:"property"`
	// contains filtered or unexported fields
}

func (*MemberExpression) Copy

func (e *MemberExpression) Copy() Node

func (*MemberExpression) FromBuf added in v0.57.0

func (MemberExpression) Location

func (l MemberExpression) Location() ast.SourceLocation

func (*MemberExpression) MarshalJSON

func (e *MemberExpression) MarshalJSON() ([]byte, error)

func (*MemberExpression) NodeType

func (*MemberExpression) NodeType() string

func (*MemberExpression) TypeOf added in v0.58.0

func (e *MemberExpression) TypeOf() *types.MonoType

func (*MemberExpression) UnmarshalJSON

func (e *MemberExpression) UnmarshalJSON(data []byte) error

type NativeVariableAssignment added in v0.8.0

type NativeVariableAssignment struct {
	Identifier *Identifier `json:"identifier"`
	Init       Expression  `json:"init"`

	Typ *types.PolyType `json:"polytype,omitempty"`
	// contains filtered or unexported fields
}

func (*NativeVariableAssignment) Copy added in v0.8.0

func (s *NativeVariableAssignment) Copy() Node

func (*NativeVariableAssignment) FromBuf added in v0.57.0

func (NativeVariableAssignment) Location added in v0.8.0

func (l NativeVariableAssignment) Location() ast.SourceLocation

func (*NativeVariableAssignment) MarshalJSON added in v0.8.0

func (d *NativeVariableAssignment) MarshalJSON() ([]byte, error)

func (*NativeVariableAssignment) NodeType added in v0.8.0

func (*NativeVariableAssignment) NodeType() string

func (*NativeVariableAssignment) UnmarshalJSON added in v0.8.0

func (d *NativeVariableAssignment) UnmarshalJSON(data []byte) error

type Nature

type Nature int

Nature is the primitive description of a type.

const (
	Invalid Nature = iota
	Nil
	String
	Bytes
	Int
	UInt
	Float
	Bool
	Time
	Duration
	Regexp
	Array
	Object
	Function
)

func (Nature) ElementType

func (n Nature) ElementType() Type

func (Nature) Equal

func (n Nature) Equal(t PolyType) bool

func (Nature) FunctionSignature

func (n Nature) FunctionSignature() FunctionSignature

func (Nature) MonoType

func (n Nature) MonoType() (Type, bool)

func (Nature) Nature

func (n Nature) Nature() Nature

func (Nature) PolyType

func (n Nature) PolyType() PolyType

func (Nature) Properties

func (n Nature) Properties() map[string]Type

func (Nature) PropertyType

func (n Nature) PropertyType(name string) Type

func (Nature) String

func (n Nature) String() string

type NestingVisitor

type NestingVisitor interface {
	Visitor
	Nest() NestingVisitor
}

type Node

type Node interface {
	NodeType() string
	Copy() Node

	Location() ast.SourceLocation

	json.Marshaler
	// contains filtered or unexported methods
}

func UnmarshalNode

func UnmarshalNode(data []byte) (Node, error)

type NullableKind added in v0.33.0

type NullableKind struct {
	T PolyType
}

NullableKind indicates that it is possible for this variable to be the null type if no other type is more appropriate.

func (NullableKind) MonoType added in v0.33.0

func (n NullableKind) MonoType() (Type, bool)

type NullableTvar added in v0.40.0

type NullableTvar struct {
	Tvar
}

NullableTvar is a type variable that might be null. If a type variable is constrained to be nullable (via the NullableKind), in order to preserve that constraint when resolving the type, we return a NullableTvar.

TODO: This is a temporary type that will be removed once kind constraints can be expressed in the language of types. Unfortunately right now, external packages like the compiler don't have any notion of kind constraints.

func (NullableTvar) Equal added in v0.40.0

func (t NullableTvar) Equal(p PolyType) bool

func (NullableTvar) MonoType added in v0.40.0

func (NullableTvar) MonoType() (Type, bool)

func (NullableTvar) Nature added in v0.40.0

func (NullableTvar) Nature() Nature

func (NullableTvar) String added in v0.40.0

func (t NullableTvar) String() string

type Number

type Number struct{}

type ObjectExpression

type ObjectExpression struct {
	With       *IdentifierExpression `json:"with,omitempty"`
	Properties []*Property           `json:"properties"`
	// contains filtered or unexported fields
}

func (*ObjectExpression) Copy

func (e *ObjectExpression) Copy() Node

func (*ObjectExpression) FromBuf added in v0.57.0

func (ObjectExpression) Location

func (l ObjectExpression) Location() ast.SourceLocation

func (*ObjectExpression) MarshalJSON

func (e *ObjectExpression) MarshalJSON() ([]byte, error)

func (*ObjectExpression) NodeType

func (*ObjectExpression) NodeType() string

func (*ObjectExpression) TypeOf added in v0.58.0

func (e *ObjectExpression) TypeOf() *types.MonoType

type ObjectKind added in v0.7.1

type ObjectKind struct {
	// contains filtered or unexported fields
}

func (ObjectKind) MonoType added in v0.7.1

func (k ObjectKind) MonoType() (Type, bool)

func (ObjectKind) String added in v0.7.1

func (k ObjectKind) String() string

type OptionStatement

type OptionStatement struct {
	Assignment Assignment `json:"assignment"`
	// contains filtered or unexported fields
}

func (*OptionStatement) Copy

func (s *OptionStatement) Copy() Node

func (*OptionStatement) FromBuf added in v0.57.0

func (rcv *OptionStatement) FromBuf(fb *fbsemantic.OptionStatement) error

func (OptionStatement) Location

func (l OptionStatement) Location() ast.SourceLocation

func (*OptionStatement) MarshalJSON

func (s *OptionStatement) MarshalJSON() ([]byte, error)

func (*OptionStatement) NodeType

func (s *OptionStatement) NodeType() string

func (*OptionStatement) UnmarshalJSON

func (s *OptionStatement) UnmarshalJSON(data []byte) error

type Package added in v0.8.0

type Package struct {
	Package string  `json:"package"`
	Files   []*File `json:"files"`
	// contains filtered or unexported fields
}

func DeserializeFromFlatBuffer added in v0.57.0

func DeserializeFromFlatBuffer(buf []byte) (*Package, error)

func New

func New(pkg *ast.Package) (*Package, error)

New creates a semantic graph from the provided AST

func (*Package) Copy added in v0.13.0

func (p *Package) Copy() Node

func (*Package) FromBuf added in v0.57.0

func (rcv *Package) FromBuf(fb *fbsemantic.Package) error

func (Package) Location added in v0.13.0

func (l Package) Location() ast.SourceLocation

func (*Package) MarshalJSON added in v0.13.0

func (p *Package) MarshalJSON() ([]byte, error)

func (*Package) NodeType added in v0.13.0

func (*Package) NodeType() string

type PackageClause added in v0.8.0

type PackageClause struct {
	Name *Identifier `json:"name"`
	// contains filtered or unexported fields
}

func (*PackageClause) Copy added in v0.8.0

func (p *PackageClause) Copy() Node

func (*PackageClause) FromBuf added in v0.57.0

func (rcv *PackageClause) FromBuf(fb *fbsemantic.PackageClause) error

func (PackageClause) Location added in v0.8.0

func (l PackageClause) Location() ast.SourceLocation

func (*PackageClause) MarshalJSON added in v0.8.0

func (p *PackageClause) MarshalJSON() ([]byte, error)

func (*PackageClause) NodeType added in v0.8.0

func (*PackageClause) NodeType() string

type PackageType added in v0.13.0

type PackageType struct {
	Name string
	Type PolyType
}

PackageType represents the type and name of a package.

func CreatePackage added in v0.8.0

func CreatePackage(n Node, importer Importer) (PackageType, error)

CreatePackage constructs a Package from the node. The node must contain a Program node with a valid PackageClause

type PolyType

type PolyType interface {
	TypeExpression

	// Equal reports if two types are the same.
	Equal(PolyType) bool

	// Nature reports the primitive description of the type.
	Nature() Nature
	// contains filtered or unexported methods
}

PolyType represents a polymorphic type, meaning that the type may have multiple free type variables.

func NewArrayPolyType

func NewArrayPolyType(elementType PolyType) PolyType

func NewEmptyObjectPolyType

func NewEmptyObjectPolyType() PolyType

func NewFunctionPolyType

func NewFunctionPolyType(sig FunctionPolySignature) PolyType

func NewObjectPolyType

func NewObjectPolyType(properties map[string]PolyType, lower, upper LabelSet) PolyType

NewObjectPolyType creates a PolyType representing an object. A map of properties and their types may be provided. Lower is a set of labels that must exist on the object, and upper is a set of labels that may exist on the object. Upper must be a superset of lower. The map must contain an entry for all lables in the lower set. Use AllLabels() to represent the infinite set of all possible labels.

type Property

type Property struct {
	Key   PropertyKey `json:"key"`
	Value Expression  `json:"value"`
	// contains filtered or unexported fields
}

func (*Property) Copy

func (p *Property) Copy() Node

func (*Property) FromBuf added in v0.57.0

func (rcv *Property) FromBuf(fb *fbsemantic.Property) error

func (Property) Location

func (l Property) Location() ast.SourceLocation

func (*Property) MarshalJSON

func (p *Property) MarshalJSON() ([]byte, error)

func (*Property) NodeType

func (*Property) NodeType() string

func (*Property) UnmarshalJSON

func (p *Property) UnmarshalJSON(data []byte) error

type PropertyKey added in v0.12.0

type PropertyKey interface {
	Node
	Key() string
}

type RegexpLiteral

type RegexpLiteral struct {
	Value *regexp.Regexp `json:"value"`
	// contains filtered or unexported fields
}

func (*RegexpLiteral) Copy

func (l *RegexpLiteral) Copy() Node

func (*RegexpLiteral) FromBuf added in v0.57.0

func (rcv *RegexpLiteral) FromBuf(fb *fbsemantic.RegexpLiteral) error

func (RegexpLiteral) Location

func (l RegexpLiteral) Location() ast.SourceLocation

func (*RegexpLiteral) MarshalJSON

func (l *RegexpLiteral) MarshalJSON() ([]byte, error)

func (*RegexpLiteral) NodeType

func (*RegexpLiteral) NodeType() string

func (*RegexpLiteral) TypeOf added in v0.58.0

func (e *RegexpLiteral) TypeOf() *types.MonoType

func (*RegexpLiteral) UnmarshalJSON

func (l *RegexpLiteral) UnmarshalJSON(data []byte) error

type ReturnStatement

type ReturnStatement struct {
	Argument Expression `json:"argument"`
	// contains filtered or unexported fields
}

func (*ReturnStatement) Copy

func (s *ReturnStatement) Copy() Node

func (*ReturnStatement) FromBuf added in v0.57.0

func (rcv *ReturnStatement) FromBuf(fb *fbsemantic.ReturnStatement) error

func (ReturnStatement) Location

func (l ReturnStatement) Location() ast.SourceLocation

func (*ReturnStatement) MarshalJSON

func (s *ReturnStatement) MarshalJSON() ([]byte, error)

func (*ReturnStatement) NodeType

func (*ReturnStatement) NodeType() string

func (*ReturnStatement) UnmarshalJSON

func (s *ReturnStatement) UnmarshalJSON(data []byte) error

type Scheme

type Scheme struct {
	T    PolyType
	Free TvarSet
}

func (Scheme) Substitute

func (s Scheme) Substitute(tv Tvar, t PolyType) Scheme

type ScopedVisitor

type ScopedVisitor struct {
	// contains filtered or unexported fields
}

ScopedVisitor will nest the given visitor when the scope changes.

func NewScopedVisitor

func NewScopedVisitor(v NestingVisitor) ScopedVisitor

func (ScopedVisitor) Done

func (v ScopedVisitor) Done(node Node)

func (ScopedVisitor) Visit

func (v ScopedVisitor) Visit(node Node) Visitor

type Solution

type Solution struct {
	// contains filtered or unexported fields
}

Solution implement TypeSolution and solves the unification problem.

func (*Solution) AddConstraint

func (s *Solution) AddConstraint(l, r PolyType) error

func (*Solution) Fresh

func (s *Solution) Fresh() Tvar

func (*Solution) FreshSolution

func (s *Solution) FreshSolution() TypeSolution

func (*Solution) PolyTypeOf

func (s *Solution) PolyTypeOf(n Node) (PolyType, error)

func (*Solution) TypeOf

func (s *Solution) TypeOf(n Node) (Type, error)

type SolutionMap added in v0.16.0

type SolutionMap map[Node]PolyType

SolutionMap represents a mapping of nodes to their poly types.

func CreateSolutionMap added in v0.16.0

func CreateSolutionMap(node Node, sol TypeSolution) SolutionMap

CreateSolutionMap constructs a new solution map from the nodes and type solution. Any type errors in the type solution are ignored.

func (SolutionMap) String added in v0.16.0

func (s SolutionMap) String() string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type StringExpression added in v0.41.0

type StringExpression struct {
	Parts []StringExpressionPart `json:"parts"`
	// contains filtered or unexported fields
}

func (*StringExpression) Copy added in v0.41.0

func (e *StringExpression) Copy() Node

func (*StringExpression) FromBuf added in v0.57.0

func (StringExpression) Location added in v0.41.0

func (l StringExpression) Location() ast.SourceLocation

func (*StringExpression) MarshalJSON added in v0.41.0

func (e *StringExpression) MarshalJSON() ([]byte, error)

func (*StringExpression) NodeType added in v0.41.0

func (*StringExpression) NodeType() string

func (*StringExpression) TypeOf added in v0.58.0

func (e *StringExpression) TypeOf() *types.MonoType

func (*StringExpression) UnmarshalJSON added in v0.41.0

func (e *StringExpression) UnmarshalJSON(data []byte) error

type StringExpressionPart added in v0.41.0

type StringExpressionPart interface {
	Node
	// contains filtered or unexported methods
}

type StringLiteral

type StringLiteral struct {
	Value string `json:"value"`
	// contains filtered or unexported fields
}

func (*StringLiteral) Copy

func (l *StringLiteral) Copy() Node

func (*StringLiteral) FromBuf added in v0.57.0

func (rcv *StringLiteral) FromBuf(fb *fbsemantic.StringLiteral) error

func (*StringLiteral) Key added in v0.12.0

func (n *StringLiteral) Key() string

func (StringLiteral) Location

func (l StringLiteral) Location() ast.SourceLocation

func (*StringLiteral) MarshalJSON

func (l *StringLiteral) MarshalJSON() ([]byte, error)

func (*StringLiteral) NodeType

func (*StringLiteral) NodeType() string

func (*StringLiteral) TypeOf added in v0.58.0

func (e *StringLiteral) TypeOf() *types.MonoType

type Substitution

type Substitution map[Tvar]PolyType

Substitution is a mapping of type variables to a poly type.

func (Substitution) ApplyEnv

func (s Substitution) ApplyEnv(env *Env) *Env

func (Substitution) ApplyKind

func (s Substitution) ApplyKind(k Kind) Kind

func (Substitution) ApplyScheme

func (s Substitution) ApplyScheme(ts Scheme) Scheme

func (Substitution) ApplyTvar

func (s Substitution) ApplyTvar(tv Tvar) Tvar

func (Substitution) ApplyType

func (s Substitution) ApplyType(t PolyType) PolyType

func (Substitution) Merge

func (l Substitution) Merge(r Substitution)

Merge r into l.

func (Substitution) String

func (s Substitution) String() string

type TestStatement added in v0.19.0

type TestStatement struct {
	Assignment *NativeVariableAssignment `json:"assignment"`
	// contains filtered or unexported fields
}

func (*TestStatement) Copy added in v0.19.0

func (s *TestStatement) Copy() Node

func (*TestStatement) FromBuf added in v0.57.0

func (rcv *TestStatement) FromBuf(fb *fbsemantic.TestStatement) error

func (TestStatement) Location added in v0.19.0

func (l TestStatement) Location() ast.SourceLocation

func (*TestStatement) MarshalJSON added in v0.19.0

func (s *TestStatement) MarshalJSON() ([]byte, error)

func (*TestStatement) NodeType added in v0.19.0

func (s *TestStatement) NodeType() string

type TextPart added in v0.41.0

type TextPart struct {
	Value string `json:"value"`
	// contains filtered or unexported fields
}

func (*TextPart) Copy added in v0.41.0

func (p *TextPart) Copy() Node

func (*TextPart) FromBuf added in v0.57.0

func (l *TextPart) FromBuf(fb *fbsemantic.SourceLocation) error

func (TextPart) Location added in v0.41.0

func (l TextPart) Location() ast.SourceLocation

func (*TextPart) MarshalJSON added in v0.41.0

func (e *TextPart) MarshalJSON() ([]byte, error)

func (*TextPart) NodeType added in v0.41.0

func (*TextPart) NodeType() string

func (*TextPart) UnmarshalJSON added in v0.41.0

func (e *TextPart) UnmarshalJSON(data []byte) error

type Tvar

type Tvar int

Tvar represents a type variable meaning its type could be any possible type.

func (Tvar) Equal

func (tv Tvar) Equal(t PolyType) bool

func (Tvar) MonoType

func (tv Tvar) MonoType() (Type, bool)

func (Tvar) Nature

func (tv Tvar) Nature() Nature

func (Tvar) String

func (tv Tvar) String() string

type TvarSet

type TvarSet []Tvar

TvarSet is a set of type variables.

type Type

type Type interface {
	// Nature returns the specific primitive description of this type.
	Nature() Nature

	// PropertyType returns the type of a given property.
	// It panics if the type's Kind is not Object
	PropertyType(name string) Type

	// Properties returns a map of all property types.
	// It panics if the type's Kind is not Object
	Properties() map[string]Type

	// ElementType return the type of elements in the array.
	// It panics if the type's Kind is not Array.
	ElementType() Type

	// FunctionSignature returns the function signature of this type.
	// It panics if the type's Kind is not Function.
	FunctionSignature() FunctionSignature

	PolyType() PolyType
	// contains filtered or unexported methods
}

Type is the representation of a Flux type. Type is a monomorphic, meaning that it represents a single type and is not polymorphic. See PolyType for polymorphic types.

Type values are comparable and as such can be used as map keys and directly comparison using the == operator. Two types are equal if they represent identical types.

Do NOT embed this type into other interfaces or structs as that will invalidate the comparison properties of the interface.

func NewArrayType

func NewArrayType(elementType Type) Type

func NewFunctionType

func NewFunctionType(sig FunctionSignature) (t Type)

func NewObjectType

func NewObjectType(propertyTypes map[string]Type) Type

type TypeConstraint

type TypeConstraint struct {
	// contains filtered or unexported fields
}

TypeConstraint states that the left and right types must be equal.

func (TypeConstraint) String

func (tc TypeConstraint) String() string

type TypeExpression

type TypeExpression interface {
	// MonoType produces a monotype of the expression.
	MonoType() (Type, bool)
	// contains filtered or unexported methods
}

TypeExpression represents an expression describing a type.

type TypeSolution

type TypeSolution interface {
	// TypeOf reports the monotype of the node or an error.
	TypeOf(n Node) (Type, error)
	// TypeOf reports the polytype of the node or an error.
	PolyTypeOf(n Node) (PolyType, error)

	// FreshSolution creates a copy of the solution with fresh type variables
	FreshSolution() TypeSolution

	// Fresh creates a new type variable within the solution.
	Fresh() Tvar

	// AddConstraint adds a new constraint and solves again reporting any errors.
	AddConstraint(l, r PolyType) error
}

TypeSolution is a mapping of Nodes to their types.

func InferTypes

func InferTypes(n Node, importer Importer) (TypeSolution, error)

InferTypes produces a solution to type inference for a given semantic graph.

func SolveConstraints

func SolveConstraints(cs *Constraints) (TypeSolution, error)

SolveConstraints solves the type inference problem defined by the constraints.

type UnaryExpression

type UnaryExpression struct {
	Operator ast.OperatorKind `json:"operator"`
	Argument Expression       `json:"argument"`
	// contains filtered or unexported fields
}

func (*UnaryExpression) Copy

func (e *UnaryExpression) Copy() Node

func (*UnaryExpression) FromBuf added in v0.57.0

func (rcv *UnaryExpression) FromBuf(fb *fbsemantic.UnaryExpression) error

func (UnaryExpression) Location

func (l UnaryExpression) Location() ast.SourceLocation

func (*UnaryExpression) MarshalJSON

func (e *UnaryExpression) MarshalJSON() ([]byte, error)

func (*UnaryExpression) NodeType

func (*UnaryExpression) NodeType() string

func (*UnaryExpression) TypeOf added in v0.58.0

func (e *UnaryExpression) TypeOf() *types.MonoType

func (*UnaryExpression) UnmarshalJSON

func (e *UnaryExpression) UnmarshalJSON(data []byte) error

type UnsignedIntegerLiteral

type UnsignedIntegerLiteral struct {
	Value uint64 `json:"value"`
	// contains filtered or unexported fields
}

func (*UnsignedIntegerLiteral) Copy

func (l *UnsignedIntegerLiteral) Copy() Node

func (*UnsignedIntegerLiteral) FromBuf added in v0.57.0

func (UnsignedIntegerLiteral) Location

func (l UnsignedIntegerLiteral) Location() ast.SourceLocation

func (*UnsignedIntegerLiteral) MarshalJSON

func (l *UnsignedIntegerLiteral) MarshalJSON() ([]byte, error)

func (*UnsignedIntegerLiteral) NodeType

func (*UnsignedIntegerLiteral) NodeType() string

func (*UnsignedIntegerLiteral) TypeOf added in v0.58.0

func (e *UnsignedIntegerLiteral) TypeOf() *types.MonoType

func (*UnsignedIntegerLiteral) UnmarshalJSON

func (l *UnsignedIntegerLiteral) UnmarshalJSON(data []byte) error

type Visitor

type Visitor interface {
	Visit(node Node) Visitor
	Done(node Node)
}

func CreateVisitor

func CreateVisitor(f func(Node)) Visitor

Directories

Path Synopsis
internal
Package semantictest contains utilities for testing the semantic package.
Package semantictest contains utilities for testing the semantic package.

Jump to

Keyboard shortcuts

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