ast

package
v0.20.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ast contains all AST nodes for Cadence. All AST nodes implement the Element interface, so have position information and can be traversed using the Visitor interface. Elements also implement the json.Marshaler interface so can be serialized to a standardized/stable JSON format.

Index

Constants

View Source
const NilConstant = "nil"

Variables

Functions

func AccessCount added in v0.5.0

func AccessCount() int

func ConditionKindCount added in v0.5.0

func ConditionKindCount() int

func Inspect added in v0.17.0

func Inspect(element Element, f func(Element) bool)

func OperationCount added in v0.8.0

func OperationCount() int

func TransferOperationCount added in v0.8.0

func TransferOperationCount() int

func VariableKindCount added in v0.8.0

func VariableKindCount() int

func Walk added in v0.17.0

func Walk(walker Walker, element Element)

Walk traverses an AST in depth-first order: It starts by calling walker.Walk(element); If the returned walker is nil, child elements are not walked. If the returned walker is not-nil, then Walk is invoked recursively on this returned walker for each of the non-nil children of the element, followed by a call of Walk(nil) on the returned walker.

The initial walker may not be nil.

Types

type Access

type Access uint
const (
	AccessNotSpecified Access = iota
	AccessPrivate
	AccessContract
	AccessAccount
	AccessPublic
	AccessPublicSettable
)

func (Access) Description

func (a Access) Description() string

func (Access) IsLessPermissiveThan

func (a Access) IsLessPermissiveThan(otherAccess Access) bool

func (Access) Keyword

func (a Access) Keyword() string

func (Access) MarshalJSON added in v0.5.0

func (a Access) MarshalJSON() ([]byte, error)

func (Access) String

func (i Access) String() string

type AccessExpression

type AccessExpression interface {
	Expression

	AccessedExpression() Expression
	// contains filtered or unexported methods
}

type Argument

type Argument struct {
	Label                string    `json:",omitempty"`
	LabelStartPos        *Position `json:",omitempty"`
	LabelEndPos          *Position `json:",omitempty"`
	TrailingSeparatorPos Position
	Expression           Expression
}

func (*Argument) EndPosition added in v0.5.0

func (a *Argument) EndPosition() Position

func (*Argument) MarshalJSON added in v0.5.0

func (a *Argument) MarshalJSON() ([]byte, error)

func (*Argument) StartPosition added in v0.5.0

func (a *Argument) StartPosition() Position

func (*Argument) String

func (a *Argument) String() string

type Arguments

type Arguments []*Argument

func (Arguments) String

func (args Arguments) String() string

type ArrayExpression

type ArrayExpression struct {
	Values []Expression
	Range
}

func (*ArrayExpression) Accept

func (e *ArrayExpression) Accept(visitor Visitor) Repr

func (*ArrayExpression) AcceptExp

func (e *ArrayExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ArrayExpression) MarshalJSON added in v0.8.0

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

func (*ArrayExpression) String

func (e *ArrayExpression) String() string

func (*ArrayExpression) Walk added in v0.17.0

func (e *ArrayExpression) Walk(walkChild func(Element))

type ArrayExtractor

type ArrayExtractor interface {
	ExtractArray(extractor *ExpressionExtractor, expression *ArrayExpression) ExpressionExtraction
}

type AssignmentStatement

type AssignmentStatement struct {
	Target   Expression
	Transfer *Transfer
	Value    Expression
}

func (*AssignmentStatement) Accept

func (s *AssignmentStatement) Accept(visitor Visitor) Repr

func (*AssignmentStatement) EndPosition

func (s *AssignmentStatement) EndPosition() Position

func (*AssignmentStatement) MarshalJSON added in v0.9.0

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

func (*AssignmentStatement) StartPosition

func (s *AssignmentStatement) StartPosition() Position

func (*AssignmentStatement) Walk added in v0.17.0

func (s *AssignmentStatement) Walk(walkChild func(Element))

type BinaryExpression

type BinaryExpression struct {
	Operation Operation
	Left      Expression
	Right     Expression
}

func (*BinaryExpression) Accept

func (e *BinaryExpression) Accept(visitor Visitor) Repr

func (*BinaryExpression) AcceptExp

func (e *BinaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*BinaryExpression) EndPosition

func (e *BinaryExpression) EndPosition() Position

func (*BinaryExpression) MarshalJSON added in v0.9.0

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

func (*BinaryExpression) StartPosition

func (e *BinaryExpression) StartPosition() Position

func (*BinaryExpression) String

func (e *BinaryExpression) String() string

func (*BinaryExpression) Walk added in v0.17.0

func (e *BinaryExpression) Walk(walkChild func(Element))

type BinaryExtractor

type BinaryExtractor interface {
	ExtractBinary(extractor *ExpressionExtractor, expression *BinaryExpression) ExpressionExtraction
}

type Block

type Block struct {
	Statements []Statement
	Range
}

func (*Block) Accept

func (b *Block) Accept(visitor Visitor) Repr

func (*Block) MarshalJSON added in v0.8.0

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

func (*Block) Walk added in v0.17.0

func (b *Block) Walk(walkChild func(Element))

type BoolExpression

type BoolExpression struct {
	Value bool
	Range
}

func (*BoolExpression) Accept

func (e *BoolExpression) Accept(visitor Visitor) Repr

func (*BoolExpression) AcceptExp

func (e *BoolExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*BoolExpression) MarshalJSON added in v0.5.0

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

func (*BoolExpression) String

func (e *BoolExpression) String() string

func (*BoolExpression) Walk added in v0.17.0

func (*BoolExpression) Walk(_ func(Element))

type BoolExtractor

type BoolExtractor interface {
	ExtractBool(extractor *ExpressionExtractor, expression *BoolExpression) ExpressionExtraction
}

type BreakStatement

type BreakStatement struct {
	Range
}

func (*BreakStatement) Accept

func (s *BreakStatement) Accept(visitor Visitor) Repr

func (*BreakStatement) MarshalJSON added in v0.8.0

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

func (*BreakStatement) Walk added in v0.17.0

func (*BreakStatement) Walk(_ func(Element))

type CastingExpression

type CastingExpression struct {
	Expression                Expression
	Operation                 Operation
	TypeAnnotation            *TypeAnnotation
	ParentVariableDeclaration *VariableDeclaration `json:"-"`
}

func (*CastingExpression) Accept

func (e *CastingExpression) Accept(visitor Visitor) Repr

func (*CastingExpression) AcceptExp

func (e *CastingExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*CastingExpression) EndPosition

func (e *CastingExpression) EndPosition() Position

func (*CastingExpression) MarshalJSON added in v0.9.0

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

func (*CastingExpression) StartPosition

func (e *CastingExpression) StartPosition() Position

func (*CastingExpression) String

func (e *CastingExpression) String() string

func (*CastingExpression) Walk added in v0.17.0

func (e *CastingExpression) Walk(walkChild func(Element))

type CastingExtractor

type CastingExtractor interface {
	ExtractCast(extractor *ExpressionExtractor, expression *CastingExpression) ExpressionExtraction
}

type CompositeDeclaration

type CompositeDeclaration struct {
	Access        Access
	CompositeKind common.CompositeKind
	Identifier    Identifier
	Conformances  []*NominalType
	Members       *Members
	DocString     string
	Range
}

func (*CompositeDeclaration) Accept

func (d *CompositeDeclaration) Accept(visitor Visitor) Repr

func (*CompositeDeclaration) DeclarationAccess

func (d *CompositeDeclaration) DeclarationAccess() Access

func (*CompositeDeclaration) DeclarationDocString added in v0.17.0

func (d *CompositeDeclaration) DeclarationDocString() string

func (*CompositeDeclaration) DeclarationIdentifier

func (d *CompositeDeclaration) DeclarationIdentifier() *Identifier

func (*CompositeDeclaration) DeclarationKind

func (d *CompositeDeclaration) DeclarationKind() common.DeclarationKind

func (*CompositeDeclaration) DeclarationMembers added in v0.13.0

func (d *CompositeDeclaration) DeclarationMembers() *Members

func (*CompositeDeclaration) MarshalJSON added in v0.9.0

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

func (*CompositeDeclaration) Walk added in v0.17.0

func (d *CompositeDeclaration) Walk(walkChild func(Element))

type Condition

type Condition struct {
	Kind    ConditionKind
	Test    Expression
	Message Expression
}

type ConditionKind

type ConditionKind uint
const (
	ConditionKindUnknown ConditionKind = iota
	ConditionKindPre
	ConditionKindPost
)

func (ConditionKind) MarshalJSON added in v0.5.0

func (k ConditionKind) MarshalJSON() ([]byte, error)

func (ConditionKind) Name

func (k ConditionKind) Name() string

func (ConditionKind) String

func (i ConditionKind) String() string

type ConditionalExpression

type ConditionalExpression struct {
	Test Expression
	Then Expression
	Else Expression
}

func (*ConditionalExpression) Accept

func (e *ConditionalExpression) Accept(visitor Visitor) Repr

func (*ConditionalExpression) AcceptExp

func (e *ConditionalExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ConditionalExpression) EndPosition

func (e *ConditionalExpression) EndPosition() Position

func (*ConditionalExpression) MarshalJSON added in v0.9.0

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

func (*ConditionalExpression) StartPosition

func (e *ConditionalExpression) StartPosition() Position

func (*ConditionalExpression) String

func (e *ConditionalExpression) String() string

func (*ConditionalExpression) Walk added in v0.17.0

func (e *ConditionalExpression) Walk(walkChild func(Element))

type ConditionalExtractor

type ConditionalExtractor interface {
	ExtractConditional(extractor *ExpressionExtractor, expression *ConditionalExpression) ExpressionExtraction
}

type Conditions

type Conditions []*Condition

type ConstantSizedType

type ConstantSizedType struct {
	Type Type `json:"ElementType"`
	Size *IntegerExpression
	Range
}

func (*ConstantSizedType) CheckEqual added in v0.13.0

func (t *ConstantSizedType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*ConstantSizedType) MarshalJSON added in v0.9.0

func (t *ConstantSizedType) MarshalJSON() ([]byte, error)

func (*ConstantSizedType) String

func (t *ConstantSizedType) String() string

type ContinueStatement

type ContinueStatement struct {
	Range
}

func (*ContinueStatement) Accept

func (s *ContinueStatement) Accept(visitor Visitor) Repr

func (*ContinueStatement) MarshalJSON added in v0.8.0

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

func (*ContinueStatement) Walk added in v0.17.0

func (*ContinueStatement) Walk(_ func(Element))

type CreateExpression

type CreateExpression struct {
	InvocationExpression *InvocationExpression
	StartPos             Position `json:"-"`
}

func (*CreateExpression) Accept

func (e *CreateExpression) Accept(visitor Visitor) Repr

func (*CreateExpression) AcceptExp

func (e *CreateExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*CreateExpression) EndPosition

func (e *CreateExpression) EndPosition() Position

func (*CreateExpression) MarshalJSON added in v0.9.0

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

func (*CreateExpression) StartPosition

func (e *CreateExpression) StartPosition() Position

func (*CreateExpression) String

func (e *CreateExpression) String() string

func (*CreateExpression) Walk added in v0.17.0

func (e *CreateExpression) Walk(walkChild func(Element))

type CreateExtractor

type CreateExtractor interface {
	ExtractCreate(extractor *ExpressionExtractor, expression *CreateExpression) ExpressionExtraction
}

type Declaration

type Declaration interface {
	Element

	DeclarationIdentifier() *Identifier
	DeclarationKind() common.DeclarationKind
	DeclarationAccess() Access
	DeclarationMembers() *Members
	DeclarationDocString() string
	// contains filtered or unexported methods
}

type DestroyExpression

type DestroyExpression struct {
	Expression Expression
	StartPos   Position `json:"-"`
}

func (*DestroyExpression) Accept

func (e *DestroyExpression) Accept(visitor Visitor) Repr

func (*DestroyExpression) AcceptExp

func (e *DestroyExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*DestroyExpression) EndPosition

func (e *DestroyExpression) EndPosition() Position

func (*DestroyExpression) MarshalJSON added in v0.9.0

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

func (*DestroyExpression) StartPosition

func (e *DestroyExpression) StartPosition() Position

func (*DestroyExpression) String

func (e *DestroyExpression) String() string

func (*DestroyExpression) Walk added in v0.17.0

func (e *DestroyExpression) Walk(walkChild func(Element))

type DestroyExtractor

type DestroyExtractor interface {
	ExtractDestroy(extractor *ExpressionExtractor, expression *DestroyExpression) ExpressionExtraction
}

type DictionaryEntry added in v0.8.0

type DictionaryEntry struct {
	Key   Expression
	Value Expression
}

func (DictionaryEntry) MarshalJSON added in v0.8.0

func (e DictionaryEntry) MarshalJSON() ([]byte, error)

type DictionaryExpression

type DictionaryExpression struct {
	Entries []DictionaryEntry
	Range
}

func (*DictionaryExpression) Accept

func (e *DictionaryExpression) Accept(visitor Visitor) Repr

func (*DictionaryExpression) AcceptExp

func (e *DictionaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*DictionaryExpression) MarshalJSON added in v0.8.0

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

func (*DictionaryExpression) String

func (e *DictionaryExpression) String() string

func (*DictionaryExpression) Walk added in v0.17.0

func (e *DictionaryExpression) Walk(walkChild func(Element))

type DictionaryExtractor

type DictionaryExtractor interface {
	ExtractDictionary(extractor *ExpressionExtractor, expression *DictionaryExpression) ExpressionExtraction
}

type DictionaryType

type DictionaryType struct {
	KeyType   Type
	ValueType Type
	Range
}

func (*DictionaryType) CheckEqual added in v0.13.0

func (t *DictionaryType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*DictionaryType) MarshalJSON added in v0.9.0

func (t *DictionaryType) MarshalJSON() ([]byte, error)

func (*DictionaryType) String

func (t *DictionaryType) String() string

type Element

type Element interface {
	HasPosition
	Accept(Visitor) Repr
	Walk(walkChild func(Element))
}

type EmitStatement

type EmitStatement struct {
	InvocationExpression *InvocationExpression
	StartPos             Position `json:"-"`
}

func (*EmitStatement) Accept

func (s *EmitStatement) Accept(visitor Visitor) Repr

func (*EmitStatement) EndPosition

func (s *EmitStatement) EndPosition() Position

func (*EmitStatement) MarshalJSON added in v0.9.0

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

func (*EmitStatement) StartPosition

func (s *EmitStatement) StartPosition() Position

func (*EmitStatement) Walk added in v0.17.0

func (s *EmitStatement) Walk(walkChild func(Element))

type EnumCaseDeclaration added in v0.10.0

type EnumCaseDeclaration struct {
	Access     Access
	Identifier Identifier
	DocString  string
	StartPos   Position `json:"-"`
}

func (*EnumCaseDeclaration) Accept added in v0.10.0

func (d *EnumCaseDeclaration) Accept(visitor Visitor) Repr

func (*EnumCaseDeclaration) DeclarationAccess added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationAccess() Access

func (*EnumCaseDeclaration) DeclarationDocString added in v0.17.0

func (d *EnumCaseDeclaration) DeclarationDocString() string

func (*EnumCaseDeclaration) DeclarationIdentifier added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationIdentifier() *Identifier

func (*EnumCaseDeclaration) DeclarationKind added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationKind() common.DeclarationKind

func (*EnumCaseDeclaration) DeclarationMembers added in v0.13.0

func (d *EnumCaseDeclaration) DeclarationMembers() *Members

func (*EnumCaseDeclaration) EndPosition added in v0.10.0

func (d *EnumCaseDeclaration) EndPosition() Position

func (*EnumCaseDeclaration) MarshalJSON added in v0.10.0

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

func (*EnumCaseDeclaration) StartPosition added in v0.10.0

func (d *EnumCaseDeclaration) StartPosition() Position

func (*EnumCaseDeclaration) Walk added in v0.17.0

func (*EnumCaseDeclaration) Walk(_ func(Element))

type Expression

type Expression interface {
	Element
	fmt.Stringer
	IfStatementTest

	AcceptExp(ExpressionVisitor) Repr
	// contains filtered or unexported methods
}

type ExpressionExtraction

type ExpressionExtraction struct {
	RewrittenExpression  Expression
	ExtractedExpressions []ExtractedExpression
}

type ExpressionExtractor

type ExpressionExtractor struct {
	BoolExtractor        BoolExtractor
	NilExtractor         NilExtractor
	IntExtractor         IntExtractor
	FixedPointExtractor  FixedPointExtractor
	StringExtractor      StringExtractor
	ArrayExtractor       ArrayExtractor
	DictionaryExtractor  DictionaryExtractor
	IdentifierExtractor  IdentifierExtractor
	InvocationExtractor  InvocationExtractor
	MemberExtractor      MemberExtractor
	IndexExtractor       IndexExtractor
	ConditionalExtractor ConditionalExtractor
	UnaryExtractor       UnaryExtractor
	BinaryExtractor      BinaryExtractor
	FunctionExtractor    FunctionExtractor
	CastingExtractor     CastingExtractor
	CreateExtractor      CreateExtractor
	DestroyExtractor     DestroyExtractor
	ReferenceExtractor   ReferenceExtractor
	ForceExtractor       ForceExtractor
	PathExtractor        PathExtractor
	// contains filtered or unexported fields
}

func (*ExpressionExtractor) Extract

func (extractor *ExpressionExtractor) Extract(expression Expression) ExpressionExtraction

func (*ExpressionExtractor) ExtractArray

func (extractor *ExpressionExtractor) ExtractArray(expression *ArrayExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractBinary

func (extractor *ExpressionExtractor) ExtractBinary(expression *BinaryExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractBool

func (extractor *ExpressionExtractor) ExtractBool(expression *BoolExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractCast

func (extractor *ExpressionExtractor) ExtractCast(expression *CastingExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractConditional

func (extractor *ExpressionExtractor) ExtractConditional(expression *ConditionalExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractCreate

func (extractor *ExpressionExtractor) ExtractCreate(expression *CreateExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractDestroy

func (extractor *ExpressionExtractor) ExtractDestroy(expression *DestroyExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractDictionary

func (extractor *ExpressionExtractor) ExtractDictionary(expression *DictionaryExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractFixedPoint

func (extractor *ExpressionExtractor) ExtractFixedPoint(expression *FixedPointExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractForce

func (extractor *ExpressionExtractor) ExtractForce(expression *ForceExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractFunction

func (extractor *ExpressionExtractor) ExtractFunction(_ *FunctionExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractIdentifier

func (extractor *ExpressionExtractor) ExtractIdentifier(expression *IdentifierExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractIndex

func (extractor *ExpressionExtractor) ExtractIndex(expression *IndexExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractInteger

func (extractor *ExpressionExtractor) ExtractInteger(expression *IntegerExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractInvocation

func (extractor *ExpressionExtractor) ExtractInvocation(expression *InvocationExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractMember

func (extractor *ExpressionExtractor) ExtractMember(expression *MemberExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractNil

func (extractor *ExpressionExtractor) ExtractNil(expression *NilExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractPath

func (extractor *ExpressionExtractor) ExtractPath(expression *PathExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractReference

func (extractor *ExpressionExtractor) ExtractReference(expression *ReferenceExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractString

func (extractor *ExpressionExtractor) ExtractString(expression *StringExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractUnary

func (extractor *ExpressionExtractor) ExtractUnary(expression *UnaryExpression) ExpressionExtraction

func (*ExpressionExtractor) FormatIdentifier

func (extractor *ExpressionExtractor) FormatIdentifier(identifier int) string

func (*ExpressionExtractor) FreshIdentifier

func (extractor *ExpressionExtractor) FreshIdentifier() string

func (*ExpressionExtractor) VisitArrayExpression

func (extractor *ExpressionExtractor) VisitArrayExpression(expression *ArrayExpression) Repr

func (*ExpressionExtractor) VisitBinaryExpression

func (extractor *ExpressionExtractor) VisitBinaryExpression(expression *BinaryExpression) Repr

func (*ExpressionExtractor) VisitBoolExpression

func (extractor *ExpressionExtractor) VisitBoolExpression(expression *BoolExpression) Repr

func (*ExpressionExtractor) VisitCastingExpression

func (extractor *ExpressionExtractor) VisitCastingExpression(expression *CastingExpression) Repr

func (*ExpressionExtractor) VisitConditionalExpression

func (extractor *ExpressionExtractor) VisitConditionalExpression(expression *ConditionalExpression) Repr

func (*ExpressionExtractor) VisitCreateExpression

func (extractor *ExpressionExtractor) VisitCreateExpression(expression *CreateExpression) Repr

func (*ExpressionExtractor) VisitDestroyExpression

func (extractor *ExpressionExtractor) VisitDestroyExpression(expression *DestroyExpression) Repr

func (*ExpressionExtractor) VisitDictionaryExpression

func (extractor *ExpressionExtractor) VisitDictionaryExpression(expression *DictionaryExpression) Repr

func (*ExpressionExtractor) VisitExpressions

func (extractor *ExpressionExtractor) VisitExpressions(
	expressions []Expression,
) (
	[]Expression, []ExtractedExpression,
)

func (*ExpressionExtractor) VisitFixedPointExpression

func (extractor *ExpressionExtractor) VisitFixedPointExpression(expression *FixedPointExpression) Repr

func (*ExpressionExtractor) VisitForceExpression

func (extractor *ExpressionExtractor) VisitForceExpression(expression *ForceExpression) Repr

func (*ExpressionExtractor) VisitFunctionExpression

func (extractor *ExpressionExtractor) VisitFunctionExpression(expression *FunctionExpression) Repr

func (*ExpressionExtractor) VisitIdentifierExpression

func (extractor *ExpressionExtractor) VisitIdentifierExpression(expression *IdentifierExpression) Repr

func (*ExpressionExtractor) VisitIndexExpression

func (extractor *ExpressionExtractor) VisitIndexExpression(expression *IndexExpression) Repr

func (*ExpressionExtractor) VisitIntegerExpression

func (extractor *ExpressionExtractor) VisitIntegerExpression(expression *IntegerExpression) Repr

func (*ExpressionExtractor) VisitInvocationExpression

func (extractor *ExpressionExtractor) VisitInvocationExpression(expression *InvocationExpression) Repr

func (*ExpressionExtractor) VisitMemberExpression

func (extractor *ExpressionExtractor) VisitMemberExpression(expression *MemberExpression) Repr

func (*ExpressionExtractor) VisitNilExpression

func (extractor *ExpressionExtractor) VisitNilExpression(expression *NilExpression) Repr

func (*ExpressionExtractor) VisitPathExpression

func (extractor *ExpressionExtractor) VisitPathExpression(expression *PathExpression) Repr

func (*ExpressionExtractor) VisitReferenceExpression

func (extractor *ExpressionExtractor) VisitReferenceExpression(expression *ReferenceExpression) Repr

func (*ExpressionExtractor) VisitStringExpression

func (extractor *ExpressionExtractor) VisitStringExpression(expression *StringExpression) Repr

func (*ExpressionExtractor) VisitUnaryExpression

func (extractor *ExpressionExtractor) VisitUnaryExpression(expression *UnaryExpression) Repr

type ExpressionStatement

type ExpressionStatement struct {
	Expression Expression
}

func (*ExpressionStatement) Accept

func (s *ExpressionStatement) Accept(visitor Visitor) Repr

func (*ExpressionStatement) EndPosition

func (s *ExpressionStatement) EndPosition() Position

func (*ExpressionStatement) MarshalJSON added in v0.8.0

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

func (*ExpressionStatement) StartPosition

func (s *ExpressionStatement) StartPosition() Position

func (*ExpressionStatement) Walk added in v0.17.0

func (s *ExpressionStatement) Walk(walkChild func(Element))

type ExpressionVisitor

type ExpressionVisitor interface {
	VisitBoolExpression(*BoolExpression) Repr
	VisitNilExpression(*NilExpression) Repr
	VisitIntegerExpression(*IntegerExpression) Repr
	VisitFixedPointExpression(*FixedPointExpression) Repr
	VisitArrayExpression(*ArrayExpression) Repr
	VisitDictionaryExpression(*DictionaryExpression) Repr
	VisitIdentifierExpression(*IdentifierExpression) Repr
	VisitInvocationExpression(*InvocationExpression) Repr
	VisitMemberExpression(*MemberExpression) Repr
	VisitIndexExpression(*IndexExpression) Repr
	VisitConditionalExpression(*ConditionalExpression) Repr
	VisitUnaryExpression(*UnaryExpression) Repr
	VisitBinaryExpression(*BinaryExpression) Repr
	VisitFunctionExpression(*FunctionExpression) Repr
	VisitStringExpression(*StringExpression) Repr
	VisitCastingExpression(*CastingExpression) Repr
	VisitCreateExpression(*CreateExpression) Repr
	VisitDestroyExpression(*DestroyExpression) Repr
	VisitReferenceExpression(*ReferenceExpression) Repr
	VisitForceExpression(*ForceExpression) Repr
	VisitPathExpression(*PathExpression) Repr
}

type ExtractedExpression

type ExtractedExpression struct {
	Identifier Identifier
	Expression Expression
}

type FieldDeclaration

type FieldDeclaration struct {
	Access         Access
	VariableKind   VariableKind
	Identifier     Identifier
	TypeAnnotation *TypeAnnotation
	DocString      string
	Range
}

func (*FieldDeclaration) Accept

func (d *FieldDeclaration) Accept(visitor Visitor) Repr

func (*FieldDeclaration) DeclarationAccess

func (d *FieldDeclaration) DeclarationAccess() Access

func (*FieldDeclaration) DeclarationDocString added in v0.17.0

func (d *FieldDeclaration) DeclarationDocString() string

func (*FieldDeclaration) DeclarationIdentifier

func (d *FieldDeclaration) DeclarationIdentifier() *Identifier

func (*FieldDeclaration) DeclarationKind

func (d *FieldDeclaration) DeclarationKind() common.DeclarationKind

func (*FieldDeclaration) DeclarationMembers added in v0.13.0

func (d *FieldDeclaration) DeclarationMembers() *Members

func (*FieldDeclaration) MarshalJSON added in v0.9.0

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

func (*FieldDeclaration) Walk added in v0.17.0

func (d *FieldDeclaration) Walk(_ func(Element))

type FixedPointExpression

type FixedPointExpression struct {
	Negative        bool
	UnsignedInteger *big.Int `json:"-"`
	Fractional      *big.Int `json:"-"`
	Scale           uint
	Range
}

func (*FixedPointExpression) Accept

func (e *FixedPointExpression) Accept(visitor Visitor) Repr

func (*FixedPointExpression) AcceptExp

func (e *FixedPointExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*FixedPointExpression) MarshalJSON added in v0.8.0

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

func (*FixedPointExpression) String

func (e *FixedPointExpression) String() string

func (*FixedPointExpression) Walk added in v0.17.0

func (*FixedPointExpression) Walk(_ func(Element))

type FixedPointExtractor

type FixedPointExtractor interface {
	ExtractFixedPoint(extractor *ExpressionExtractor, expression *FixedPointExpression) ExpressionExtraction
}

type ForStatement

type ForStatement struct {
	Identifier Identifier
	Value      Expression
	Block      *Block
	StartPos   Position `json:"-"`
}

func (*ForStatement) Accept

func (s *ForStatement) Accept(visitor Visitor) Repr

func (*ForStatement) EndPosition

func (s *ForStatement) EndPosition() Position

func (*ForStatement) MarshalJSON added in v0.8.0

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

func (*ForStatement) StartPosition

func (s *ForStatement) StartPosition() Position

func (*ForStatement) Walk added in v0.17.0

func (s *ForStatement) Walk(walkChild func(Element))

type ForceExpression

type ForceExpression struct {
	Expression Expression
	EndPos     Position `json:"-"`
}

func (*ForceExpression) Accept

func (e *ForceExpression) Accept(visitor Visitor) Repr

func (*ForceExpression) AcceptExp

func (e *ForceExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ForceExpression) EndPosition

func (e *ForceExpression) EndPosition() Position

func (*ForceExpression) MarshalJSON added in v0.9.0

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

func (*ForceExpression) StartPosition

func (e *ForceExpression) StartPosition() Position

func (*ForceExpression) String

func (e *ForceExpression) String() string

func (*ForceExpression) Walk added in v0.17.0

func (e *ForceExpression) Walk(walkChild func(Element))

type ForceExtractor

type ForceExtractor interface {
	ExtractForce(extractor *ExpressionExtractor, expression *ForceExpression) ExpressionExtraction
}

type FunctionBlock

type FunctionBlock struct {
	Block          *Block
	PreConditions  *Conditions `json:",omitempty"`
	PostConditions *Conditions `json:",omitempty"`
}

func (*FunctionBlock) Accept

func (b *FunctionBlock) Accept(visitor Visitor) Repr

func (*FunctionBlock) EndPosition added in v0.8.0

func (b *FunctionBlock) EndPosition() Position

func (*FunctionBlock) MarshalJSON added in v0.8.0

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

func (*FunctionBlock) StartPosition added in v0.8.0

func (b *FunctionBlock) StartPosition() Position

func (*FunctionBlock) Walk added in v0.17.0

func (b *FunctionBlock) Walk(walkChild func(Element))

type FunctionDeclaration

type FunctionDeclaration struct {
	Access               Access
	Identifier           Identifier
	ParameterList        *ParameterList
	ReturnTypeAnnotation *TypeAnnotation
	FunctionBlock        *FunctionBlock
	DocString            string
	StartPos             Position `json:"-"`
}

func (*FunctionDeclaration) Accept

func (d *FunctionDeclaration) Accept(visitor Visitor) Repr

func (*FunctionDeclaration) DeclarationAccess

func (d *FunctionDeclaration) DeclarationAccess() Access

func (*FunctionDeclaration) DeclarationDocString added in v0.17.0

func (d *FunctionDeclaration) DeclarationDocString() string

func (*FunctionDeclaration) DeclarationIdentifier

func (d *FunctionDeclaration) DeclarationIdentifier() *Identifier

func (*FunctionDeclaration) DeclarationKind

func (d *FunctionDeclaration) DeclarationKind() common.DeclarationKind

func (*FunctionDeclaration) DeclarationMembers added in v0.13.0

func (d *FunctionDeclaration) DeclarationMembers() *Members

func (*FunctionDeclaration) EndPosition

func (d *FunctionDeclaration) EndPosition() Position

func (*FunctionDeclaration) MarshalJSON added in v0.9.0

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

func (*FunctionDeclaration) StartPosition

func (d *FunctionDeclaration) StartPosition() Position

func (*FunctionDeclaration) ToExpression

func (d *FunctionDeclaration) ToExpression() *FunctionExpression

func (*FunctionDeclaration) Walk added in v0.17.0

func (d *FunctionDeclaration) Walk(walkChild func(Element))

type FunctionExpression

type FunctionExpression struct {
	ParameterList        *ParameterList
	ReturnTypeAnnotation *TypeAnnotation
	FunctionBlock        *FunctionBlock
	StartPos             Position `json:"-"`
}

func (*FunctionExpression) Accept

func (e *FunctionExpression) Accept(visitor Visitor) Repr

func (*FunctionExpression) AcceptExp

func (e *FunctionExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*FunctionExpression) EndPosition

func (e *FunctionExpression) EndPosition() Position

func (*FunctionExpression) MarshalJSON added in v0.9.0

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

func (*FunctionExpression) StartPosition

func (e *FunctionExpression) StartPosition() Position

func (*FunctionExpression) String

func (e *FunctionExpression) String() string

func (*FunctionExpression) Walk added in v0.17.0

func (e *FunctionExpression) Walk(walkChild func(Element))

type FunctionExtractor

type FunctionExtractor interface {
	ExtractFunction(extractor *ExpressionExtractor, expression *FunctionExpression) ExpressionExtraction
}

type FunctionType

type FunctionType struct {
	ParameterTypeAnnotations []*TypeAnnotation `json:",omitempty"`
	ReturnTypeAnnotation     *TypeAnnotation
	Range
}

func (*FunctionType) CheckEqual added in v0.13.0

func (t *FunctionType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*FunctionType) MarshalJSON added in v0.9.0

func (t *FunctionType) MarshalJSON() ([]byte, error)

func (*FunctionType) String

func (t *FunctionType) String() string

type HasPosition

type HasPosition interface {
	StartPosition() Position
	EndPosition() Position
}

type Identifier

type Identifier struct {
	Identifier string
	Pos        Position
}

func (Identifier) EndPosition

func (i Identifier) EndPosition() Position

func (Identifier) MarshalJSON added in v0.8.0

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

func (Identifier) StartPosition

func (i Identifier) StartPosition() Position

func (Identifier) String

func (i Identifier) String() string

type IdentifierExpression

type IdentifierExpression struct {
	Identifier Identifier
}

func (*IdentifierExpression) Accept

func (e *IdentifierExpression) Accept(visitor Visitor) Repr

func (*IdentifierExpression) AcceptExp

func (e *IdentifierExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IdentifierExpression) EndPosition added in v0.8.0

func (e *IdentifierExpression) EndPosition() Position

func (*IdentifierExpression) MarshalJSON added in v0.8.0

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

func (*IdentifierExpression) StartPosition added in v0.8.0

func (e *IdentifierExpression) StartPosition() Position

func (*IdentifierExpression) String

func (e *IdentifierExpression) String() string

func (*IdentifierExpression) Walk added in v0.17.0

func (*IdentifierExpression) Walk(_ func(Element))

type IdentifierExtractor

type IdentifierExtractor interface {
	ExtractIdentifier(extractor *ExpressionExtractor, expression *IdentifierExpression) ExpressionExtraction
}

type IfStatement

type IfStatement struct {
	Test     IfStatementTest
	Then     *Block
	Else     *Block
	StartPos Position `json:"-"`
}

func (*IfStatement) Accept

func (s *IfStatement) Accept(visitor Visitor) Repr

func (*IfStatement) EndPosition

func (s *IfStatement) EndPosition() Position

func (*IfStatement) MarshalJSON added in v0.8.0

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

func (*IfStatement) StartPosition

func (s *IfStatement) StartPosition() Position

func (*IfStatement) Walk added in v0.17.0

func (s *IfStatement) Walk(walkChild func(Element))

type IfStatementTest

type IfStatementTest interface {
	Element
	// contains filtered or unexported methods
}

type ImportDeclaration

type ImportDeclaration struct {
	Identifiers []Identifier
	Location    common.Location
	LocationPos Position
	Range
}

func (*ImportDeclaration) Accept

func (d *ImportDeclaration) Accept(visitor Visitor) Repr

func (*ImportDeclaration) DeclarationAccess

func (d *ImportDeclaration) DeclarationAccess() Access

func (*ImportDeclaration) DeclarationDocString added in v0.17.0

func (d *ImportDeclaration) DeclarationDocString() string

func (*ImportDeclaration) DeclarationIdentifier

func (d *ImportDeclaration) DeclarationIdentifier() *Identifier

func (*ImportDeclaration) DeclarationKind

func (d *ImportDeclaration) DeclarationKind() common.DeclarationKind

func (*ImportDeclaration) DeclarationMembers added in v0.13.0

func (d *ImportDeclaration) DeclarationMembers() *Members

func (*ImportDeclaration) MarshalJSON added in v0.9.0

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

func (*ImportDeclaration) Walk added in v0.17.0

func (*ImportDeclaration) Walk(_ func(Element))

type IndexExpression

type IndexExpression struct {
	TargetExpression   Expression
	IndexingExpression Expression
	Range
}

func (*IndexExpression) Accept

func (e *IndexExpression) Accept(visitor Visitor) Repr

func (*IndexExpression) AcceptExp

func (e *IndexExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IndexExpression) AccessedExpression

func (e *IndexExpression) AccessedExpression() Expression

func (*IndexExpression) MarshalJSON added in v0.8.0

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

func (*IndexExpression) String

func (e *IndexExpression) String() string

func (*IndexExpression) Walk added in v0.17.0

func (e *IndexExpression) Walk(walkChild func(Element))

type IndexExtractor

type IndexExtractor interface {
	ExtractIndex(extractor *ExpressionExtractor, expression *IndexExpression) ExpressionExtraction
}

type InstantiationType added in v0.5.0

type InstantiationType struct {
	Type                  Type `json:"InstantiatedType"`
	TypeArguments         []*TypeAnnotation
	TypeArgumentsStartPos Position
	EndPos                Position `json:"-"`
}

func (*InstantiationType) CheckEqual added in v0.13.0

func (t *InstantiationType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*InstantiationType) EndPosition added in v0.5.0

func (t *InstantiationType) EndPosition() Position

func (*InstantiationType) MarshalJSON added in v0.9.0

func (t *InstantiationType) MarshalJSON() ([]byte, error)

func (*InstantiationType) StartPosition added in v0.5.0

func (t *InstantiationType) StartPosition() Position

func (*InstantiationType) String added in v0.5.0

func (t *InstantiationType) String() string

type IntExtractor

type IntExtractor interface {
	ExtractInteger(extractor *ExpressionExtractor, expression *IntegerExpression) ExpressionExtraction
}

type IntegerExpression

type IntegerExpression struct {
	Value *big.Int `json:"-"`
	Base  int
	Range
}

func (*IntegerExpression) Accept

func (e *IntegerExpression) Accept(visitor Visitor) Repr

func (*IntegerExpression) AcceptExp

func (e *IntegerExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IntegerExpression) MarshalJSON added in v0.8.0

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

func (*IntegerExpression) String

func (e *IntegerExpression) String() string

func (*IntegerExpression) Walk added in v0.17.0

func (*IntegerExpression) Walk(_ func(Element))

type InterfaceDeclaration

type InterfaceDeclaration struct {
	Access        Access
	CompositeKind common.CompositeKind
	Identifier    Identifier
	Members       *Members
	DocString     string
	Range
}

func (*InterfaceDeclaration) Accept

func (d *InterfaceDeclaration) Accept(visitor Visitor) Repr

func (*InterfaceDeclaration) DeclarationAccess

func (d *InterfaceDeclaration) DeclarationAccess() Access

func (*InterfaceDeclaration) DeclarationDocString added in v0.17.0

func (d *InterfaceDeclaration) DeclarationDocString() string

func (*InterfaceDeclaration) DeclarationIdentifier

func (d *InterfaceDeclaration) DeclarationIdentifier() *Identifier

func (*InterfaceDeclaration) DeclarationKind

func (d *InterfaceDeclaration) DeclarationKind() common.DeclarationKind

func (*InterfaceDeclaration) DeclarationMembers added in v0.13.0

func (d *InterfaceDeclaration) DeclarationMembers() *Members

func (*InterfaceDeclaration) MarshalJSON added in v0.9.0

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

func (*InterfaceDeclaration) Walk added in v0.17.0

func (d *InterfaceDeclaration) Walk(walkChild func(Element))

type InvocationExpression

type InvocationExpression struct {
	InvokedExpression Expression
	TypeArguments     []*TypeAnnotation
	Arguments         Arguments
	ArgumentsStartPos Position
	EndPos            Position `json:"-"`
}

func (*InvocationExpression) Accept

func (e *InvocationExpression) Accept(visitor Visitor) Repr

func (*InvocationExpression) AcceptExp

func (e *InvocationExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*InvocationExpression) EndPosition

func (e *InvocationExpression) EndPosition() Position

func (*InvocationExpression) MarshalJSON added in v0.9.0

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

func (*InvocationExpression) StartPosition

func (e *InvocationExpression) StartPosition() Position

func (*InvocationExpression) String

func (e *InvocationExpression) String() string

func (*InvocationExpression) Walk added in v0.17.0

func (e *InvocationExpression) Walk(walkChild func(Element))

type InvocationExtractor

type InvocationExtractor interface {
	ExtractInvocation(extractor *ExpressionExtractor, expression *InvocationExpression) ExpressionExtraction
}

type MemberExpression

type MemberExpression struct {
	Expression Expression
	Optional   bool
	// The position of the token (`.`, `?.`) that separates the accessed expression
	// and the identifier of the member
	AccessPos  Position
	Identifier Identifier
}

func (*MemberExpression) Accept

func (e *MemberExpression) Accept(visitor Visitor) Repr

func (*MemberExpression) AcceptExp

func (e *MemberExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*MemberExpression) AccessedExpression

func (e *MemberExpression) AccessedExpression() Expression

func (*MemberExpression) EndPosition

func (e *MemberExpression) EndPosition() Position

func (*MemberExpression) MarshalJSON added in v0.8.0

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

func (*MemberExpression) StartPosition

func (e *MemberExpression) StartPosition() Position

func (*MemberExpression) String

func (e *MemberExpression) String() string

func (*MemberExpression) Walk added in v0.17.0

func (e *MemberExpression) Walk(walkChild func(Element))

type MemberExtractor

type MemberExtractor interface {
	ExtractMember(extractor *ExpressionExtractor, expression *MemberExpression) ExpressionExtraction
}

type Members

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

func NewMembers added in v0.12.6

func NewMembers(declarations []Declaration) *Members

func (*Members) Composites added in v0.10.0

func (m *Members) Composites() []*CompositeDeclaration

func (*Members) CompositesByIdentifier added in v0.13.0

func (m *Members) CompositesByIdentifier() map[string]*CompositeDeclaration

func (*Members) Declarations added in v0.9.0

func (m *Members) Declarations() []Declaration

func (*Members) Destructor

func (m *Members) Destructor() *SpecialFunctionDeclaration

Destructor returns the first destructor, if any

func (*Members) Destructors

func (m *Members) Destructors() []*SpecialFunctionDeclaration

func (*Members) EnumCases added in v0.10.0

func (m *Members) EnumCases() []*EnumCaseDeclaration

func (*Members) FieldPosition

func (m *Members) FieldPosition(name string, compositeKind common.CompositeKind) Position

func (*Members) Fields

func (m *Members) Fields() []*FieldDeclaration

func (*Members) FieldsByIdentifier

func (m *Members) FieldsByIdentifier() map[string]*FieldDeclaration

func (*Members) Functions

func (m *Members) Functions() []*FunctionDeclaration

func (*Members) FunctionsByIdentifier

func (m *Members) FunctionsByIdentifier() map[string]*FunctionDeclaration

func (*Members) Initializers

func (m *Members) Initializers() []*SpecialFunctionDeclaration

func (*Members) Interfaces added in v0.10.0

func (m *Members) Interfaces() []*InterfaceDeclaration

func (*Members) InterfacesByIdentifier added in v0.13.0

func (m *Members) InterfacesByIdentifier() map[string]*InterfaceDeclaration

func (*Members) MarshalJSON added in v0.12.6

func (m *Members) MarshalJSON() ([]byte, error)

func (*Members) SpecialFunctions

func (m *Members) SpecialFunctions() []*SpecialFunctionDeclaration

type NilExpression

type NilExpression struct {
	Pos Position `json:"-"`
}

func (*NilExpression) Accept

func (e *NilExpression) Accept(visitor Visitor) Repr

func (*NilExpression) AcceptExp

func (e *NilExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*NilExpression) EndPosition

func (e *NilExpression) EndPosition() Position

func (*NilExpression) MarshalJSON added in v0.5.0

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

func (*NilExpression) StartPosition

func (e *NilExpression) StartPosition() Position

func (*NilExpression) String

func (e *NilExpression) String() string

func (*NilExpression) Walk added in v0.17.0

func (*NilExpression) Walk(_ func(Element))

type NilExtractor

type NilExtractor interface {
	ExtractNil(extractor *ExpressionExtractor, expression *NilExpression) ExpressionExtraction
}

type NominalType

type NominalType struct {
	Identifier        Identifier
	NestedIdentifiers []Identifier `json:",omitempty"`
}

func (*NominalType) CheckEqual added in v0.13.0

func (t *NominalType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*NominalType) EndPosition

func (t *NominalType) EndPosition() Position

func (*NominalType) IsQualifiedName added in v0.13.0

func (t *NominalType) IsQualifiedName() bool

func (*NominalType) MarshalJSON added in v0.9.0

func (t *NominalType) MarshalJSON() ([]byte, error)

func (*NominalType) StartPosition

func (t *NominalType) StartPosition() Position

func (*NominalType) String

func (t *NominalType) String() string

type NotAnElement

type NotAnElement struct{}

func (NotAnElement) Accept

func (NotAnElement) Accept(Visitor) Repr

func (NotAnElement) EndPosition

func (NotAnElement) EndPosition() Position

func (NotAnElement) StartPosition

func (NotAnElement) StartPosition() Position

func (NotAnElement) Walk added in v0.17.0

func (NotAnElement) Walk(_ func(Element))

type Operation

type Operation uint
const (
	OperationUnknown Operation = iota
	OperationOr
	OperationAnd
	OperationEqual
	OperationNotEqual
	OperationLess
	OperationGreater
	OperationLessEqual
	OperationGreaterEqual
	OperationPlus
	OperationMinus
	OperationMul
	OperationDiv
	OperationMod
	OperationNegate
	OperationNilCoalesce
	OperationMove
	OperationCast
	OperationFailableCast
	OperationForceCast
	OperationBitwiseOr
	OperationBitwiseXor
	OperationBitwiseAnd
	OperationBitwiseLeftShift
	OperationBitwiseRightShift
)

func (Operation) MarshalJSON added in v0.8.0

func (s Operation) MarshalJSON() ([]byte, error)

func (Operation) String

func (i Operation) String() string

func (Operation) Symbol

func (s Operation) Symbol() string

type OptionalType

type OptionalType struct {
	Type   Type     `json:"ElementType"`
	EndPos Position `json:"-"`
}

func (*OptionalType) CheckEqual added in v0.13.0

func (t *OptionalType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*OptionalType) EndPosition

func (t *OptionalType) EndPosition() Position

func (*OptionalType) MarshalJSON added in v0.9.0

func (t *OptionalType) MarshalJSON() ([]byte, error)

func (*OptionalType) StartPosition

func (t *OptionalType) StartPosition() Position

func (*OptionalType) String

func (t *OptionalType) String() string

type Parameter

type Parameter struct {
	Label          string
	Identifier     Identifier
	TypeAnnotation *TypeAnnotation
	Range
}

func (Parameter) EffectiveArgumentLabel

func (p Parameter) EffectiveArgumentLabel() string

EffectiveArgumentLabel returns the effective argument label that an argument in a call must use: If no argument label is declared for parameter, the parameter name is used as the argument label

type ParameterList

type ParameterList struct {
	Parameters []*Parameter

	Range
	// contains filtered or unexported fields
}

func (*ParameterList) EffectiveArgumentLabels

func (l *ParameterList) EffectiveArgumentLabels() []string

EffectiveArgumentLabels returns the effective argument labels that the arguments of a call must use: If no argument label is declared for parameter, the parameter name is used as the argument label

func (*ParameterList) ParametersByIdentifier

func (l *ParameterList) ParametersByIdentifier() map[string]*Parameter

type PathExpression

type PathExpression struct {
	StartPos   Position `json:"-"`
	Domain     Identifier
	Identifier Identifier
}

func (*PathExpression) Accept

func (e *PathExpression) Accept(visitor Visitor) Repr

func (*PathExpression) AcceptExp

func (e *PathExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*PathExpression) EndPosition

func (e *PathExpression) EndPosition() Position

func (*PathExpression) MarshalJSON added in v0.8.0

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

func (*PathExpression) StartPosition

func (e *PathExpression) StartPosition() Position

func (*PathExpression) String

func (e *PathExpression) String() string

func (*PathExpression) Walk added in v0.17.0

func (*PathExpression) Walk(_ func(Element))

type PathExtractor

type PathExtractor interface {
	ExtractPath(extractor *ExpressionExtractor, expression *PathExpression) ExpressionExtraction
}

type Position

type Position struct {
	// offset, starting at 0
	Offset int
	// line number, starting at 1
	Line int
	// column number, starting at 0 (byte count)
	Column int
}

Position defines a row/column within a Cadence script.

func EndPosition

func EndPosition(startPosition Position, end int) Position

func (Position) Compare

func (position Position) Compare(other Position) int

func (Position) Shifted

func (position Position) Shifted(length int) Position

func (Position) String added in v0.16.0

func (position Position) String() string

type PragmaDeclaration added in v0.7.0

type PragmaDeclaration struct {
	Expression Expression
	Range
}

func (*PragmaDeclaration) Accept added in v0.7.0

func (d *PragmaDeclaration) Accept(visitor Visitor) Repr

func (*PragmaDeclaration) DeclarationAccess added in v0.7.0

func (d *PragmaDeclaration) DeclarationAccess() Access

func (*PragmaDeclaration) DeclarationDocString added in v0.17.0

func (d *PragmaDeclaration) DeclarationDocString() string

func (*PragmaDeclaration) DeclarationIdentifier added in v0.7.0

func (d *PragmaDeclaration) DeclarationIdentifier() *Identifier

func (*PragmaDeclaration) DeclarationKind added in v0.7.0

func (d *PragmaDeclaration) DeclarationKind() common.DeclarationKind

func (*PragmaDeclaration) DeclarationMembers added in v0.13.0

func (d *PragmaDeclaration) DeclarationMembers() *Members

func (*PragmaDeclaration) MarshalJSON added in v0.9.0

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

func (*PragmaDeclaration) Walk added in v0.17.0

func (d *PragmaDeclaration) Walk(walkChild func(Element))

type Program

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

func NewProgram added in v0.12.6

func NewProgram(declarations []Declaration) *Program

func (*Program) Accept

func (p *Program) Accept(visitor Visitor) Repr

func (*Program) CompositeDeclarations

func (p *Program) CompositeDeclarations() []*CompositeDeclaration

func (*Program) Declarations

func (p *Program) Declarations() []Declaration

func (*Program) EndPosition

func (p *Program) EndPosition() Position

func (*Program) FunctionDeclarations

func (p *Program) FunctionDeclarations() []*FunctionDeclaration

func (*Program) ImportDeclarations

func (p *Program) ImportDeclarations() []*ImportDeclaration

func (*Program) InterfaceDeclarations

func (p *Program) InterfaceDeclarations() []*InterfaceDeclaration

func (*Program) MarshalJSON added in v0.10.0

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

func (*Program) PragmaDeclarations added in v0.7.0

func (p *Program) PragmaDeclarations() []*PragmaDeclaration

func (*Program) SoleContractDeclaration added in v0.11.0

func (p *Program) SoleContractDeclaration() *CompositeDeclaration

SoleContractDeclaration returns the sole contract declaration, if any, and if there are no other actionable declarations.

func (*Program) SoleContractInterfaceDeclaration added in v0.11.0

func (p *Program) SoleContractInterfaceDeclaration() *InterfaceDeclaration

SoleContractInterfaceDeclaration returns the sole contract interface declaration, if any, and if there are no other actionable declarations.

func (*Program) SoleTransactionDeclaration added in v0.11.0

func (p *Program) SoleTransactionDeclaration() *TransactionDeclaration

SoleTransactionDeclaration returns the sole transaction declaration, if any, and if there are no other actionable declarations.

func (*Program) StartPosition

func (p *Program) StartPosition() Position

func (*Program) TransactionDeclarations

func (p *Program) TransactionDeclarations() []*TransactionDeclaration

func (*Program) VariableDeclarations added in v0.17.0

func (p *Program) VariableDeclarations() []*VariableDeclaration

func (*Program) Walk added in v0.17.0

func (d *Program) Walk(walkChild func(Element))

type Range

type Range struct {
	StartPos Position
	EndPos   Position
}

func NewRangeFromPositioned

func NewRangeFromPositioned(hasPosition HasPosition) Range

func (Range) EndPosition

func (e Range) EndPosition() Position

func (Range) StartPosition

func (e Range) StartPosition() Position

type ReferenceExpression

type ReferenceExpression struct {
	Expression Expression
	Type       Type     `json:"TargetType"`
	StartPos   Position `json:"-"`
}

func (*ReferenceExpression) Accept

func (e *ReferenceExpression) Accept(visitor Visitor) Repr

func (*ReferenceExpression) AcceptExp

func (e *ReferenceExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ReferenceExpression) EndPosition

func (e *ReferenceExpression) EndPosition() Position

func (*ReferenceExpression) MarshalJSON added in v0.9.0

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

func (*ReferenceExpression) StartPosition

func (e *ReferenceExpression) StartPosition() Position

func (*ReferenceExpression) String

func (e *ReferenceExpression) String() string

func (*ReferenceExpression) Walk added in v0.17.0

func (e *ReferenceExpression) Walk(walkChild func(Element))

type ReferenceExtractor

type ReferenceExtractor interface {
	ExtractReference(extractor *ExpressionExtractor, expression *ReferenceExpression) ExpressionExtraction
}

type ReferenceType

type ReferenceType struct {
	Authorized bool
	Type       Type     `json:"ReferencedType"`
	StartPos   Position `json:"-"`
}

func (*ReferenceType) CheckEqual added in v0.13.0

func (t *ReferenceType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*ReferenceType) EndPosition

func (t *ReferenceType) EndPosition() Position

func (*ReferenceType) MarshalJSON added in v0.9.0

func (t *ReferenceType) MarshalJSON() ([]byte, error)

func (*ReferenceType) StartPosition

func (t *ReferenceType) StartPosition() Position

func (*ReferenceType) String

func (t *ReferenceType) String() string

type Repr

type Repr interface{}

type RestrictedType

type RestrictedType struct {
	Type         Type `json:"RestrictedType"`
	Restrictions []*NominalType
	Range
}

func (*RestrictedType) CheckEqual added in v0.13.0

func (t *RestrictedType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*RestrictedType) MarshalJSON added in v0.9.0

func (t *RestrictedType) MarshalJSON() ([]byte, error)

func (*RestrictedType) String

func (t *RestrictedType) String() string

type ReturnStatement

type ReturnStatement struct {
	Expression Expression
	Range
}

func (*ReturnStatement) Accept

func (s *ReturnStatement) Accept(visitor Visitor) Repr

func (*ReturnStatement) MarshalJSON added in v0.8.0

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

func (*ReturnStatement) Walk added in v0.17.0

func (s *ReturnStatement) Walk(walkChild func(Element))

type SpecialFunctionDeclaration

type SpecialFunctionDeclaration struct {
	Kind                common.DeclarationKind
	FunctionDeclaration *FunctionDeclaration
}

func (*SpecialFunctionDeclaration) Accept added in v0.9.0

func (d *SpecialFunctionDeclaration) Accept(visitor Visitor) Repr

func (*SpecialFunctionDeclaration) DeclarationAccess added in v0.9.0

func (d *SpecialFunctionDeclaration) DeclarationAccess() Access

func (*SpecialFunctionDeclaration) DeclarationDocString added in v0.17.0

func (d *SpecialFunctionDeclaration) DeclarationDocString() string

func (*SpecialFunctionDeclaration) DeclarationIdentifier added in v0.9.0

func (d *SpecialFunctionDeclaration) DeclarationIdentifier() *Identifier

func (*SpecialFunctionDeclaration) DeclarationKind

func (d *SpecialFunctionDeclaration) DeclarationKind() common.DeclarationKind

func (*SpecialFunctionDeclaration) DeclarationMembers added in v0.13.0

func (d *SpecialFunctionDeclaration) DeclarationMembers() *Members

func (*SpecialFunctionDeclaration) EndPosition added in v0.9.0

func (d *SpecialFunctionDeclaration) EndPosition() Position

func (*SpecialFunctionDeclaration) MarshalJSON added in v0.9.0

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

func (*SpecialFunctionDeclaration) StartPosition added in v0.9.0

func (d *SpecialFunctionDeclaration) StartPosition() Position

func (*SpecialFunctionDeclaration) Walk added in v0.17.0

func (d *SpecialFunctionDeclaration) Walk(walkChild func(Element))

type Statement

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

type StatementVisitor

type StatementVisitor interface {
	VisitReturnStatement(*ReturnStatement) Repr
	VisitBreakStatement(*BreakStatement) Repr
	VisitContinueStatement(*ContinueStatement) Repr
	VisitIfStatement(*IfStatement) Repr
	VisitSwitchStatement(*SwitchStatement) Repr
	VisitWhileStatement(*WhileStatement) Repr
	VisitForStatement(*ForStatement) Repr
	VisitEmitStatement(*EmitStatement) Repr
	VisitVariableDeclaration(*VariableDeclaration) Repr
	VisitAssignmentStatement(*AssignmentStatement) Repr
	VisitSwapStatement(*SwapStatement) Repr
	VisitExpressionStatement(*ExpressionStatement) Repr
}

type StringExpression

type StringExpression struct {
	Value string
	Range
}

func (*StringExpression) Accept

func (e *StringExpression) Accept(visitor Visitor) Repr

func (*StringExpression) AcceptExp

func (e *StringExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*StringExpression) MarshalJSON added in v0.8.0

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

func (*StringExpression) String

func (e *StringExpression) String() string

func (*StringExpression) Walk added in v0.17.0

func (*StringExpression) Walk(_ func(Element))

type StringExtractor

type StringExtractor interface {
	ExtractString(extractor *ExpressionExtractor, expression *StringExpression) ExpressionExtraction
}

type SwapStatement

type SwapStatement struct {
	Left  Expression
	Right Expression
}

func (*SwapStatement) Accept

func (s *SwapStatement) Accept(visitor Visitor) Repr

func (*SwapStatement) EndPosition

func (s *SwapStatement) EndPosition() Position

func (*SwapStatement) MarshalJSON added in v0.9.0

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

func (*SwapStatement) StartPosition

func (s *SwapStatement) StartPosition() Position

func (*SwapStatement) Walk added in v0.17.0

func (s *SwapStatement) Walk(walkChild func(Element))

type SwitchCase added in v0.10.0

type SwitchCase struct {
	Expression Expression
	Statements []Statement
	Range
}

func (*SwitchCase) MarshalJSON added in v0.10.0

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

type SwitchStatement added in v0.10.0

type SwitchStatement struct {
	Expression Expression
	Cases      []*SwitchCase
	Range
}

func (*SwitchStatement) Accept added in v0.10.0

func (s *SwitchStatement) Accept(visitor Visitor) Repr

func (*SwitchStatement) MarshalJSON added in v0.10.0

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

func (*SwitchStatement) Walk added in v0.17.0

func (s *SwitchStatement) Walk(walkChild func(Element))

type TransactionDeclaration

type TransactionDeclaration struct {
	ParameterList  *ParameterList
	Fields         []*FieldDeclaration
	Prepare        *SpecialFunctionDeclaration
	PreConditions  *Conditions
	Execute        *SpecialFunctionDeclaration
	PostConditions *Conditions
	DocString      string
	Range
}

func (*TransactionDeclaration) Accept

func (d *TransactionDeclaration) Accept(visitor Visitor) Repr

func (*TransactionDeclaration) DeclarationAccess

func (d *TransactionDeclaration) DeclarationAccess() Access

func (*TransactionDeclaration) DeclarationDocString added in v0.17.0

func (d *TransactionDeclaration) DeclarationDocString() string

func (*TransactionDeclaration) DeclarationIdentifier

func (d *TransactionDeclaration) DeclarationIdentifier() *Identifier

func (*TransactionDeclaration) DeclarationKind

func (d *TransactionDeclaration) DeclarationKind() common.DeclarationKind

func (*TransactionDeclaration) DeclarationMembers added in v0.13.0

func (d *TransactionDeclaration) DeclarationMembers() *Members

func (*TransactionDeclaration) MarshalJSON added in v0.9.0

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

func (*TransactionDeclaration) Walk added in v0.17.0

func (d *TransactionDeclaration) Walk(walkChild func(Element))

type Transfer

type Transfer struct {
	Operation TransferOperation
	Pos       Position `json:"-"`
}

Transfer represents the operation in variable declarations and assignments

func (Transfer) EndPosition

func (f Transfer) EndPosition() Position

func (Transfer) MarshalJSON added in v0.8.0

func (f Transfer) MarshalJSON() ([]byte, error)

func (Transfer) StartPosition

func (f Transfer) StartPosition() Position

type TransferOperation

type TransferOperation uint
const (
	TransferOperationUnknown TransferOperation = iota
	TransferOperationCopy
	TransferOperationMove
	TransferOperationMoveForced
)

func (TransferOperation) IsMove

func (k TransferOperation) IsMove() bool

func (TransferOperation) MarshalJSON added in v0.8.0

func (k TransferOperation) MarshalJSON() ([]byte, error)

func (TransferOperation) Operator

func (k TransferOperation) Operator() string

func (TransferOperation) String

func (i TransferOperation) String() string

type Type

type Type interface {
	HasPosition
	fmt.Stringer

	CheckEqual(other Type, checker TypeEqualityChecker) error
	// contains filtered or unexported methods
}

func ExpressionAsType

func ExpressionAsType(expression Expression) Type

ExpressionAsType attempts to convert an expression to a type. Some expressions can be considered both an expression and a type

type TypeAnnotation

type TypeAnnotation struct {
	IsResource bool
	Type       Type     `json:"AnnotatedType"`
	StartPos   Position `json:"-"`
}

func (*TypeAnnotation) EndPosition

func (t *TypeAnnotation) EndPosition() Position

func (*TypeAnnotation) MarshalJSON added in v0.9.0

func (t *TypeAnnotation) MarshalJSON() ([]byte, error)

func (*TypeAnnotation) StartPosition

func (t *TypeAnnotation) StartPosition() Position

func (*TypeAnnotation) String

func (t *TypeAnnotation) String() string

type TypeEqualityChecker added in v0.13.0

type TypeEqualityChecker interface {
	CheckNominalTypeEquality(*NominalType, Type) error
	CheckOptionalTypeEquality(*OptionalType, Type) error
	CheckVariableSizedTypeEquality(*VariableSizedType, Type) error
	CheckConstantSizedTypeEquality(*ConstantSizedType, Type) error
	CheckDictionaryTypeEquality(*DictionaryType, Type) error
	CheckFunctionTypeEquality(*FunctionType, Type) error
	CheckReferenceTypeEquality(*ReferenceType, Type) error
	CheckRestrictedTypeEquality(*RestrictedType, Type) error
	CheckInstantiationTypeEquality(*InstantiationType, Type) error
}

type UnaryExpression

type UnaryExpression struct {
	Operation  Operation
	Expression Expression
	StartPos   Position `json:"-"`
}

func (*UnaryExpression) Accept

func (e *UnaryExpression) Accept(visitor Visitor) Repr

func (*UnaryExpression) AcceptExp

func (e *UnaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*UnaryExpression) EndPosition added in v0.2.1

func (e *UnaryExpression) EndPosition() Position

func (*UnaryExpression) MarshalJSON added in v0.9.0

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

func (*UnaryExpression) StartPosition added in v0.2.1

func (e *UnaryExpression) StartPosition() Position

func (*UnaryExpression) String

func (e *UnaryExpression) String() string

func (*UnaryExpression) Walk added in v0.17.0

func (e *UnaryExpression) Walk(walkChild func(Element))

type UnaryExtractor

type UnaryExtractor interface {
	ExtractUnary(extractor *ExpressionExtractor, expression *UnaryExpression) ExpressionExtraction
}

type VariableDeclaration

type VariableDeclaration struct {
	Access            Access
	IsConstant        bool
	Identifier        Identifier
	TypeAnnotation    *TypeAnnotation
	Value             Expression
	Transfer          *Transfer
	StartPos          Position `json:"-"`
	SecondTransfer    *Transfer
	SecondValue       Expression
	ParentIfStatement *IfStatement `json:"-"`
	DocString         string
}

func (*VariableDeclaration) Accept

func (d *VariableDeclaration) Accept(visitor Visitor) Repr

func (*VariableDeclaration) DeclarationAccess

func (d *VariableDeclaration) DeclarationAccess() Access

func (*VariableDeclaration) DeclarationDocString added in v0.17.0

func (d *VariableDeclaration) DeclarationDocString() string

func (*VariableDeclaration) DeclarationIdentifier

func (d *VariableDeclaration) DeclarationIdentifier() *Identifier

func (*VariableDeclaration) DeclarationKind

func (d *VariableDeclaration) DeclarationKind() common.DeclarationKind

func (*VariableDeclaration) DeclarationMembers added in v0.13.0

func (d *VariableDeclaration) DeclarationMembers() *Members

func (*VariableDeclaration) EndPosition

func (d *VariableDeclaration) EndPosition() Position

func (*VariableDeclaration) MarshalJSON added in v0.9.0

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

func (*VariableDeclaration) StartPosition

func (d *VariableDeclaration) StartPosition() Position

func (*VariableDeclaration) Walk added in v0.17.0

func (d *VariableDeclaration) Walk(walkChild func(Element))

type VariableKind

type VariableKind uint
const (
	VariableKindNotSpecified VariableKind = iota
	VariableKindVariable
	VariableKindConstant
)

func (VariableKind) Keyword

func (k VariableKind) Keyword() string

func (VariableKind) MarshalJSON added in v0.8.0

func (k VariableKind) MarshalJSON() ([]byte, error)

func (VariableKind) Name

func (k VariableKind) Name() string

func (VariableKind) String

func (i VariableKind) String() string

type VariableSizedType

type VariableSizedType struct {
	Type Type `json:"ElementType"`
	Range
}

func (*VariableSizedType) CheckEqual added in v0.13.0

func (t *VariableSizedType) CheckEqual(other Type, checker TypeEqualityChecker) error

func (*VariableSizedType) MarshalJSON added in v0.9.0

func (t *VariableSizedType) MarshalJSON() ([]byte, error)

func (*VariableSizedType) String

func (t *VariableSizedType) String() string

type Visitor

type Visitor interface {
	StatementVisitor
	ExpressionVisitor
	VisitProgram(*Program) Repr
	VisitFunctionDeclaration(*FunctionDeclaration) Repr
	VisitBlock(*Block) Repr
	VisitFunctionBlock(*FunctionBlock) Repr
	VisitCompositeDeclaration(*CompositeDeclaration) Repr
	VisitInterfaceDeclaration(*InterfaceDeclaration) Repr
	VisitFieldDeclaration(*FieldDeclaration) Repr
	VisitEnumCaseDeclaration(*EnumCaseDeclaration) Repr
	VisitPragmaDeclaration(*PragmaDeclaration) Repr
	VisitImportDeclaration(*ImportDeclaration) Repr
	VisitTransactionDeclaration(*TransactionDeclaration) Repr
}

type Walker added in v0.17.0

type Walker interface {
	Walk(element Element) Walker
}

type WhileStatement

type WhileStatement struct {
	Test     Expression
	Block    *Block
	StartPos Position `json:"-"`
}

func (*WhileStatement) Accept

func (s *WhileStatement) Accept(visitor Visitor) Repr

func (*WhileStatement) EndPosition

func (s *WhileStatement) EndPosition() Position

func (*WhileStatement) MarshalJSON added in v0.8.0

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

func (*WhileStatement) StartPosition

func (s *WhileStatement) StartPosition() Position

func (*WhileStatement) Walk added in v0.17.0

func (s *WhileStatement) Walk(walkChild func(Element))

Jump to

Keyboard shortcuts

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