ast

package
v0.31.5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 10 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

View Source
var EmptyPosition = Position{}
View Source
var EmptyRange = Range{}

Functions

func AcceptDeclaration added in v0.27.0

func AcceptDeclaration[T any](declaration Declaration, visitor DeclarationVisitor[T]) (_ T)

func AcceptExpression added in v0.27.0

func AcceptExpression[T any](expression Expression, visitor ExpressionVisitor[T]) (_ T)

func AcceptStatement added in v0.27.0

func AcceptStatement[T any](statement Statement, visitor StatementVisitor[T]) (_ T)

func AccessCount added in v0.5.0

func AccessCount() int

func CompositeDocument added in v0.25.0

func CompositeDocument(
	access Access,
	kind common.CompositeKind,
	isInterface bool,
	identifier string,
	conformances []*NominalType,
	members *Members,
) prettier.Doc

func ConditionKindCount added in v0.5.0

func ConditionKindCount() int

func FunctionDocument added in v0.25.0

func FunctionDocument(
	access Access,
	isStatic bool,
	isNative bool,
	includeKeyword bool,
	identifier string,
	parameterList *ParameterList,
	returnTypeAnnotation *TypeAnnotation,
	block *FunctionBlock,
) prettier.Doc

func Inspect added in v0.17.0

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

func IsEmptyType added in v0.24.0

func IsEmptyType(t Type) bool

func LocationDoc added in v0.25.0

func LocationDoc(location common.Location) prettier.Doc

func OperationCount added in v0.8.0

func OperationCount() int

func Prettier added in v0.25.0

func Prettier(element interface{ Doc() prettier.Doc }) string

func QuoteString added in v0.24.0

func QuoteString(s string) string

func StatementsDoc added in v0.24.0

func StatementsDoc(statements []Statement) prettier.Doc

func TransferOperationCount added in v0.8.0

func TransferOperationCount() int

func VariableKindCount added in v0.8.0

func VariableKindCount() int

func VariableKindDoc added in v0.25.0

func VariableKindDoc(kind VariableKind) prettier.Doc

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 {
	Expression           Expression
	LabelStartPos        *Position `json:",omitempty"`
	LabelEndPos          *Position `json:",omitempty"`
	Label                string    `json:",omitempty"`
	TrailingSeparatorPos Position
}

func NewArgument added in v0.24.0

func NewArgument(
	memoryGauge common.MemoryGauge,
	label string,
	labelStartPos,
	labelEndPos *Position,
	expression Expression,
) *Argument

func NewUnlabeledArgument added in v0.24.0

func NewUnlabeledArgument(memoryGauge common.MemoryGauge, expression Expression) *Argument

func (*Argument) Doc added in v0.25.0

func (a *Argument) Doc() prettier.Doc

func (*Argument) EndPosition added in v0.5.0

func (a *Argument) EndPosition(memoryGauge common.MemoryGauge) 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) Doc added in v0.25.0

func (args Arguments) Doc() prettier.Doc

func (Arguments) String

func (args Arguments) String() string

type ArrayExpression

type ArrayExpression struct {
	Values []Expression
	Range
}

func NewArrayExpression added in v0.24.0

func NewArrayExpression(
	gauge common.MemoryGauge,
	values []Expression,
	tokenRange Range,
) *ArrayExpression

func (*ArrayExpression) Doc added in v0.24.0

func (e *ArrayExpression) Doc() prettier.Doc

func (*ArrayExpression) ElementType added in v0.25.0

func (*ArrayExpression) ElementType() ElementType

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 NewAssignmentStatement added in v0.24.0

func NewAssignmentStatement(
	gauge common.MemoryGauge,
	expression Expression,
	transfer *Transfer,
	value Expression,
) *AssignmentStatement

func (*AssignmentStatement) Doc added in v0.24.0

func (s *AssignmentStatement) Doc() prettier.Doc

func (*AssignmentStatement) ElementType added in v0.25.0

func (*AssignmentStatement) ElementType() ElementType

func (*AssignmentStatement) EndPosition

func (s *AssignmentStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *AssignmentStatement) String() string

func (*AssignmentStatement) Walk added in v0.17.0

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

type BinaryExpression

type BinaryExpression struct {
	Left      Expression
	Right     Expression
	Operation Operation
}

func NewBinaryExpression added in v0.24.0

func NewBinaryExpression(
	gauge common.MemoryGauge,
	operation Operation,
	left Expression,
	right Expression,
) *BinaryExpression

func (*BinaryExpression) Doc added in v0.24.0

func (e *BinaryExpression) Doc() prettier.Doc

func (*BinaryExpression) ElementType added in v0.25.0

func (*BinaryExpression) ElementType() ElementType

func (*BinaryExpression) EndPosition

func (e *BinaryExpression) EndPosition(memoryGauge common.MemoryGauge) Position

func (*BinaryExpression) IsLeftAssociative added in v0.25.0

func (e *BinaryExpression) IsLeftAssociative() bool

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 NewBlock added in v0.24.0

func NewBlock(memoryGauge common.MemoryGauge, statements []Statement, astRange Range) *Block

func (*Block) Doc added in v0.24.0

func (b *Block) Doc() prettier.Doc

func (*Block) ElementType added in v0.25.0

func (*Block) ElementType() ElementType

func (*Block) IsEmpty added in v0.24.0

func (b *Block) IsEmpty() bool

func (*Block) MarshalJSON added in v0.8.0

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

func (*Block) String added in v0.25.0

func (b *Block) String() string

func (*Block) Walk added in v0.17.0

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

type BoolExpression

type BoolExpression struct {
	Value bool
	Range
}

func NewBoolExpression added in v0.24.0

func NewBoolExpression(gauge common.MemoryGauge, value bool, exprRange Range) *BoolExpression

func (*BoolExpression) Doc added in v0.24.0

func (e *BoolExpression) Doc() prettier.Doc

func (*BoolExpression) ElementType added in v0.25.0

func (*BoolExpression) ElementType() ElementType

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 NewBreakStatement added in v0.24.0

func NewBreakStatement(gauge common.MemoryGauge, tokenRange Range) *BreakStatement

func (*BreakStatement) Doc added in v0.24.0

func (*BreakStatement) Doc() prettier.Doc

func (*BreakStatement) ElementType added in v0.25.0

func (*BreakStatement) ElementType() ElementType

func (*BreakStatement) MarshalJSON added in v0.8.0

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

func (*BreakStatement) String added in v0.25.0

func (s *BreakStatement) String() string

func (*BreakStatement) Walk added in v0.17.0

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

type CastingExpression

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

func NewCastingExpression added in v0.24.0

func NewCastingExpression(
	gauge common.MemoryGauge,
	expression Expression,
	operation Operation,
	typeAnnotation *TypeAnnotation,
	parentVariableDecl *VariableDeclaration,
) *CastingExpression

func (*CastingExpression) Doc added in v0.24.0

func (e *CastingExpression) Doc() prettier.Doc

func (*CastingExpression) ElementType added in v0.25.0

func (*CastingExpression) ElementType() ElementType

func (*CastingExpression) EndPosition

func (e *CastingExpression) EndPosition(memoryGauge common.MemoryGauge) 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 {
	Members      *Members
	DocString    string
	Conformances []*NominalType
	Identifier   Identifier
	Range
	Access        Access
	CompositeKind common.CompositeKind
}

func NewCompositeDeclaration added in v0.24.0

func NewCompositeDeclaration(
	memoryGauge common.MemoryGauge,
	access Access,
	compositeKind common.CompositeKind,
	identifier Identifier,
	conformances []*NominalType,
	members *Members,
	docString string,
	declarationRange Range,
) *CompositeDeclaration

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) Doc added in v0.25.0

func (*CompositeDeclaration) ElementType added in v0.25.0

func (*CompositeDeclaration) ElementType() ElementType

func (*CompositeDeclaration) EventDoc added in v0.25.0

func (d *CompositeDeclaration) EventDoc() prettier.Doc

func (*CompositeDeclaration) MarshalJSON added in v0.9.0

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

func (*CompositeDeclaration) String added in v0.25.0

func (d *CompositeDeclaration) String() string

func (*CompositeDeclaration) Walk added in v0.17.0

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

type Condition

type Condition struct {
	Test    Expression
	Message Expression
	Kind    ConditionKind
}

func (Condition) Doc added in v0.25.0

func (c Condition) Doc() prettier.Doc

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 NewConditionalExpression added in v0.24.0

func NewConditionalExpression(
	gauge common.MemoryGauge,
	testExpr Expression,
	thenExpr Expression,
	elseExpr Expression,
) *ConditionalExpression

func (*ConditionalExpression) Doc added in v0.24.0

func (*ConditionalExpression) ElementType added in v0.25.0

func (*ConditionalExpression) ElementType() ElementType

func (*ConditionalExpression) EndPosition

func (e *ConditionalExpression) EndPosition(memoryGauge common.MemoryGauge) 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

func (*Conditions) Doc added in v0.25.0

func (c *Conditions) Doc(keywordDoc prettier.Doc) prettier.Doc

func (*Conditions) IsEmpty added in v0.24.0

func (c *Conditions) IsEmpty() bool

type ConstantSizedType

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

func NewConstantSizedType added in v0.24.0

func NewConstantSizedType(
	memoryGauge common.MemoryGauge,
	typ Type,
	size *IntegerExpression,
	astRange Range,
) *ConstantSizedType

func (*ConstantSizedType) CheckEqual added in v0.13.0

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

func (*ConstantSizedType) Doc added in v0.24.0

func (t *ConstantSizedType) Doc() prettier.Doc

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 NewContinueStatement added in v0.24.0

func NewContinueStatement(gauge common.MemoryGauge, tokenRange Range) *ContinueStatement

func (*ContinueStatement) Doc added in v0.24.0

func (*ContinueStatement) ElementType added in v0.25.0

func (*ContinueStatement) ElementType() ElementType

func (*ContinueStatement) MarshalJSON added in v0.8.0

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

func (*ContinueStatement) String added in v0.25.0

func (s *ContinueStatement) String() string

func (*ContinueStatement) Walk added in v0.17.0

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

type CreateExpression

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

func NewCreateExpression added in v0.24.0

func NewCreateExpression(
	gauge common.MemoryGauge,
	invocationExpression *InvocationExpression,
	startPos Position,
) *CreateExpression

func (*CreateExpression) Doc added in v0.24.0

func (e *CreateExpression) Doc() prettier.Doc

func (*CreateExpression) ElementType added in v0.25.0

func (*CreateExpression) ElementType() ElementType

func (*CreateExpression) EndPosition

func (e *CreateExpression) EndPosition(common.MemoryGauge) 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
	fmt.Stringer

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

type DeclarationVisitor added in v0.25.0

type DeclarationVisitor[T any] interface {
	StatementDeclarationVisitor[T]
	VisitFieldDeclaration(*FieldDeclaration) T
	VisitEnumCaseDeclaration(*EnumCaseDeclaration) T
	VisitPragmaDeclaration(*PragmaDeclaration) T
	VisitImportDeclaration(*ImportDeclaration) T
}

type DestroyExpression

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

func NewDestroyExpression added in v0.24.0

func NewDestroyExpression(
	gauge common.MemoryGauge,
	expression Expression,
	startPos Position,
) *DestroyExpression

func (*DestroyExpression) Doc added in v0.24.0

func (e *DestroyExpression) Doc() prettier.Doc

func (*DestroyExpression) ElementType added in v0.25.0

func (*DestroyExpression) ElementType() ElementType

func (*DestroyExpression) EndPosition

func (e *DestroyExpression) EndPosition(memoryGauge common.MemoryGauge) 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 NewDictionaryEntry added in v0.24.0

func NewDictionaryEntry(
	gauge common.MemoryGauge,
	key Expression,
	value Expression,
) DictionaryEntry

func (DictionaryEntry) Doc added in v0.24.0

func (e DictionaryEntry) Doc() prettier.Doc

func (DictionaryEntry) MarshalJSON added in v0.8.0

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

type DictionaryExpression

type DictionaryExpression struct {
	Entries []DictionaryEntry
	Range
}

func NewDictionaryExpression added in v0.24.0

func NewDictionaryExpression(
	gauge common.MemoryGauge,
	entries []DictionaryEntry,
	tokenRange Range,
) *DictionaryExpression

func (*DictionaryExpression) Doc added in v0.24.0

func (*DictionaryExpression) ElementType added in v0.25.0

func (*DictionaryExpression) ElementType() ElementType

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 NewDictionaryType added in v0.24.0

func NewDictionaryType(
	memoryGauge common.MemoryGauge,
	keyType Type,
	valueType Type,
	astRange Range,
) *DictionaryType

func (*DictionaryType) CheckEqual added in v0.13.0

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

func (*DictionaryType) Doc added in v0.24.0

func (t *DictionaryType) Doc() prettier.Doc

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
	ElementType() ElementType
	Walk(walkChild func(Element))
}

type ElementType added in v0.25.0

type ElementType uint64
const (
	ElementTypeUnknown ElementType = iota

	ElementTypeProgram
	ElementTypeBlock
	ElementTypeFunctionBlock

	ElementTypeFunctionDeclaration
	ElementTypeSpecialFunctionDeclaration
	ElementTypeCompositeDeclaration
	ElementTypeInterfaceDeclaration
	ElementTypeFieldDeclaration
	ElementTypeEnumCaseDeclaration
	ElementTypePragmaDeclaration
	ElementTypeImportDeclaration
	ElementTypeTransactionDeclaration

	ElementTypeReturnStatement
	ElementTypeBreakStatement
	ElementTypeContinueStatement
	ElementTypeIfStatement
	ElementTypeSwitchStatement
	ElementTypeWhileStatement
	ElementTypeForStatement
	ElementTypeEmitStatement
	ElementTypeVariableDeclaration
	ElementTypeAssignmentStatement
	ElementTypeSwapStatement
	ElementTypeExpressionStatement

	ElementTypeVoidExpression
	ElementTypeBoolExpression
	ElementTypeNilExpression
	ElementTypeIntegerExpression
	ElementTypeFixedPointExpression
	ElementTypeArrayExpression
	ElementTypeDictionaryExpression
	ElementTypeIdentifierExpression
	ElementTypeInvocationExpression
	ElementTypeMemberExpression
	ElementTypeIndexExpression
	ElementTypeConditionalExpression
	ElementTypeUnaryExpression
	ElementTypeBinaryExpression
	ElementTypeFunctionExpression
	ElementTypeStringExpression
	ElementTypeCastingExpression
	ElementTypeCreateExpression
	ElementTypeDestroyExpression
	ElementTypeReferenceExpression
	ElementTypeForceExpression
	ElementTypePathExpression
)

func (ElementType) String added in v0.25.0

func (i ElementType) String() string

type EmitStatement

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

func NewEmitStatement added in v0.24.0

func NewEmitStatement(
	gauge common.MemoryGauge,
	invocation *InvocationExpression,
	startPos Position,
) *EmitStatement

func (*EmitStatement) Doc added in v0.24.0

func (s *EmitStatement) Doc() prettier.Doc

func (*EmitStatement) ElementType added in v0.25.0

func (*EmitStatement) ElementType() ElementType

func (*EmitStatement) EndPosition

func (s *EmitStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *EmitStatement) String() string

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 {
	DocString  string
	Identifier Identifier
	StartPos   Position `json:"-"`
	Access     Access
}

func NewEnumCaseDeclaration added in v0.24.0

func NewEnumCaseDeclaration(
	memoryGauge common.MemoryGauge,
	access Access,
	identifier Identifier,
	docString string,
	startPos Position,
) *EnumCaseDeclaration

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) Doc added in v0.25.0

func (d *EnumCaseDeclaration) Doc() prettier.Doc

func (*EnumCaseDeclaration) ElementType added in v0.25.0

func (*EnumCaseDeclaration) ElementType() ElementType

func (*EnumCaseDeclaration) EndPosition added in v0.10.0

func (d *EnumCaseDeclaration) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (d *EnumCaseDeclaration) String() string

func (*EnumCaseDeclaration) Walk added in v0.17.0

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

type Expression

type Expression interface {
	Element
	fmt.Stringer
	IfStatementTest

	Doc() prettier.Doc
	// contains filtered or unexported methods
}

type ExpressionExtraction

type ExpressionExtraction struct {
	RewrittenExpression  Expression
	ExtractedExpressions []ExtractedExpression
}

type ExpressionExtractor

type ExpressionExtractor struct {
	IndexExtractor       IndexExtractor
	ForceExtractor       ForceExtractor
	BoolExtractor        BoolExtractor
	NilExtractor         NilExtractor
	IntExtractor         IntExtractor
	FixedPointExtractor  FixedPointExtractor
	StringExtractor      StringExtractor
	ArrayExtractor       ArrayExtractor
	DictionaryExtractor  DictionaryExtractor
	IdentifierExtractor  IdentifierExtractor
	MemoryGauge          common.MemoryGauge
	VoidExtractor        VoidExtractor
	UnaryExtractor       UnaryExtractor
	ConditionalExtractor ConditionalExtractor
	InvocationExtractor  InvocationExtractor
	BinaryExtractor      BinaryExtractor
	FunctionExtractor    FunctionExtractor
	CastingExtractor     CastingExtractor
	CreateExtractor      CreateExtractor
	DestroyExtractor     DestroyExtractor
	ReferenceExtractor   ReferenceExtractor
	MemberExtractor      MemberExtractor
	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) ExtractVoid added in v0.27.1

func (extractor *ExpressionExtractor) ExtractVoid(expression *VoidExpression) 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) ExpressionExtraction

func (*ExpressionExtractor) VisitBinaryExpression

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

func (*ExpressionExtractor) VisitBoolExpression

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

func (*ExpressionExtractor) VisitCastingExpression

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

func (*ExpressionExtractor) VisitConditionalExpression

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

func (*ExpressionExtractor) VisitCreateExpression

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

func (*ExpressionExtractor) VisitDestroyExpression

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

func (*ExpressionExtractor) VisitDictionaryExpression

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

func (*ExpressionExtractor) VisitExpressions

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

func (*ExpressionExtractor) VisitFixedPointExpression

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

func (*ExpressionExtractor) VisitForceExpression

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

func (*ExpressionExtractor) VisitFunctionExpression

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

func (*ExpressionExtractor) VisitIdentifierExpression

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

func (*ExpressionExtractor) VisitIndexExpression

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

func (*ExpressionExtractor) VisitIntegerExpression

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

func (*ExpressionExtractor) VisitInvocationExpression

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

func (*ExpressionExtractor) VisitMemberExpression

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

func (*ExpressionExtractor) VisitNilExpression

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

func (*ExpressionExtractor) VisitPathExpression

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

func (*ExpressionExtractor) VisitReferenceExpression

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

func (*ExpressionExtractor) VisitStringExpression

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

func (*ExpressionExtractor) VisitUnaryExpression

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

func (*ExpressionExtractor) VisitVoidExpression added in v0.27.1

func (extractor *ExpressionExtractor) VisitVoidExpression(expression *VoidExpression) ExpressionExtraction

type ExpressionStatement

type ExpressionStatement struct {
	Expression Expression
}

func NewExpressionStatement added in v0.24.0

func NewExpressionStatement(gauge common.MemoryGauge, expression Expression) *ExpressionStatement

func (*ExpressionStatement) Doc added in v0.24.0

func (s *ExpressionStatement) Doc() prettier.Doc

func (*ExpressionStatement) ElementType added in v0.25.0

func (*ExpressionStatement) ElementType() ElementType

func (*ExpressionStatement) EndPosition

func (s *ExpressionStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *ExpressionStatement) String() string

func (*ExpressionStatement) Walk added in v0.17.0

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

type ExpressionVisitor

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

type ExtractedExpression

type ExtractedExpression struct {
	Expression Expression
	Identifier Identifier
}

type FieldDeclaration

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

func NewFieldDeclaration added in v0.24.0

func NewFieldDeclaration(
	memoryGauge common.MemoryGauge,
	access Access,
	isStatic bool,
	isNative bool,
	variableKind VariableKind,
	identifier Identifier,
	typeAnnotation *TypeAnnotation,
	docString string,
	declRange Range,
) *FieldDeclaration

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) Doc added in v0.25.0

func (d *FieldDeclaration) Doc() prettier.Doc

func (*FieldDeclaration) ElementType added in v0.25.0

func (*FieldDeclaration) ElementType() ElementType

func (*FieldDeclaration) IsNative added in v0.30.0

func (d *FieldDeclaration) IsNative() bool

func (*FieldDeclaration) IsStatic added in v0.30.0

func (d *FieldDeclaration) IsStatic() bool

func (*FieldDeclaration) MarshalJSON added in v0.9.0

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

func (*FieldDeclaration) String added in v0.25.0

func (d *FieldDeclaration) String() string

func (*FieldDeclaration) Walk added in v0.17.0

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

type FieldDeclarationFlags added in v0.30.0

type FieldDeclarationFlags uint8
const (
	FieldDeclarationFlagsIsStatic FieldDeclarationFlags = 1 << iota
	FieldDeclarationFlagsIsNative
)

type FixedPointExpression

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

func NewFixedPointExpression added in v0.24.0

func NewFixedPointExpression(
	gauge common.MemoryGauge,
	literal []byte,
	isNegative bool,
	integer *big.Int,
	fractional *big.Int,
	scale uint,
	tokenRange Range,
) *FixedPointExpression

func (*FixedPointExpression) Doc added in v0.24.0

func (*FixedPointExpression) ElementType added in v0.25.0

func (*FixedPointExpression) ElementType() ElementType

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 {
	Value      Expression
	Index      *Identifier
	Block      *Block
	Identifier Identifier
	StartPos   Position `json:"-"`
}

func NewForStatement added in v0.24.0

func NewForStatement(
	gauge common.MemoryGauge,
	identifier Identifier,
	index *Identifier,
	block *Block,
	expression Expression,
	startPos Position,
) *ForStatement

func (*ForStatement) Doc added in v0.24.0

func (s *ForStatement) Doc() prettier.Doc

func (*ForStatement) ElementType added in v0.25.0

func (*ForStatement) ElementType() ElementType

func (*ForStatement) EndPosition

func (s *ForStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *ForStatement) String() string

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 NewForceExpression added in v0.24.0

func NewForceExpression(
	gauge common.MemoryGauge,
	expression Expression,
	endPos Position,
) *ForceExpression

func (*ForceExpression) Doc added in v0.24.0

func (e *ForceExpression) Doc() prettier.Doc

func (*ForceExpression) ElementType added in v0.25.0

func (*ForceExpression) ElementType() ElementType

func (*ForceExpression) EndPosition

func (e *ForceExpression) EndPosition(common.MemoryGauge) 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 NewFunctionBlock added in v0.24.0

func NewFunctionBlock(
	memoryGauge common.MemoryGauge,
	block *Block,
	preConditions *Conditions,
	postConditions *Conditions,
) *FunctionBlock

func (*FunctionBlock) Doc added in v0.25.0

func (b *FunctionBlock) Doc() prettier.Doc

func (*FunctionBlock) ElementType added in v0.25.0

func (*FunctionBlock) ElementType() ElementType

func (*FunctionBlock) EndPosition added in v0.8.0

func (b *FunctionBlock) EndPosition(common.MemoryGauge) Position

func (*FunctionBlock) HasStatements added in v0.26.0

func (b *FunctionBlock) HasStatements() bool

func (*FunctionBlock) IsEmpty added in v0.24.0

func (b *FunctionBlock) IsEmpty() bool

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) String added in v0.25.0

func (b *FunctionBlock) String() string

func (*FunctionBlock) Walk added in v0.17.0

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

type FunctionDeclaration

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

func NewFunctionDeclaration added in v0.24.0

func NewFunctionDeclaration(
	gauge common.MemoryGauge,
	access Access,
	isStatic bool,
	isNative bool,
	identifier Identifier,
	parameterList *ParameterList,
	returnTypeAnnotation *TypeAnnotation,
	functionBlock *FunctionBlock,
	startPos Position,
	docString string,
) *FunctionDeclaration

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) Doc added in v0.25.0

func (d *FunctionDeclaration) Doc() prettier.Doc

func (*FunctionDeclaration) ElementType added in v0.25.0

func (*FunctionDeclaration) ElementType() ElementType

func (*FunctionDeclaration) EndPosition

func (d *FunctionDeclaration) EndPosition(memoryGauge common.MemoryGauge) Position

func (*FunctionDeclaration) IsNative added in v0.30.0

func (d *FunctionDeclaration) IsNative() bool

func (*FunctionDeclaration) IsStatic added in v0.30.0

func (d *FunctionDeclaration) IsStatic() bool

func (*FunctionDeclaration) MarshalJSON added in v0.9.0

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

func (*FunctionDeclaration) StartPosition

func (d *FunctionDeclaration) StartPosition() Position

func (*FunctionDeclaration) String added in v0.25.0

func (d *FunctionDeclaration) String() string

func (*FunctionDeclaration) ToExpression

func (d *FunctionDeclaration) ToExpression(memoryGauge common.MemoryGauge) *FunctionExpression

func (*FunctionDeclaration) Walk added in v0.17.0

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

type FunctionDeclarationFlags added in v0.30.0

type FunctionDeclarationFlags uint8
const (
	FunctionDeclarationFlagsIsStatic FunctionDeclarationFlags = 1 << iota
	FunctionDeclarationFlagsIsNative
)

type FunctionExpression

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

func NewFunctionExpression added in v0.24.0

func NewFunctionExpression(
	gauge common.MemoryGauge,
	parameters *ParameterList,
	returnType *TypeAnnotation,
	functionBlock *FunctionBlock,
	startPos Position,
) *FunctionExpression

func (*FunctionExpression) Doc added in v0.24.0

func (e *FunctionExpression) Doc() prettier.Doc

func (*FunctionExpression) ElementType added in v0.25.0

func (*FunctionExpression) ElementType() ElementType

func (*FunctionExpression) EndPosition

func (e *FunctionExpression) EndPosition(memoryGauge common.MemoryGauge) 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 {
	ReturnTypeAnnotation     *TypeAnnotation
	ParameterTypeAnnotations []*TypeAnnotation `json:",omitempty"`
	Range
}

func NewFunctionType added in v0.24.0

func NewFunctionType(
	memoryGauge common.MemoryGauge,
	parameterTypes []*TypeAnnotation,
	returnType *TypeAnnotation,
	astRange Range,
) *FunctionType

func (*FunctionType) CheckEqual added in v0.13.0

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

func (*FunctionType) Doc added in v0.24.0

func (t *FunctionType) Doc() prettier.Doc

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(memoryGauge common.MemoryGauge) Position
}

type Identifier

type Identifier struct {
	Identifier string
	Pos        Position
}

func NewEmptyIdentifier added in v0.24.0

func NewEmptyIdentifier(memoryGauge common.MemoryGauge, pos Position) Identifier

func NewIdentifier added in v0.24.0

func NewIdentifier(memoryGauge common.MemoryGauge, identifier string, pos Position) Identifier

func (Identifier) EndPosition

func (i Identifier) EndPosition(memoryGauge common.MemoryGauge) 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 NewIdentifierExpression added in v0.24.0

func NewIdentifierExpression(
	gauge common.MemoryGauge,
	identifier Identifier,
) *IdentifierExpression

func (*IdentifierExpression) Doc added in v0.24.0

func (*IdentifierExpression) ElementType added in v0.25.0

func (*IdentifierExpression) ElementType() ElementType

func (*IdentifierExpression) EndPosition added in v0.8.0

func (e *IdentifierExpression) EndPosition(memoryGauge common.MemoryGauge) 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 NewIfStatement added in v0.24.0

func NewIfStatement(
	gauge common.MemoryGauge,
	test IfStatementTest,
	thenBlock *Block,
	elseBlock *Block,
	startPos Position,
) *IfStatement

func (*IfStatement) Doc added in v0.24.0

func (s *IfStatement) Doc() prettier.Doc

func (*IfStatement) ElementType added in v0.25.0

func (*IfStatement) ElementType() ElementType

func (*IfStatement) EndPosition

func (s *IfStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *IfStatement) String() string

func (*IfStatement) Walk added in v0.17.0

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

type IfStatementTest

type IfStatementTest interface {
	Element

	Doc() prettier.Doc
	// contains filtered or unexported methods
}

type ImportDeclaration

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

func NewImportDeclaration added in v0.24.0

func NewImportDeclaration(
	gauge common.MemoryGauge,
	identifiers []Identifier,
	location common.Location,
	declRange Range,
	locationPos Position,
) *ImportDeclaration

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) Doc added in v0.25.0

func (d *ImportDeclaration) Doc() prettier.Doc

func (*ImportDeclaration) ElementType added in v0.25.0

func (*ImportDeclaration) ElementType() ElementType

func (*ImportDeclaration) MarshalJSON added in v0.9.0

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

func (*ImportDeclaration) String added in v0.25.0

func (d *ImportDeclaration) String() string

func (*ImportDeclaration) Walk added in v0.17.0

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

type IndexExpression

type IndexExpression struct {
	TargetExpression   Expression
	IndexingExpression Expression
	Range
}

func NewIndexExpression added in v0.24.0

func NewIndexExpression(
	gauge common.MemoryGauge,
	target Expression,
	index Expression,
	tokenRange Range,
) *IndexExpression

func (*IndexExpression) AccessedExpression

func (e *IndexExpression) AccessedExpression() Expression

func (*IndexExpression) Doc added in v0.24.0

func (e *IndexExpression) Doc() prettier.Doc

func (*IndexExpression) ElementType added in v0.25.0

func (*IndexExpression) ElementType() ElementType

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 Inspector added in v0.25.0

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

Inspector provides methods for inspecting (traversing) an AST element.

The inspecting methods allow element filtering by type, and materialization of the traversal stack.

During construction, the inspector does a complete traversal and builds a list of push/pop events and their element type. Subsequent method calls that request a traversal scan this list, rather than walk the AST, and perform type filtering using efficient bit sets.

Inspector's traversals are faster than using the Inspect function, but it may take multiple traversals for this benefit to amortize the inspector's construction cost. If efficiency is the primary concern, do not use Inspector for one-off traversals.

There are four orthogonal features in a traversal:

1 type filtering
2 pruning
3 postorder calls to f
4 stack

Rather than offer all of them in the API, only a few combinations are exposed:

  • Preorder is the fastest and has the fewest features, but is the most commonly needed traversal.
  • Elements and WithStack both provide pruning and postorder calls, even though few clients need it, because supporting two versions is not justified.

More combinations could be supported by expressing them as wrappers around a more generic traversal, but likely has worse performance.

func NewInspector added in v0.25.0

func NewInspector(element Element) *Inspector

NewInspector returns an Inspector for the specified AST element.

func (*Inspector) Elements added in v0.25.0

func (in *Inspector) Elements(types []Element, f func(element Element, push bool) (proceed bool))

Elements visits the elements in depth-first order. It calls f(e, true) for each element e before it visits e's children. If f returns true, Elements invokes f recursively for each of the non-nil children of the element, followed by a call of f(n, false).

The types argument, if non-empty, enables type-based filtering of events. The function f if is called only for elements whose type matches an element of the types slice.

func (*Inspector) Preorder added in v0.25.0

func (in *Inspector) Preorder(types []Element, f func(Element))

Preorder visits all elements in depth-first order. It calls f(e) for each element e before it visits e's children.

The types argument, if non-empty, enables type-based filtering of events. The function f if is called only for elements whose type matches an element of the types slice.

Preorder is almost twice as fast as Elements, because it avoids postorder calls to f, and the pruning check.

func (*Inspector) WithStack added in v0.25.0

func (in *Inspector) WithStack(types []Element, f func(element Element, push bool, stack []Element) (proceed bool))

WithStack visits elements in a similar manner to Elements, but it supplies each call to f an additional argument, the current traversal stack.

The stack's first element is the outermost element, its last is the innermost.

type InstantiationType added in v0.5.0

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

func NewInstantiationType added in v0.24.0

func NewInstantiationType(
	memoryGauge common.MemoryGauge,
	typ Type,
	typeArguments []*TypeAnnotation,
	typeArgumentsStartPos Position,
	endPos Position,
) *InstantiationType

func (*InstantiationType) CheckEqual added in v0.13.0

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

func (*InstantiationType) Doc added in v0.24.0

func (t *InstantiationType) Doc() prettier.Doc

func (*InstantiationType) EndPosition added in v0.5.0

func (t *InstantiationType) EndPosition(common.MemoryGauge) 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:"-"`
	PositiveLiteral []byte
	Range
	Base int
}

func NewIntegerExpression added in v0.24.0

func NewIntegerExpression(
	gauge common.MemoryGauge,
	literal []byte,
	value *big.Int,
	base int,
	tokenRange Range,
) *IntegerExpression

func (*IntegerExpression) Doc added in v0.24.0

func (e *IntegerExpression) Doc() prettier.Doc

func (*IntegerExpression) ElementType added in v0.25.0

func (*IntegerExpression) ElementType() ElementType

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 {
	Members    *Members
	DocString  string
	Identifier Identifier
	Range
	Access        Access
	CompositeKind common.CompositeKind
}

func NewInterfaceDeclaration added in v0.24.0

func NewInterfaceDeclaration(
	gauge common.MemoryGauge,
	access Access,
	compositeKind common.CompositeKind,
	identifier Identifier,
	members *Members,
	docString string,
	declRange Range,
) *InterfaceDeclaration

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) Doc added in v0.25.0

func (*InterfaceDeclaration) ElementType added in v0.25.0

func (*InterfaceDeclaration) ElementType() ElementType

func (*InterfaceDeclaration) MarshalJSON added in v0.9.0

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

func (*InterfaceDeclaration) String added in v0.25.0

func (d *InterfaceDeclaration) String() string

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 NewInvocationExpression added in v0.24.0

func NewInvocationExpression(
	gauge common.MemoryGauge,
	invokedExpression Expression,
	typeArguments []*TypeAnnotation,
	arguments Arguments,
	argsStartPos Position,
	endPos Position,
) *InvocationExpression

func (*InvocationExpression) Doc added in v0.24.0

func (*InvocationExpression) ElementType added in v0.25.0

func (*InvocationExpression) ElementType() ElementType

func (*InvocationExpression) EndPosition

func (e *InvocationExpression) EndPosition(_ common.MemoryGauge) 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
	Identifier Identifier
	// The position of the token (`.`, `?.`) that separates the accessed expression
	// and the identifier of the member
	AccessPos Position
	Optional  bool
}

func NewMemberExpression added in v0.24.0

func NewMemberExpression(
	gauge common.MemoryGauge,
	expression Expression,
	optional bool,
	accessPos Position,
	identifier Identifier,
) *MemberExpression

func (*MemberExpression) AccessedExpression

func (e *MemberExpression) AccessedExpression() Expression

func (*MemberExpression) Doc added in v0.24.0

func (e *MemberExpression) Doc() prettier.Doc

func (*MemberExpression) ElementType added in v0.25.0

func (*MemberExpression) ElementType() ElementType

func (*MemberExpression) EndPosition

func (e *MemberExpression) EndPosition(memoryGauge common.MemoryGauge) 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(memoryGauge common.MemoryGauge, declarations []Declaration) *Members

func NewUnmeteredMembers added in v0.24.0

func NewUnmeteredMembers(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) Doc added in v0.25.0

func (m *Members) Doc() prettier.Doc

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 NewNilExpression added in v0.24.0

func NewNilExpression(gauge common.MemoryGauge, pos Position) *NilExpression

func (*NilExpression) Doc added in v0.24.0

func (*NilExpression) Doc() prettier.Doc

func (*NilExpression) ElementType added in v0.25.0

func (*NilExpression) ElementType() ElementType

func (*NilExpression) EndPosition

func (e *NilExpression) EndPosition(memoryGauge common.MemoryGauge) 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 {
	NestedIdentifiers []Identifier `json:",omitempty"`
	Identifier        Identifier
}

func NewNominalType added in v0.24.0

func NewNominalType(
	memoryGauge common.MemoryGauge,
	identifier Identifier,
	nestedIdentifiers []Identifier,
) *NominalType

func (*NominalType) CheckEqual added in v0.13.0

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

func (*NominalType) Doc added in v0.24.0

func (t *NominalType) Doc() prettier.Doc

func (*NominalType) EndPosition

func (t *NominalType) EndPosition(memoryGauge common.MemoryGauge) 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 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) Category added in v0.25.0

func (s Operation) Category() string

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 NewOptionalType added in v0.24.0

func NewOptionalType(
	memoryGauge common.MemoryGauge,
	typ Type,
	endPos Position,
) *OptionalType

func (*OptionalType) CheckEqual added in v0.13.0

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

func (*OptionalType) Doc added in v0.24.0

func (t *OptionalType) Doc() prettier.Doc

func (*OptionalType) EndPosition

func (t *OptionalType) EndPosition(memoryGauge common.MemoryGauge) 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 {
	TypeAnnotation *TypeAnnotation
	Label          string
	Identifier     Identifier
	StartPos       Position `json:"-"`
}

func NewParameter added in v0.24.0

func NewParameter(
	gauge common.MemoryGauge,
	label string,
	identifier Identifier,
	typeAnnotation *TypeAnnotation,
	startPos Position,
) *Parameter

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

func (*Parameter) EndPosition added in v0.30.0

func (p *Parameter) EndPosition(memoryGauge common.MemoryGauge) Position

func (*Parameter) MarshalJSON added in v0.30.0

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

func (*Parameter) StartPosition added in v0.30.0

func (p *Parameter) StartPosition() Position

type ParameterList

type ParameterList struct {
	Parameters []*Parameter
	Range
	// contains filtered or unexported fields
}

func NewParameterList added in v0.24.0

func NewParameterList(
	gauge common.MemoryGauge,
	parameters []*Parameter,
	astRange Range,
) *ParameterList

func (*ParameterList) Doc added in v0.25.0

func (l *ParameterList) Doc() prettier.Doc

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) IsEmpty added in v0.25.0

func (l *ParameterList) IsEmpty() bool

func (*ParameterList) ParametersByIdentifier

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

func (*ParameterList) String added in v0.25.0

func (l *ParameterList) String() string

type PathExpression

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

func NewPathExpression added in v0.24.0

func NewPathExpression(
	gauge common.MemoryGauge,
	domain Identifier,
	identifier Identifier,
	startPos Position,
) *PathExpression

func (*PathExpression) Doc added in v0.24.0

func (e *PathExpression) Doc() prettier.Doc

func (*PathExpression) ElementType added in v0.25.0

func (*PathExpression) ElementType() ElementType

func (*PathExpression) EndPosition

func (e *PathExpression) EndPosition(memoryGauge common.MemoryGauge) 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 EarliestPosition added in v0.30.0

func EarliestPosition(p Position, ps ...*Position) (earliest Position)

func EndPosition

func EndPosition(memoryGauge common.MemoryGauge, startPosition Position, end int) Position

func NewPosition added in v0.24.0

func NewPosition(memoryGauge common.MemoryGauge, offset, line, column int) Position

func (Position) Compare

func (position Position) Compare(other Position) int

func (Position) Shifted

func (position Position) Shifted(memoryGauge common.MemoryGauge, 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 NewPragmaDeclaration added in v0.24.0

func NewPragmaDeclaration(gauge common.MemoryGauge, expression Expression, declRange Range) *PragmaDeclaration

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) Doc added in v0.25.0

func (d *PragmaDeclaration) Doc() prettier.Doc

func (*PragmaDeclaration) ElementType added in v0.25.0

func (*PragmaDeclaration) ElementType() ElementType

func (*PragmaDeclaration) MarshalJSON added in v0.9.0

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

func (*PragmaDeclaration) String added in v0.25.0

func (d *PragmaDeclaration) String() string

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(memoryGauge common.MemoryGauge, declarations []Declaration) *Program

func (*Program) CompositeDeclarations

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

func (*Program) Declarations

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

func (*Program) Doc added in v0.25.0

func (p *Program) Doc() prettier.Doc

func (*Program) ElementType added in v0.25.0

func (*Program) ElementType() ElementType

func (*Program) EndPosition

func (p *Program) EndPosition(memoryGauge common.MemoryGauge) 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 (p *Program) Walk(walkChild func(Element))

type Range

type Range struct {
	StartPos Position
	EndPos   Position
}

func NewRange added in v0.24.0

func NewRange(memoryGauge common.MemoryGauge, startPos, endPos Position) Range

func NewRangeFromPositioned

func NewRangeFromPositioned(memoryGauge common.MemoryGauge, hasPosition HasPosition) Range

func NewUnmeteredRange added in v0.24.0

func NewUnmeteredRange(startPos, endPos Position) Range

func NewUnmeteredRangeFromPositioned added in v0.24.0

func NewUnmeteredRangeFromPositioned(hasPosition HasPosition) Range

func (Range) EndPosition

func (e Range) EndPosition(common.MemoryGauge) Position

func (Range) StartPosition

func (e Range) StartPosition() Position

type ReferenceExpression

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

func NewReferenceExpression added in v0.24.0

func NewReferenceExpression(
	gauge common.MemoryGauge,
	expression Expression,
	targetType Type,
	startPos Position,
) *ReferenceExpression

func (*ReferenceExpression) Doc added in v0.24.0

func (e *ReferenceExpression) Doc() prettier.Doc

func (*ReferenceExpression) ElementType added in v0.25.0

func (*ReferenceExpression) ElementType() ElementType

func (*ReferenceExpression) EndPosition

func (e *ReferenceExpression) EndPosition(memoryGauge common.MemoryGauge) 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 {
	Type       Type     `json:"ReferencedType"`
	StartPos   Position `json:"-"`
	Authorized bool
}

func NewReferenceType added in v0.24.0

func NewReferenceType(
	memoryGauge common.MemoryGauge,
	authorized bool,
	typ Type,
	startPos Position,
) *ReferenceType

func (*ReferenceType) CheckEqual added in v0.13.0

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

func (*ReferenceType) Doc added in v0.24.0

func (t *ReferenceType) Doc() prettier.Doc

func (*ReferenceType) EndPosition

func (t *ReferenceType) EndPosition(memoryGauge common.MemoryGauge) 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 RestrictedType

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

func NewRestrictedType added in v0.24.0

func NewRestrictedType(
	memoryGauge common.MemoryGauge,
	typ Type,
	restrictions []*NominalType,
	astRange Range,
) *RestrictedType

func (*RestrictedType) CheckEqual added in v0.13.0

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

func (*RestrictedType) Doc added in v0.24.0

func (t *RestrictedType) Doc() prettier.Doc

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 NewReturnStatement added in v0.24.0

func NewReturnStatement(gauge common.MemoryGauge, expression Expression, stmtRange Range) *ReturnStatement

func (*ReturnStatement) Doc added in v0.24.0

func (s *ReturnStatement) Doc() prettier.Doc

func (*ReturnStatement) ElementType added in v0.25.0

func (*ReturnStatement) ElementType() ElementType

func (*ReturnStatement) MarshalJSON added in v0.8.0

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

func (*ReturnStatement) String added in v0.25.0

func (s *ReturnStatement) String() string

func (*ReturnStatement) Walk added in v0.17.0

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

type SpecialFunctionDeclaration

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

func NewSpecialFunctionDeclaration added in v0.24.0

func NewSpecialFunctionDeclaration(
	gauge common.MemoryGauge,
	kind common.DeclarationKind,
	funcDecl *FunctionDeclaration,
) *SpecialFunctionDeclaration

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) Doc added in v0.25.0

func (*SpecialFunctionDeclaration) ElementType added in v0.25.0

func (*SpecialFunctionDeclaration) ElementType() ElementType

func (*SpecialFunctionDeclaration) EndPosition added in v0.9.0

func (d *SpecialFunctionDeclaration) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (d *SpecialFunctionDeclaration) String() string

func (*SpecialFunctionDeclaration) Walk added in v0.17.0

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

type Statement

type Statement interface {
	Element
	fmt.Stringer

	Doc() prettier.Doc
	// contains filtered or unexported methods
}

type StatementDeclarationVisitor added in v0.25.0

type StatementDeclarationVisitor[T any] interface {
	VisitVariableDeclaration(*VariableDeclaration) T
	VisitFunctionDeclaration(*FunctionDeclaration) T
	VisitSpecialFunctionDeclaration(*SpecialFunctionDeclaration) T
	VisitCompositeDeclaration(*CompositeDeclaration) T
	VisitInterfaceDeclaration(*InterfaceDeclaration) T
	VisitTransactionDeclaration(*TransactionDeclaration) T
}

type StatementVisitor

type StatementVisitor[T any] interface {
	StatementDeclarationVisitor[T]
	VisitReturnStatement(*ReturnStatement) T
	VisitContinueStatement(*ContinueStatement) T
	VisitBreakStatement(*BreakStatement) T
	VisitIfStatement(*IfStatement) T
	VisitForStatement(*ForStatement) T
	VisitAssignmentStatement(*AssignmentStatement) T
	VisitWhileStatement(*WhileStatement) T
	VisitSwapStatement(*SwapStatement) T
	VisitSwitchStatement(*SwitchStatement) T
	VisitEmitStatement(*EmitStatement) T
	VisitExpressionStatement(*ExpressionStatement) T
}

type StringExpression

type StringExpression struct {
	Value string
	Range
}

func NewStringExpression added in v0.24.0

func NewStringExpression(gauge common.MemoryGauge, value string, exprRange Range) *StringExpression

func (*StringExpression) Doc added in v0.24.0

func (e *StringExpression) Doc() prettier.Doc

func (*StringExpression) ElementType added in v0.25.0

func (*StringExpression) ElementType() ElementType

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 NewSwapStatement added in v0.24.0

func NewSwapStatement(gauge common.MemoryGauge, expression Expression, right Expression) *SwapStatement

func (*SwapStatement) Doc added in v0.24.0

func (s *SwapStatement) Doc() prettier.Doc

func (*SwapStatement) ElementType added in v0.25.0

func (*SwapStatement) ElementType() ElementType

func (*SwapStatement) EndPosition

func (s *SwapStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *SwapStatement) String() string

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) Doc added in v0.24.0

func (s *SwitchCase) Doc() prettier.Doc

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 NewSwitchStatement added in v0.24.0

func NewSwitchStatement(
	gauge common.MemoryGauge,
	expression Expression,
	cases []*SwitchCase,
	stmtRange Range,
) *SwitchStatement

func (*SwitchStatement) Doc added in v0.24.0

func (s *SwitchStatement) Doc() prettier.Doc

func (*SwitchStatement) ElementType added in v0.25.0

func (*SwitchStatement) ElementType() ElementType

func (*SwitchStatement) MarshalJSON added in v0.10.0

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

func (*SwitchStatement) String added in v0.25.0

func (s *SwitchStatement) String() string

func (*SwitchStatement) Walk added in v0.17.0

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

type TransactionDeclaration

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

func NewTransactionDeclaration added in v0.24.0

func NewTransactionDeclaration(
	gauge common.MemoryGauge,
	parameterList *ParameterList,
	fields []*FieldDeclaration,
	prepare *SpecialFunctionDeclaration,
	preConditions *Conditions,
	postConditions *Conditions,
	execute *SpecialFunctionDeclaration,
	docString string,
	declRange Range,
) *TransactionDeclaration

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) Doc added in v0.25.0

func (*TransactionDeclaration) ElementType added in v0.25.0

func (*TransactionDeclaration) ElementType() ElementType

func (*TransactionDeclaration) MarshalJSON added in v0.9.0

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

func (*TransactionDeclaration) String added in v0.25.0

func (d *TransactionDeclaration) String() string

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 NewTransfer added in v0.24.0

func NewTransfer(memoryGauge common.MemoryGauge, operation TransferOperation, position Position) *Transfer

func (Transfer) Doc added in v0.24.0

func (f Transfer) Doc() prettier.Doc

func (Transfer) EndPosition

func (f Transfer) EndPosition(memoryGauge common.MemoryGauge) 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

	Doc() prettier.Doc
	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 {
	Type       Type     `json:"AnnotatedType"`
	StartPos   Position `json:"-"`
	IsResource bool
}

func NewTypeAnnotation added in v0.24.0

func NewTypeAnnotation(
	memoryGauge common.MemoryGauge,
	isResource bool,
	typ Type,
	startPos Position,
) *TypeAnnotation

func (*TypeAnnotation) Doc added in v0.24.0

func (t *TypeAnnotation) Doc() prettier.Doc

func (*TypeAnnotation) EndPosition

func (t *TypeAnnotation) EndPosition(memoryGauge common.MemoryGauge) 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 {
	Expression Expression
	StartPos   Position `json:"-"`
	Operation  Operation
}

func NewUnaryExpression added in v0.24.0

func NewUnaryExpression(
	gauge common.MemoryGauge,
	operation Operation,
	expression Expression,
	startPos Position,
) *UnaryExpression

func (*UnaryExpression) Doc added in v0.24.0

func (e *UnaryExpression) Doc() prettier.Doc

func (*UnaryExpression) ElementType added in v0.25.0

func (*UnaryExpression) ElementType() ElementType

func (*UnaryExpression) EndPosition added in v0.2.1

func (e *UnaryExpression) EndPosition(memoryGauge common.MemoryGauge) 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 {
	Value             Expression
	SecondValue       Expression
	TypeAnnotation    *TypeAnnotation
	Transfer          *Transfer
	SecondTransfer    *Transfer
	ParentIfStatement *IfStatement `json:"-"`
	DocString         string
	Identifier        Identifier
	StartPos          Position `json:"-"`
	Access            Access
	IsConstant        bool
}

func NewEmptyVariableDeclaration added in v0.24.0

func NewEmptyVariableDeclaration(gauge common.MemoryGauge) *VariableDeclaration

func NewVariableDeclaration added in v0.24.0

func NewVariableDeclaration(
	gauge common.MemoryGauge,
	access Access,
	isLet bool,
	identifier Identifier,
	typeAnnotation *TypeAnnotation,
	value Expression,
	transfer *Transfer,
	startPos Position,
	secondTransfer *Transfer,
	secondValue Expression,
	docString string,
) *VariableDeclaration

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) Doc added in v0.24.0

func (d *VariableDeclaration) Doc() prettier.Doc

func (*VariableDeclaration) ElementType added in v0.25.0

func (*VariableDeclaration) ElementType() ElementType

func (*VariableDeclaration) EndPosition

func (d *VariableDeclaration) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (d *VariableDeclaration) String() string

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 NewVariableSizedType added in v0.24.0

func NewVariableSizedType(
	memoryGauge common.MemoryGauge,
	typ Type,
	astRange Range,
) *VariableSizedType

func (*VariableSizedType) CheckEqual added in v0.13.0

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

func (*VariableSizedType) Doc added in v0.24.0

func (t *VariableSizedType) Doc() prettier.Doc

func (*VariableSizedType) MarshalJSON added in v0.9.0

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

func (*VariableSizedType) String

func (t *VariableSizedType) String() string

type VoidExpression added in v0.27.1

type VoidExpression struct {
	Range
}

()

func NewVoidExpression added in v0.27.1

func NewVoidExpression(
	gauge common.MemoryGauge,
	startPos Position,
	endPos Position,
) *VoidExpression

func (*VoidExpression) Doc added in v0.27.1

func (v *VoidExpression) Doc() prettier.Doc

func (*VoidExpression) ElementType added in v0.27.1

func (v *VoidExpression) ElementType() ElementType

func (*VoidExpression) EndPosition added in v0.27.1

func (v *VoidExpression) EndPosition(memoryGauge common.MemoryGauge) Position

func (*VoidExpression) StartPosition added in v0.27.1

func (v *VoidExpression) StartPosition() Position

func (*VoidExpression) String added in v0.27.1

func (v *VoidExpression) String() string

func (*VoidExpression) Walk added in v0.27.1

func (v *VoidExpression) Walk(walkChild func(Element))

type VoidExtractor added in v0.27.1

type VoidExtractor interface {
	ExtractVoid(extractor *ExpressionExtractor, expression *VoidExpression) ExpressionExtraction
}

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 NewWhileStatement added in v0.24.0

func NewWhileStatement(
	gauge common.MemoryGauge,
	expression Expression,
	block *Block,
	startPos Position,
) *WhileStatement

func (*WhileStatement) Doc added in v0.24.0

func (s *WhileStatement) Doc() prettier.Doc

func (*WhileStatement) ElementType added in v0.25.0

func (*WhileStatement) ElementType() ElementType

func (*WhileStatement) EndPosition

func (s *WhileStatement) EndPosition(memoryGauge common.MemoryGauge) 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) String added in v0.25.0

func (s *WhileStatement) String() string

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