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
- Variables
- func AccessCount() int
- func CompositeDocument(access Access, kind common.CompositeKind, isInterface bool, identifier string, ...) prettier.Doc
- func ConditionKindCount() int
- func FunctionDocument(access Access, includeKeyword bool, identifier string, ...) prettier.Doc
- func Inspect(element Element, f func(Element) bool)
- func IsEmptyType(t Type) bool
- func LocationDoc(location common.Location) prettier.Doc
- func OperationCount() int
- func Prettier(element interface{ ... }) string
- func QuoteString(s string) string
- func StatementsDoc(statements []Statement) prettier.Doc
- func TransferOperationCount() int
- func VariableKindCount() int
- func VariableKindDoc(kind VariableKind) prettier.Doc
- func Walk(walker Walker, element Element)
- type Access
- type AccessExpression
- type Argument
- type Arguments
- type ArrayExpression
- func (e *ArrayExpression) Accept(visitor Visitor) Repr
- func (e *ArrayExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *ArrayExpression) Doc() prettier.Doc
- func (*ArrayExpression) ElementType() ElementType
- func (e *ArrayExpression) MarshalJSON() ([]byte, error)
- func (e *ArrayExpression) String() string
- func (e *ArrayExpression) Walk(walkChild func(Element))
- type ArrayExtractor
- type AssignmentStatement
- func (s *AssignmentStatement) Accept(visitor Visitor) Repr
- func (s *AssignmentStatement) Doc() prettier.Doc
- func (*AssignmentStatement) ElementType() ElementType
- func (s *AssignmentStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *AssignmentStatement) MarshalJSON() ([]byte, error)
- func (s *AssignmentStatement) StartPosition() Position
- func (s *AssignmentStatement) String() string
- func (s *AssignmentStatement) Walk(walkChild func(Element))
- type BinaryExpression
- func (e *BinaryExpression) Accept(visitor Visitor) Repr
- func (e *BinaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *BinaryExpression) Doc() prettier.Doc
- func (*BinaryExpression) ElementType() ElementType
- func (e *BinaryExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *BinaryExpression) IsLeftAssociative() bool
- func (e *BinaryExpression) MarshalJSON() ([]byte, error)
- func (e *BinaryExpression) StartPosition() Position
- func (e *BinaryExpression) String() string
- func (e *BinaryExpression) Walk(walkChild func(Element))
- type BinaryExtractor
- type Block
- type BoolExpression
- func (e *BoolExpression) Accept(visitor Visitor) Repr
- func (e *BoolExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *BoolExpression) Doc() prettier.Doc
- func (*BoolExpression) ElementType() ElementType
- func (e *BoolExpression) MarshalJSON() ([]byte, error)
- func (e *BoolExpression) String() string
- func (*BoolExpression) Walk(_ func(Element))
- type BoolExtractor
- type BreakStatement
- type CastingExpression
- func (e *CastingExpression) Accept(visitor Visitor) Repr
- func (e *CastingExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *CastingExpression) Doc() prettier.Doc
- func (*CastingExpression) ElementType() ElementType
- func (e *CastingExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *CastingExpression) MarshalJSON() ([]byte, error)
- func (e *CastingExpression) StartPosition() Position
- func (e *CastingExpression) String() string
- func (e *CastingExpression) Walk(walkChild func(Element))
- type CastingExtractor
- type CompositeDeclaration
- func (d *CompositeDeclaration) Accept(visitor Visitor) Repr
- func (d *CompositeDeclaration) DeclarationAccess() Access
- func (d *CompositeDeclaration) DeclarationDocString() string
- func (d *CompositeDeclaration) DeclarationIdentifier() *Identifier
- func (d *CompositeDeclaration) DeclarationKind() common.DeclarationKind
- func (d *CompositeDeclaration) DeclarationMembers() *Members
- func (d *CompositeDeclaration) Doc() prettier.Doc
- func (*CompositeDeclaration) ElementType() ElementType
- func (d *CompositeDeclaration) EventDoc() prettier.Doc
- func (d *CompositeDeclaration) MarshalJSON() ([]byte, error)
- func (d *CompositeDeclaration) String() string
- func (d *CompositeDeclaration) Walk(walkChild func(Element))
- type Condition
- type ConditionKind
- type ConditionalExpression
- func (e *ConditionalExpression) Accept(visitor Visitor) Repr
- func (e *ConditionalExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *ConditionalExpression) Doc() prettier.Doc
- func (*ConditionalExpression) ElementType() ElementType
- func (e *ConditionalExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *ConditionalExpression) MarshalJSON() ([]byte, error)
- func (e *ConditionalExpression) StartPosition() Position
- func (e *ConditionalExpression) String() string
- func (e *ConditionalExpression) Walk(walkChild func(Element))
- type ConditionalExtractor
- type Conditions
- type ConstantSizedType
- type ContinueStatement
- func (s *ContinueStatement) Accept(visitor Visitor) Repr
- func (*ContinueStatement) Doc() prettier.Doc
- func (*ContinueStatement) ElementType() ElementType
- func (s *ContinueStatement) MarshalJSON() ([]byte, error)
- func (s *ContinueStatement) String() string
- func (*ContinueStatement) Walk(_ func(Element))
- type CreateExpression
- func (e *CreateExpression) Accept(visitor Visitor) Repr
- func (e *CreateExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *CreateExpression) Doc() prettier.Doc
- func (*CreateExpression) ElementType() ElementType
- func (e *CreateExpression) EndPosition(common.MemoryGauge) Position
- func (e *CreateExpression) MarshalJSON() ([]byte, error)
- func (e *CreateExpression) StartPosition() Position
- func (e *CreateExpression) String() string
- func (e *CreateExpression) Walk(walkChild func(Element))
- type CreateExtractor
- type Declaration
- type DeclarationVisitor
- type DestroyExpression
- func (e *DestroyExpression) Accept(visitor Visitor) Repr
- func (e *DestroyExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *DestroyExpression) Doc() prettier.Doc
- func (*DestroyExpression) ElementType() ElementType
- func (e *DestroyExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *DestroyExpression) MarshalJSON() ([]byte, error)
- func (e *DestroyExpression) StartPosition() Position
- func (e *DestroyExpression) String() string
- func (e *DestroyExpression) Walk(walkChild func(Element))
- type DestroyExtractor
- type DictionaryEntry
- type DictionaryExpression
- func (e *DictionaryExpression) Accept(visitor Visitor) Repr
- func (e *DictionaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *DictionaryExpression) Doc() prettier.Doc
- func (*DictionaryExpression) ElementType() ElementType
- func (e *DictionaryExpression) MarshalJSON() ([]byte, error)
- func (e *DictionaryExpression) String() string
- func (e *DictionaryExpression) Walk(walkChild func(Element))
- type DictionaryExtractor
- type DictionaryType
- type Element
- type ElementType
- type EmitStatement
- func (s *EmitStatement) Accept(visitor Visitor) Repr
- func (s *EmitStatement) Doc() prettier.Doc
- func (*EmitStatement) ElementType() ElementType
- func (s *EmitStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *EmitStatement) MarshalJSON() ([]byte, error)
- func (s *EmitStatement) StartPosition() Position
- func (s *EmitStatement) String() string
- func (s *EmitStatement) Walk(walkChild func(Element))
- type EnumCaseDeclaration
- func (d *EnumCaseDeclaration) Accept(visitor Visitor) Repr
- func (d *EnumCaseDeclaration) DeclarationAccess() Access
- func (d *EnumCaseDeclaration) DeclarationDocString() string
- func (d *EnumCaseDeclaration) DeclarationIdentifier() *Identifier
- func (d *EnumCaseDeclaration) DeclarationKind() common.DeclarationKind
- func (d *EnumCaseDeclaration) DeclarationMembers() *Members
- func (d *EnumCaseDeclaration) Doc() prettier.Doc
- func (*EnumCaseDeclaration) ElementType() ElementType
- func (d *EnumCaseDeclaration) EndPosition(memoryGauge common.MemoryGauge) Position
- func (d *EnumCaseDeclaration) MarshalJSON() ([]byte, error)
- func (d *EnumCaseDeclaration) StartPosition() Position
- func (d *EnumCaseDeclaration) String() string
- func (*EnumCaseDeclaration) Walk(_ func(Element))
- type Expression
- type ExpressionExtraction
- type ExpressionExtractor
- func (extractor *ExpressionExtractor) Extract(expression Expression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractArray(expression *ArrayExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractBinary(expression *BinaryExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractBool(expression *BoolExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractCast(expression *CastingExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractConditional(expression *ConditionalExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractCreate(expression *CreateExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractDestroy(expression *DestroyExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractDictionary(expression *DictionaryExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractFixedPoint(expression *FixedPointExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractForce(expression *ForceExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractFunction(_ *FunctionExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractIdentifier(expression *IdentifierExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractIndex(expression *IndexExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractInteger(expression *IntegerExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractInvocation(expression *InvocationExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractMember(expression *MemberExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractNil(expression *NilExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractPath(expression *PathExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractReference(expression *ReferenceExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractString(expression *StringExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) ExtractUnary(expression *UnaryExpression) ExpressionExtraction
- func (extractor *ExpressionExtractor) FormatIdentifier(identifier int) string
- func (extractor *ExpressionExtractor) FreshIdentifier() string
- func (extractor *ExpressionExtractor) VisitArrayExpression(expression *ArrayExpression) Repr
- func (extractor *ExpressionExtractor) VisitBinaryExpression(expression *BinaryExpression) Repr
- func (extractor *ExpressionExtractor) VisitBoolExpression(expression *BoolExpression) Repr
- func (extractor *ExpressionExtractor) VisitCastingExpression(expression *CastingExpression) Repr
- func (extractor *ExpressionExtractor) VisitConditionalExpression(expression *ConditionalExpression) Repr
- func (extractor *ExpressionExtractor) VisitCreateExpression(expression *CreateExpression) Repr
- func (extractor *ExpressionExtractor) VisitDestroyExpression(expression *DestroyExpression) Repr
- func (extractor *ExpressionExtractor) VisitDictionaryExpression(expression *DictionaryExpression) Repr
- func (extractor *ExpressionExtractor) VisitExpressions(expressions []Expression) ([]Expression, []ExtractedExpression)
- func (extractor *ExpressionExtractor) VisitFixedPointExpression(expression *FixedPointExpression) Repr
- func (extractor *ExpressionExtractor) VisitForceExpression(expression *ForceExpression) Repr
- func (extractor *ExpressionExtractor) VisitFunctionExpression(expression *FunctionExpression) Repr
- func (extractor *ExpressionExtractor) VisitIdentifierExpression(expression *IdentifierExpression) Repr
- func (extractor *ExpressionExtractor) VisitIndexExpression(expression *IndexExpression) Repr
- func (extractor *ExpressionExtractor) VisitIntegerExpression(expression *IntegerExpression) Repr
- func (extractor *ExpressionExtractor) VisitInvocationExpression(expression *InvocationExpression) Repr
- func (extractor *ExpressionExtractor) VisitMemberExpression(expression *MemberExpression) Repr
- func (extractor *ExpressionExtractor) VisitNilExpression(expression *NilExpression) Repr
- func (extractor *ExpressionExtractor) VisitPathExpression(expression *PathExpression) Repr
- func (extractor *ExpressionExtractor) VisitReferenceExpression(expression *ReferenceExpression) Repr
- func (extractor *ExpressionExtractor) VisitStringExpression(expression *StringExpression) Repr
- func (extractor *ExpressionExtractor) VisitUnaryExpression(expression *UnaryExpression) Repr
- type ExpressionStatement
- func (s *ExpressionStatement) Accept(visitor Visitor) Repr
- func (s *ExpressionStatement) Doc() prettier.Doc
- func (*ExpressionStatement) ElementType() ElementType
- func (s *ExpressionStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *ExpressionStatement) MarshalJSON() ([]byte, error)
- func (s *ExpressionStatement) StartPosition() Position
- func (s *ExpressionStatement) String() string
- func (s *ExpressionStatement) Walk(walkChild func(Element))
- type ExpressionVisitor
- type ExtractedExpression
- type FieldDeclaration
- func (d *FieldDeclaration) Accept(visitor Visitor) Repr
- func (d *FieldDeclaration) DeclarationAccess() Access
- func (d *FieldDeclaration) DeclarationDocString() string
- func (d *FieldDeclaration) DeclarationIdentifier() *Identifier
- func (d *FieldDeclaration) DeclarationKind() common.DeclarationKind
- func (d *FieldDeclaration) DeclarationMembers() *Members
- func (d *FieldDeclaration) Doc() prettier.Doc
- func (*FieldDeclaration) ElementType() ElementType
- func (d *FieldDeclaration) MarshalJSON() ([]byte, error)
- func (d *FieldDeclaration) String() string
- func (d *FieldDeclaration) Walk(_ func(Element))
- type FixedPointExpression
- func (e *FixedPointExpression) Accept(visitor Visitor) Repr
- func (e *FixedPointExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *FixedPointExpression) Doc() prettier.Doc
- func (*FixedPointExpression) ElementType() ElementType
- func (e *FixedPointExpression) MarshalJSON() ([]byte, error)
- func (e *FixedPointExpression) String() string
- func (*FixedPointExpression) Walk(_ func(Element))
- type FixedPointExtractor
- type ForStatement
- func (s *ForStatement) Accept(visitor Visitor) Repr
- func (s *ForStatement) Doc() prettier.Doc
- func (*ForStatement) ElementType() ElementType
- func (s *ForStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *ForStatement) MarshalJSON() ([]byte, error)
- func (s *ForStatement) StartPosition() Position
- func (s *ForStatement) String() string
- func (s *ForStatement) Walk(walkChild func(Element))
- type ForceExpression
- func (e *ForceExpression) Accept(visitor Visitor) Repr
- func (e *ForceExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *ForceExpression) Doc() prettier.Doc
- func (*ForceExpression) ElementType() ElementType
- func (e *ForceExpression) EndPosition(common.MemoryGauge) Position
- func (e *ForceExpression) MarshalJSON() ([]byte, error)
- func (e *ForceExpression) StartPosition() Position
- func (e *ForceExpression) String() string
- func (e *ForceExpression) Walk(walkChild func(Element))
- type ForceExtractor
- type FunctionBlock
- func (b *FunctionBlock) Accept(visitor Visitor) Repr
- func (b *FunctionBlock) Doc() prettier.Doc
- func (*FunctionBlock) ElementType() ElementType
- func (b *FunctionBlock) EndPosition(common.MemoryGauge) Position
- func (b *FunctionBlock) HasStatements() bool
- func (b *FunctionBlock) IsEmpty() bool
- func (b *FunctionBlock) MarshalJSON() ([]byte, error)
- func (b *FunctionBlock) StartPosition() Position
- func (b *FunctionBlock) String() string
- func (b *FunctionBlock) Walk(walkChild func(Element))
- type FunctionDeclaration
- func (d *FunctionDeclaration) Accept(visitor Visitor) Repr
- func (d *FunctionDeclaration) DeclarationAccess() Access
- func (d *FunctionDeclaration) DeclarationDocString() string
- func (d *FunctionDeclaration) DeclarationIdentifier() *Identifier
- func (d *FunctionDeclaration) DeclarationKind() common.DeclarationKind
- func (d *FunctionDeclaration) DeclarationMembers() *Members
- func (d *FunctionDeclaration) Doc() prettier.Doc
- func (*FunctionDeclaration) ElementType() ElementType
- func (d *FunctionDeclaration) EndPosition(memoryGauge common.MemoryGauge) Position
- func (d *FunctionDeclaration) MarshalJSON() ([]byte, error)
- func (d *FunctionDeclaration) StartPosition() Position
- func (d *FunctionDeclaration) String() string
- func (d *FunctionDeclaration) ToExpression(memoryGauge common.MemoryGauge) *FunctionExpression
- func (d *FunctionDeclaration) Walk(walkChild func(Element))
- type FunctionExpression
- func (e *FunctionExpression) Accept(visitor Visitor) Repr
- func (e *FunctionExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *FunctionExpression) Doc() prettier.Doc
- func (*FunctionExpression) ElementType() ElementType
- func (e *FunctionExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *FunctionExpression) MarshalJSON() ([]byte, error)
- func (e *FunctionExpression) StartPosition() Position
- func (e *FunctionExpression) String() string
- func (e *FunctionExpression) Walk(walkChild func(Element))
- type FunctionExtractor
- type FunctionType
- type HasPosition
- type Identifier
- type IdentifierExpression
- func (e *IdentifierExpression) Accept(visitor Visitor) Repr
- func (e *IdentifierExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *IdentifierExpression) Doc() prettier.Doc
- func (*IdentifierExpression) ElementType() ElementType
- func (e *IdentifierExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *IdentifierExpression) MarshalJSON() ([]byte, error)
- func (e *IdentifierExpression) StartPosition() Position
- func (e *IdentifierExpression) String() string
- func (*IdentifierExpression) Walk(_ func(Element))
- type IdentifierExtractor
- type IfStatement
- func (s *IfStatement) Accept(visitor Visitor) Repr
- func (s *IfStatement) Doc() prettier.Doc
- func (*IfStatement) ElementType() ElementType
- func (s *IfStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *IfStatement) MarshalJSON() ([]byte, error)
- func (s *IfStatement) StartPosition() Position
- func (s *IfStatement) String() string
- func (s *IfStatement) Walk(walkChild func(Element))
- type IfStatementTest
- type ImportDeclaration
- func (d *ImportDeclaration) Accept(visitor Visitor) Repr
- func (d *ImportDeclaration) DeclarationAccess() Access
- func (d *ImportDeclaration) DeclarationDocString() string
- func (d *ImportDeclaration) DeclarationIdentifier() *Identifier
- func (d *ImportDeclaration) DeclarationKind() common.DeclarationKind
- func (d *ImportDeclaration) DeclarationMembers() *Members
- func (d *ImportDeclaration) Doc() prettier.Doc
- func (*ImportDeclaration) ElementType() ElementType
- func (d *ImportDeclaration) MarshalJSON() ([]byte, error)
- func (d *ImportDeclaration) String() string
- func (*ImportDeclaration) Walk(_ func(Element))
- type IndexExpression
- func (e *IndexExpression) Accept(visitor Visitor) Repr
- func (e *IndexExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *IndexExpression) AccessedExpression() Expression
- func (e *IndexExpression) Doc() prettier.Doc
- func (*IndexExpression) ElementType() ElementType
- func (e *IndexExpression) MarshalJSON() ([]byte, error)
- func (e *IndexExpression) String() string
- func (e *IndexExpression) Walk(walkChild func(Element))
- type IndexExtractor
- type Inspector
- type InstantiationType
- func (t *InstantiationType) CheckEqual(other Type, checker TypeEqualityChecker) error
- func (t *InstantiationType) Doc() prettier.Doc
- func (t *InstantiationType) EndPosition(common.MemoryGauge) Position
- func (t *InstantiationType) MarshalJSON() ([]byte, error)
- func (t *InstantiationType) StartPosition() Position
- func (t *InstantiationType) String() string
- type IntExtractor
- type IntegerExpression
- func (e *IntegerExpression) Accept(visitor Visitor) Repr
- func (e *IntegerExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *IntegerExpression) Doc() prettier.Doc
- func (*IntegerExpression) ElementType() ElementType
- func (e *IntegerExpression) MarshalJSON() ([]byte, error)
- func (e *IntegerExpression) String() string
- func (*IntegerExpression) Walk(_ func(Element))
- type InterfaceDeclaration
- func (d *InterfaceDeclaration) Accept(visitor Visitor) Repr
- func (d *InterfaceDeclaration) DeclarationAccess() Access
- func (d *InterfaceDeclaration) DeclarationDocString() string
- func (d *InterfaceDeclaration) DeclarationIdentifier() *Identifier
- func (d *InterfaceDeclaration) DeclarationKind() common.DeclarationKind
- func (d *InterfaceDeclaration) DeclarationMembers() *Members
- func (d *InterfaceDeclaration) Doc() prettier.Doc
- func (*InterfaceDeclaration) ElementType() ElementType
- func (d *InterfaceDeclaration) MarshalJSON() ([]byte, error)
- func (d *InterfaceDeclaration) String() string
- func (d *InterfaceDeclaration) Walk(walkChild func(Element))
- type InvocationExpression
- func (e *InvocationExpression) Accept(visitor Visitor) Repr
- func (e *InvocationExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *InvocationExpression) Doc() prettier.Doc
- func (*InvocationExpression) ElementType() ElementType
- func (e *InvocationExpression) EndPosition(_ common.MemoryGauge) Position
- func (e *InvocationExpression) MarshalJSON() ([]byte, error)
- func (e *InvocationExpression) StartPosition() Position
- func (e *InvocationExpression) String() string
- func (e *InvocationExpression) Walk(walkChild func(Element))
- type InvocationExtractor
- type MemberExpression
- func (e *MemberExpression) Accept(visitor Visitor) Repr
- func (e *MemberExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *MemberExpression) AccessedExpression() Expression
- func (e *MemberExpression) Doc() prettier.Doc
- func (*MemberExpression) ElementType() ElementType
- func (e *MemberExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *MemberExpression) MarshalJSON() ([]byte, error)
- func (e *MemberExpression) StartPosition() Position
- func (e *MemberExpression) String() string
- func (e *MemberExpression) Walk(walkChild func(Element))
- type MemberExtractor
- type Members
- func (m *Members) Composites() []*CompositeDeclaration
- func (m *Members) CompositesByIdentifier() map[string]*CompositeDeclaration
- func (m *Members) Declarations() []Declaration
- func (m *Members) Destructor() *SpecialFunctionDeclaration
- func (m *Members) Destructors() []*SpecialFunctionDeclaration
- func (m *Members) Doc() prettier.Doc
- func (m *Members) EnumCases() []*EnumCaseDeclaration
- func (m *Members) FieldPosition(name string, compositeKind common.CompositeKind) Position
- func (m *Members) Fields() []*FieldDeclaration
- func (m *Members) FieldsByIdentifier() map[string]*FieldDeclaration
- func (m *Members) Functions() []*FunctionDeclaration
- func (m *Members) FunctionsByIdentifier() map[string]*FunctionDeclaration
- func (m *Members) Initializers() []*SpecialFunctionDeclaration
- func (m *Members) Interfaces() []*InterfaceDeclaration
- func (m *Members) InterfacesByIdentifier() map[string]*InterfaceDeclaration
- func (m *Members) MarshalJSON() ([]byte, error)
- func (m *Members) SpecialFunctions() []*SpecialFunctionDeclaration
- type NilExpression
- func (e *NilExpression) Accept(visitor Visitor) Repr
- func (e *NilExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (*NilExpression) Doc() prettier.Doc
- func (*NilExpression) ElementType() ElementType
- func (e *NilExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *NilExpression) MarshalJSON() ([]byte, error)
- func (e *NilExpression) StartPosition() Position
- func (e *NilExpression) String() string
- func (*NilExpression) Walk(_ func(Element))
- type NilExtractor
- type NominalType
- func (t *NominalType) CheckEqual(other Type, checker TypeEqualityChecker) error
- func (t *NominalType) Doc() prettier.Doc
- func (t *NominalType) EndPosition(memoryGauge common.MemoryGauge) Position
- func (t *NominalType) IsQualifiedName() bool
- func (t *NominalType) MarshalJSON() ([]byte, error)
- func (t *NominalType) StartPosition() Position
- func (t *NominalType) String() string
- type NotAnElement
- type Operation
- type OptionalType
- func (t *OptionalType) CheckEqual(other Type, checker TypeEqualityChecker) error
- func (t *OptionalType) Doc() prettier.Doc
- func (t *OptionalType) EndPosition(memoryGauge common.MemoryGauge) Position
- func (t *OptionalType) MarshalJSON() ([]byte, error)
- func (t *OptionalType) StartPosition() Position
- func (t *OptionalType) String() string
- type Parameter
- type ParameterList
- type PathExpression
- func (e *PathExpression) Accept(visitor Visitor) Repr
- func (e *PathExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *PathExpression) Doc() prettier.Doc
- func (*PathExpression) ElementType() ElementType
- func (e *PathExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *PathExpression) MarshalJSON() ([]byte, error)
- func (e *PathExpression) StartPosition() Position
- func (e *PathExpression) String() string
- func (*PathExpression) Walk(_ func(Element))
- type PathExtractor
- type Position
- type PragmaDeclaration
- func (d *PragmaDeclaration) Accept(visitor Visitor) Repr
- func (d *PragmaDeclaration) DeclarationAccess() Access
- func (d *PragmaDeclaration) DeclarationDocString() string
- func (d *PragmaDeclaration) DeclarationIdentifier() *Identifier
- func (d *PragmaDeclaration) DeclarationKind() common.DeclarationKind
- func (d *PragmaDeclaration) DeclarationMembers() *Members
- func (d *PragmaDeclaration) Doc() prettier.Doc
- func (*PragmaDeclaration) ElementType() ElementType
- func (d *PragmaDeclaration) MarshalJSON() ([]byte, error)
- func (d *PragmaDeclaration) String() string
- func (d *PragmaDeclaration) Walk(walkChild func(Element))
- type Program
- func (p *Program) Accept(visitor Visitor) Repr
- func (p *Program) CompositeDeclarations() []*CompositeDeclaration
- func (p *Program) Declarations() []Declaration
- func (p *Program) Doc() prettier.Doc
- func (*Program) ElementType() ElementType
- func (p *Program) EndPosition(memoryGauge common.MemoryGauge) Position
- func (p *Program) FunctionDeclarations() []*FunctionDeclaration
- func (p *Program) ImportDeclarations() []*ImportDeclaration
- func (p *Program) InterfaceDeclarations() []*InterfaceDeclaration
- func (p *Program) MarshalJSON() ([]byte, error)
- func (p *Program) PragmaDeclarations() []*PragmaDeclaration
- func (p *Program) SoleContractDeclaration() *CompositeDeclaration
- func (p *Program) SoleContractInterfaceDeclaration() *InterfaceDeclaration
- func (p *Program) SoleTransactionDeclaration() *TransactionDeclaration
- func (p *Program) StartPosition() Position
- func (p *Program) TransactionDeclarations() []*TransactionDeclaration
- func (p *Program) VariableDeclarations() []*VariableDeclaration
- func (p *Program) Walk(walkChild func(Element))
- type Range
- type ReferenceExpression
- func (e *ReferenceExpression) Accept(visitor Visitor) Repr
- func (e *ReferenceExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *ReferenceExpression) Doc() prettier.Doc
- func (*ReferenceExpression) ElementType() ElementType
- func (e *ReferenceExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *ReferenceExpression) MarshalJSON() ([]byte, error)
- func (e *ReferenceExpression) StartPosition() Position
- func (e *ReferenceExpression) String() string
- func (e *ReferenceExpression) Walk(walkChild func(Element))
- type ReferenceExtractor
- type ReferenceType
- func (t *ReferenceType) CheckEqual(other Type, checker TypeEqualityChecker) error
- func (t *ReferenceType) Doc() prettier.Doc
- func (t *ReferenceType) EndPosition(memoryGauge common.MemoryGauge) Position
- func (t *ReferenceType) MarshalJSON() ([]byte, error)
- func (t *ReferenceType) StartPosition() Position
- func (t *ReferenceType) String() string
- type Repr
- type RestrictedType
- type ReturnStatement
- func (s *ReturnStatement) Accept(visitor Visitor) Repr
- func (s *ReturnStatement) Doc() prettier.Doc
- func (*ReturnStatement) ElementType() ElementType
- func (s *ReturnStatement) MarshalJSON() ([]byte, error)
- func (s *ReturnStatement) String() string
- func (s *ReturnStatement) Walk(walkChild func(Element))
- type SpecialFunctionDeclaration
- func (d *SpecialFunctionDeclaration) Accept(visitor Visitor) Repr
- func (d *SpecialFunctionDeclaration) DeclarationAccess() Access
- func (d *SpecialFunctionDeclaration) DeclarationDocString() string
- func (d *SpecialFunctionDeclaration) DeclarationIdentifier() *Identifier
- func (d *SpecialFunctionDeclaration) DeclarationKind() common.DeclarationKind
- func (d *SpecialFunctionDeclaration) DeclarationMembers() *Members
- func (d *SpecialFunctionDeclaration) Doc() prettier.Doc
- func (*SpecialFunctionDeclaration) ElementType() ElementType
- func (d *SpecialFunctionDeclaration) EndPosition(memoryGauge common.MemoryGauge) Position
- func (d *SpecialFunctionDeclaration) MarshalJSON() ([]byte, error)
- func (d *SpecialFunctionDeclaration) StartPosition() Position
- func (d *SpecialFunctionDeclaration) String() string
- func (d *SpecialFunctionDeclaration) Walk(walkChild func(Element))
- type Statement
- type StatementDeclarationVisitor
- type StatementVisitor
- type StringExpression
- func (e *StringExpression) Accept(visitor Visitor) Repr
- func (e *StringExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *StringExpression) Doc() prettier.Doc
- func (*StringExpression) ElementType() ElementType
- func (e *StringExpression) MarshalJSON() ([]byte, error)
- func (e *StringExpression) String() string
- func (*StringExpression) Walk(_ func(Element))
- type StringExtractor
- type SwapStatement
- func (s *SwapStatement) Accept(visitor Visitor) Repr
- func (s *SwapStatement) Doc() prettier.Doc
- func (*SwapStatement) ElementType() ElementType
- func (s *SwapStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *SwapStatement) MarshalJSON() ([]byte, error)
- func (s *SwapStatement) StartPosition() Position
- func (s *SwapStatement) String() string
- func (s *SwapStatement) Walk(walkChild func(Element))
- type SwitchCase
- type SwitchStatement
- func (s *SwitchStatement) Accept(visitor Visitor) Repr
- func (s *SwitchStatement) Doc() prettier.Doc
- func (*SwitchStatement) ElementType() ElementType
- func (s *SwitchStatement) MarshalJSON() ([]byte, error)
- func (s *SwitchStatement) String() string
- func (s *SwitchStatement) Walk(walkChild func(Element))
- type TransactionDeclaration
- func (d *TransactionDeclaration) Accept(visitor Visitor) Repr
- func (d *TransactionDeclaration) DeclarationAccess() Access
- func (d *TransactionDeclaration) DeclarationDocString() string
- func (d *TransactionDeclaration) DeclarationIdentifier() *Identifier
- func (d *TransactionDeclaration) DeclarationKind() common.DeclarationKind
- func (d *TransactionDeclaration) DeclarationMembers() *Members
- func (d *TransactionDeclaration) Doc() prettier.Doc
- func (*TransactionDeclaration) ElementType() ElementType
- func (d *TransactionDeclaration) MarshalJSON() ([]byte, error)
- func (d *TransactionDeclaration) String() string
- func (d *TransactionDeclaration) Walk(walkChild func(Element))
- type Transfer
- type TransferOperation
- type Type
- type TypeAnnotation
- type TypeEqualityChecker
- type UnaryExpression
- func (e *UnaryExpression) Accept(visitor Visitor) Repr
- func (e *UnaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
- func (e *UnaryExpression) Doc() prettier.Doc
- func (*UnaryExpression) ElementType() ElementType
- func (e *UnaryExpression) EndPosition(memoryGauge common.MemoryGauge) Position
- func (e *UnaryExpression) MarshalJSON() ([]byte, error)
- func (e *UnaryExpression) StartPosition() Position
- func (e *UnaryExpression) String() string
- func (e *UnaryExpression) Walk(walkChild func(Element))
- type UnaryExtractor
- type VariableDeclaration
- func (d *VariableDeclaration) Accept(visitor Visitor) Repr
- func (d *VariableDeclaration) DeclarationAccess() Access
- func (d *VariableDeclaration) DeclarationDocString() string
- func (d *VariableDeclaration) DeclarationIdentifier() *Identifier
- func (d *VariableDeclaration) DeclarationKind() common.DeclarationKind
- func (d *VariableDeclaration) DeclarationMembers() *Members
- func (d *VariableDeclaration) Doc() prettier.Doc
- func (*VariableDeclaration) ElementType() ElementType
- func (d *VariableDeclaration) EndPosition(memoryGauge common.MemoryGauge) Position
- func (d *VariableDeclaration) MarshalJSON() ([]byte, error)
- func (d *VariableDeclaration) StartPosition() Position
- func (d *VariableDeclaration) String() string
- func (d *VariableDeclaration) Walk(walkChild func(Element))
- type VariableKind
- type VariableSizedType
- type Visitor
- type Walker
- type WhileStatement
- func (s *WhileStatement) Accept(visitor Visitor) Repr
- func (s *WhileStatement) Doc() prettier.Doc
- func (*WhileStatement) ElementType() ElementType
- func (s *WhileStatement) EndPosition(memoryGauge common.MemoryGauge) Position
- func (s *WhileStatement) MarshalJSON() ([]byte, error)
- func (s *WhileStatement) StartPosition() Position
- func (s *WhileStatement) String() string
- func (s *WhileStatement) Walk(walkChild func(Element))
Constants ¶
const NilConstant = "nil"
Variables ¶
var AllAccesses = append(BasicAccesses[:], AccessContract, AccessAccount, )
var BasicAccesses = []Access{ AccessNotSpecified, AccessPrivate, AccessPublic, AccessPublicSettable, }
var EmptyPosition = Position{}
var EmptyRange = Range{}
var VariableKinds = []VariableKind{ VariableKindConstant, VariableKindVariable, }
Functions ¶
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, includeKeyword bool, identifier string, parameterList *ParameterList, returnTypeAnnotation *TypeAnnotation, block *FunctionBlock, ) prettier.Doc
func IsEmptyType ¶ added in v0.24.0
func OperationCount ¶ added in v0.8.0
func OperationCount() int
func QuoteString ¶ added in v0.24.0
func StatementsDoc ¶ added in v0.24.0
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
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
func (Access) Description ¶
func (Access) IsLessPermissiveThan ¶
func (Access) MarshalJSON ¶ added in v0.5.0
type AccessExpression ¶
type AccessExpression interface {
Expression
AccessedExpression() Expression
// contains filtered or unexported methods
}
type Argument ¶
type Argument struct {
Label string `json:",omitempty"`
LabelStartPos *Position `json:",omitempty"`
LabelEndPos *Position `json:",omitempty"`
TrailingSeparatorPos Position
Expression Expression
}
func 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) EndPosition ¶ added in v0.5.0
func (a *Argument) EndPosition(memoryGauge common.MemoryGauge) Position
func (*Argument) MarshalJSON ¶ added in v0.5.0
func (*Argument) StartPosition ¶ added in v0.5.0
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) Accept ¶
func (e *ArrayExpression) Accept(visitor Visitor) Repr
func (*ArrayExpression) AcceptExp ¶
func (e *ArrayExpression) AcceptExp(visitor ExpressionVisitor) Repr
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) Accept ¶
func (s *AssignmentStatement) Accept(visitor Visitor) Repr
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 {
Operation Operation
Left Expression
Right Expression
}
func NewBinaryExpression ¶ added in v0.24.0
func NewBinaryExpression( gauge common.MemoryGauge, operation Operation, left Expression, right Expression, ) *BinaryExpression
func (*BinaryExpression) Accept ¶
func (e *BinaryExpression) Accept(visitor Visitor) Repr
func (*BinaryExpression) AcceptExp ¶
func (e *BinaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 ¶
func NewBlock ¶ added in v0.24.0
func NewBlock(memoryGauge common.MemoryGauge, statements []Statement, astRange Range) *Block
func (*Block) ElementType ¶ added in v0.25.0
func (*Block) ElementType() ElementType
func (*Block) MarshalJSON ¶ added in v0.8.0
type BoolExpression ¶
func NewBoolExpression ¶ added in v0.24.0
func NewBoolExpression(gauge common.MemoryGauge, value bool, exprRange Range) *BoolExpression
func (*BoolExpression) Accept ¶
func (e *BoolExpression) Accept(visitor Visitor) Repr
func (*BoolExpression) AcceptExp ¶
func (e *BoolExpression) AcceptExp(visitor ExpressionVisitor) Repr
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) Accept ¶
func (s *BreakStatement) Accept(visitor Visitor) Repr
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
Operation Operation
TypeAnnotation *TypeAnnotation
ParentVariableDeclaration *VariableDeclaration `json:"-"`
}
func NewCastingExpression ¶ added in v0.24.0
func NewCastingExpression( gauge common.MemoryGauge, expression Expression, operation Operation, typeAnnotation *TypeAnnotation, parentVariableDecl *VariableDeclaration, ) *CastingExpression
func (*CastingExpression) Accept ¶
func (e *CastingExpression) Accept(visitor Visitor) Repr
func (*CastingExpression) AcceptExp ¶
func (e *CastingExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
Access Access
CompositeKind common.CompositeKind
Identifier Identifier
Conformances []*NominalType
Members *Members
DocString string
Range
}
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) Accept ¶
func (d *CompositeDeclaration) Accept(visitor Visitor) Repr
func (*CompositeDeclaration) DeclarationAccess ¶
func (d *CompositeDeclaration) DeclarationAccess() Access
func (*CompositeDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *CompositeDeclaration) DeclarationDocString() string
func (*CompositeDeclaration) DeclarationIdentifier ¶
func (d *CompositeDeclaration) DeclarationIdentifier() *Identifier
func (*CompositeDeclaration) DeclarationKind ¶
func (d *CompositeDeclaration) DeclarationKind() common.DeclarationKind
func (*CompositeDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *CompositeDeclaration) DeclarationMembers() *Members
func (*CompositeDeclaration) Doc ¶ added in v0.25.0
func (d *CompositeDeclaration) Doc() prettier.Doc
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 {
Kind ConditionKind
Test Expression
Message Expression
}
type ConditionKind ¶
type ConditionKind uint
const ( ConditionKindUnknown ConditionKind = iota ConditionKindPre ConditionKindPost )
func (ConditionKind) MarshalJSON ¶ added in v0.5.0
func (k ConditionKind) MarshalJSON() ([]byte, error)
func (ConditionKind) Name ¶
func (k ConditionKind) Name() string
func (ConditionKind) String ¶
func (i ConditionKind) String() string
type ConditionalExpression ¶
type ConditionalExpression struct {
Test Expression
Then Expression
Else Expression
}
func NewConditionalExpression ¶ added in v0.24.0
func NewConditionalExpression( gauge common.MemoryGauge, testExpr Expression, thenExpr Expression, elseExpr Expression, ) *ConditionalExpression
func (*ConditionalExpression) Accept ¶
func (e *ConditionalExpression) Accept(visitor Visitor) Repr
func (*ConditionalExpression) AcceptExp ¶
func (e *ConditionalExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*ConditionalExpression) Doc ¶ added in v0.24.0
func (e *ConditionalExpression) Doc() prettier.Doc
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) Accept ¶
func (s *ContinueStatement) Accept(visitor Visitor) Repr
func (*ContinueStatement) Doc ¶ added in v0.24.0
func (*ContinueStatement) Doc() prettier.Doc
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) Accept ¶
func (e *CreateExpression) Accept(visitor Visitor) Repr
func (*CreateExpression) AcceptExp ¶
func (e *CreateExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 DeclarationVisitor ¶ added in v0.25.0
type DeclarationVisitor interface {
StatementDeclarationVisitor
VisitFieldDeclaration(*FieldDeclaration) Repr
VisitEnumCaseDeclaration(*EnumCaseDeclaration) Repr
VisitPragmaDeclaration(*PragmaDeclaration) Repr
VisitImportDeclaration(*ImportDeclaration) Repr
}
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) Accept ¶
func (e *DestroyExpression) Accept(visitor Visitor) Repr
func (*DestroyExpression) AcceptExp ¶
func (e *DestroyExpression) AcceptExp(visitor ExpressionVisitor) Repr
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) Accept ¶
func (e *DictionaryExpression) Accept(visitor Visitor) Repr
func (*DictionaryExpression) AcceptExp ¶
func (e *DictionaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*DictionaryExpression) Doc ¶ added in v0.24.0
func (e *DictionaryExpression) Doc() prettier.Doc
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 ¶
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
Accept(Visitor) Repr
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 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) Accept ¶
func (s *EmitStatement) Accept(visitor Visitor) Repr
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 {
Access Access
Identifier Identifier
DocString string
StartPos Position `json:"-"`
}
func NewEnumCaseDeclaration ¶ added in v0.24.0
func NewEnumCaseDeclaration( memoryGauge common.MemoryGauge, access Access, identifier Identifier, docString string, startPos Position, ) *EnumCaseDeclaration
func (*EnumCaseDeclaration) Accept ¶ added in v0.10.0
func (d *EnumCaseDeclaration) Accept(visitor Visitor) Repr
func (*EnumCaseDeclaration) DeclarationAccess ¶ added in v0.10.0
func (d *EnumCaseDeclaration) DeclarationAccess() Access
func (*EnumCaseDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *EnumCaseDeclaration) DeclarationDocString() string
func (*EnumCaseDeclaration) DeclarationIdentifier ¶ added in v0.10.0
func (d *EnumCaseDeclaration) DeclarationIdentifier() *Identifier
func (*EnumCaseDeclaration) DeclarationKind ¶ added in v0.10.0
func (d *EnumCaseDeclaration) DeclarationKind() common.DeclarationKind
func (*EnumCaseDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *EnumCaseDeclaration) DeclarationMembers() *Members
func (*EnumCaseDeclaration) 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
AcceptExp(ExpressionVisitor) Repr
Doc() prettier.Doc
// contains filtered or unexported methods
}
type ExpressionExtraction ¶
type ExpressionExtraction struct {
RewrittenExpression Expression
ExtractedExpressions []ExtractedExpression
}
type ExpressionExtractor ¶
type ExpressionExtractor struct {
BoolExtractor BoolExtractor
NilExtractor NilExtractor
IntExtractor IntExtractor
FixedPointExtractor FixedPointExtractor
StringExtractor StringExtractor
ArrayExtractor ArrayExtractor
DictionaryExtractor DictionaryExtractor
IdentifierExtractor IdentifierExtractor
InvocationExtractor InvocationExtractor
MemberExtractor MemberExtractor
IndexExtractor IndexExtractor
ConditionalExtractor ConditionalExtractor
UnaryExtractor UnaryExtractor
BinaryExtractor BinaryExtractor
FunctionExtractor FunctionExtractor
CastingExtractor CastingExtractor
CreateExtractor CreateExtractor
DestroyExtractor DestroyExtractor
ReferenceExtractor ReferenceExtractor
ForceExtractor ForceExtractor
PathExtractor PathExtractor
MemoryGauge common.MemoryGauge
// contains filtered or unexported fields
}
func (*ExpressionExtractor) Extract ¶
func (extractor *ExpressionExtractor) Extract(expression Expression) ExpressionExtraction
func (*ExpressionExtractor) ExtractArray ¶
func (extractor *ExpressionExtractor) ExtractArray(expression *ArrayExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractBinary ¶
func (extractor *ExpressionExtractor) ExtractBinary(expression *BinaryExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractBool ¶
func (extractor *ExpressionExtractor) ExtractBool(expression *BoolExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractCast ¶
func (extractor *ExpressionExtractor) ExtractCast(expression *CastingExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractConditional ¶
func (extractor *ExpressionExtractor) ExtractConditional(expression *ConditionalExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractCreate ¶
func (extractor *ExpressionExtractor) ExtractCreate(expression *CreateExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractDestroy ¶
func (extractor *ExpressionExtractor) ExtractDestroy(expression *DestroyExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractDictionary ¶
func (extractor *ExpressionExtractor) ExtractDictionary(expression *DictionaryExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractFixedPoint ¶
func (extractor *ExpressionExtractor) ExtractFixedPoint(expression *FixedPointExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractForce ¶
func (extractor *ExpressionExtractor) ExtractForce(expression *ForceExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractFunction ¶
func (extractor *ExpressionExtractor) ExtractFunction(_ *FunctionExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractIdentifier ¶
func (extractor *ExpressionExtractor) ExtractIdentifier(expression *IdentifierExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractIndex ¶
func (extractor *ExpressionExtractor) ExtractIndex(expression *IndexExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractInteger ¶
func (extractor *ExpressionExtractor) ExtractInteger(expression *IntegerExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractInvocation ¶
func (extractor *ExpressionExtractor) ExtractInvocation(expression *InvocationExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractMember ¶
func (extractor *ExpressionExtractor) ExtractMember(expression *MemberExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractNil ¶
func (extractor *ExpressionExtractor) ExtractNil(expression *NilExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractPath ¶
func (extractor *ExpressionExtractor) ExtractPath(expression *PathExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractReference ¶
func (extractor *ExpressionExtractor) ExtractReference(expression *ReferenceExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractString ¶
func (extractor *ExpressionExtractor) ExtractString(expression *StringExpression) ExpressionExtraction
func (*ExpressionExtractor) ExtractUnary ¶
func (extractor *ExpressionExtractor) ExtractUnary(expression *UnaryExpression) ExpressionExtraction
func (*ExpressionExtractor) FormatIdentifier ¶
func (extractor *ExpressionExtractor) FormatIdentifier(identifier int) string
func (*ExpressionExtractor) FreshIdentifier ¶
func (extractor *ExpressionExtractor) FreshIdentifier() string
func (*ExpressionExtractor) VisitArrayExpression ¶
func (extractor *ExpressionExtractor) VisitArrayExpression(expression *ArrayExpression) Repr
func (*ExpressionExtractor) VisitBinaryExpression ¶
func (extractor *ExpressionExtractor) VisitBinaryExpression(expression *BinaryExpression) Repr
func (*ExpressionExtractor) VisitBoolExpression ¶
func (extractor *ExpressionExtractor) VisitBoolExpression(expression *BoolExpression) Repr
func (*ExpressionExtractor) VisitCastingExpression ¶
func (extractor *ExpressionExtractor) VisitCastingExpression(expression *CastingExpression) Repr
func (*ExpressionExtractor) VisitConditionalExpression ¶
func (extractor *ExpressionExtractor) VisitConditionalExpression(expression *ConditionalExpression) Repr
func (*ExpressionExtractor) VisitCreateExpression ¶
func (extractor *ExpressionExtractor) VisitCreateExpression(expression *CreateExpression) Repr
func (*ExpressionExtractor) VisitDestroyExpression ¶
func (extractor *ExpressionExtractor) VisitDestroyExpression(expression *DestroyExpression) Repr
func (*ExpressionExtractor) VisitDictionaryExpression ¶
func (extractor *ExpressionExtractor) VisitDictionaryExpression(expression *DictionaryExpression) Repr
func (*ExpressionExtractor) VisitExpressions ¶
func (extractor *ExpressionExtractor) VisitExpressions( expressions []Expression, ) ( []Expression, []ExtractedExpression, )
func (*ExpressionExtractor) VisitFixedPointExpression ¶
func (extractor *ExpressionExtractor) VisitFixedPointExpression(expression *FixedPointExpression) Repr
func (*ExpressionExtractor) VisitForceExpression ¶
func (extractor *ExpressionExtractor) VisitForceExpression(expression *ForceExpression) Repr
func (*ExpressionExtractor) VisitFunctionExpression ¶
func (extractor *ExpressionExtractor) VisitFunctionExpression(expression *FunctionExpression) Repr
func (*ExpressionExtractor) VisitIdentifierExpression ¶
func (extractor *ExpressionExtractor) VisitIdentifierExpression(expression *IdentifierExpression) Repr
func (*ExpressionExtractor) VisitIndexExpression ¶
func (extractor *ExpressionExtractor) VisitIndexExpression(expression *IndexExpression) Repr
func (*ExpressionExtractor) VisitIntegerExpression ¶
func (extractor *ExpressionExtractor) VisitIntegerExpression(expression *IntegerExpression) Repr
func (*ExpressionExtractor) VisitInvocationExpression ¶
func (extractor *ExpressionExtractor) VisitInvocationExpression(expression *InvocationExpression) Repr
func (*ExpressionExtractor) VisitMemberExpression ¶
func (extractor *ExpressionExtractor) VisitMemberExpression(expression *MemberExpression) Repr
func (*ExpressionExtractor) VisitNilExpression ¶
func (extractor *ExpressionExtractor) VisitNilExpression(expression *NilExpression) Repr
func (*ExpressionExtractor) VisitPathExpression ¶
func (extractor *ExpressionExtractor) VisitPathExpression(expression *PathExpression) Repr
func (*ExpressionExtractor) VisitReferenceExpression ¶
func (extractor *ExpressionExtractor) VisitReferenceExpression(expression *ReferenceExpression) Repr
func (*ExpressionExtractor) VisitStringExpression ¶
func (extractor *ExpressionExtractor) VisitStringExpression(expression *StringExpression) Repr
func (*ExpressionExtractor) VisitUnaryExpression ¶
func (extractor *ExpressionExtractor) VisitUnaryExpression(expression *UnaryExpression) Repr
type ExpressionStatement ¶
type ExpressionStatement struct {
Expression Expression
}
func NewExpressionStatement ¶ added in v0.24.0
func NewExpressionStatement(gauge common.MemoryGauge, expression Expression) *ExpressionStatement
func (*ExpressionStatement) Accept ¶
func (s *ExpressionStatement) Accept(visitor Visitor) Repr
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 interface {
VisitBoolExpression(*BoolExpression) Repr
VisitNilExpression(*NilExpression) Repr
VisitIntegerExpression(*IntegerExpression) Repr
VisitFixedPointExpression(*FixedPointExpression) Repr
VisitArrayExpression(*ArrayExpression) Repr
VisitDictionaryExpression(*DictionaryExpression) Repr
VisitIdentifierExpression(*IdentifierExpression) Repr
VisitInvocationExpression(*InvocationExpression) Repr
VisitMemberExpression(*MemberExpression) Repr
VisitIndexExpression(*IndexExpression) Repr
VisitConditionalExpression(*ConditionalExpression) Repr
VisitUnaryExpression(*UnaryExpression) Repr
VisitBinaryExpression(*BinaryExpression) Repr
VisitFunctionExpression(*FunctionExpression) Repr
VisitStringExpression(*StringExpression) Repr
VisitCastingExpression(*CastingExpression) Repr
VisitCreateExpression(*CreateExpression) Repr
VisitDestroyExpression(*DestroyExpression) Repr
VisitReferenceExpression(*ReferenceExpression) Repr
VisitForceExpression(*ForceExpression) Repr
VisitPathExpression(*PathExpression) Repr
}
type ExtractedExpression ¶
type ExtractedExpression struct {
Identifier Identifier
Expression Expression
}
type FieldDeclaration ¶
type FieldDeclaration struct {
Access Access
VariableKind VariableKind
Identifier Identifier
TypeAnnotation *TypeAnnotation
DocString string
Range
}
func NewFieldDeclaration ¶ added in v0.24.0
func NewFieldDeclaration( memoryGauge common.MemoryGauge, access Access, variableKind VariableKind, identifier Identifier, typeAnnotation *TypeAnnotation, docString string, declRange Range, ) *FieldDeclaration
func (*FieldDeclaration) Accept ¶
func (d *FieldDeclaration) Accept(visitor Visitor) Repr
func (*FieldDeclaration) DeclarationAccess ¶
func (d *FieldDeclaration) DeclarationAccess() Access
func (*FieldDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *FieldDeclaration) DeclarationDocString() string
func (*FieldDeclaration) DeclarationIdentifier ¶
func (d *FieldDeclaration) DeclarationIdentifier() *Identifier
func (*FieldDeclaration) DeclarationKind ¶
func (d *FieldDeclaration) DeclarationKind() common.DeclarationKind
func (*FieldDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *FieldDeclaration) DeclarationMembers() *Members
func (*FieldDeclaration) 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) 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 FixedPointExpression ¶
type FixedPointExpression struct {
PositiveLiteral string
Negative bool
UnsignedInteger *big.Int `json:"-"`
Fractional *big.Int `json:"-"`
Scale uint
Range
}
func NewFixedPointExpression ¶ added in v0.24.0
func (*FixedPointExpression) Accept ¶
func (e *FixedPointExpression) Accept(visitor Visitor) Repr
func (*FixedPointExpression) AcceptExp ¶
func (e *FixedPointExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*FixedPointExpression) Doc ¶ added in v0.24.0
func (e *FixedPointExpression) Doc() prettier.Doc
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 {
Identifier Identifier
Index *Identifier
Value Expression
Block *Block
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) Accept ¶
func (s *ForStatement) Accept(visitor Visitor) Repr
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) Accept ¶
func (e *ForceExpression) Accept(visitor Visitor) Repr
func (*ForceExpression) AcceptExp ¶
func (e *ForceExpression) AcceptExp(visitor ExpressionVisitor) Repr
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) Accept ¶
func (b *FunctionBlock) Accept(visitor Visitor) Repr
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 {
Access Access
Identifier Identifier
ParameterList *ParameterList
ReturnTypeAnnotation *TypeAnnotation
FunctionBlock *FunctionBlock
DocString string
StartPos Position `json:"-"`
}
func NewFunctionDeclaration ¶ added in v0.24.0
func NewFunctionDeclaration( gauge common.MemoryGauge, access Access, identifier Identifier, parameterList *ParameterList, returnTypeAnnotation *TypeAnnotation, functionBlock *FunctionBlock, startPos Position, docString string, ) *FunctionDeclaration
func (*FunctionDeclaration) Accept ¶
func (d *FunctionDeclaration) Accept(visitor Visitor) Repr
func (*FunctionDeclaration) DeclarationAccess ¶
func (d *FunctionDeclaration) DeclarationAccess() Access
func (*FunctionDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *FunctionDeclaration) DeclarationDocString() string
func (*FunctionDeclaration) DeclarationIdentifier ¶
func (d *FunctionDeclaration) DeclarationIdentifier() *Identifier
func (*FunctionDeclaration) DeclarationKind ¶
func (d *FunctionDeclaration) DeclarationKind() common.DeclarationKind
func (*FunctionDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *FunctionDeclaration) DeclarationMembers() *Members
func (*FunctionDeclaration) 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) 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 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) Accept ¶
func (e *FunctionExpression) Accept(visitor Visitor) Repr
func (*FunctionExpression) AcceptExp ¶
func (e *FunctionExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
ParameterTypeAnnotations []*TypeAnnotation `json:",omitempty"`
ReturnTypeAnnotation *TypeAnnotation
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 ¶
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) Accept ¶
func (e *IdentifierExpression) Accept(visitor Visitor) Repr
func (*IdentifierExpression) AcceptExp ¶
func (e *IdentifierExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*IdentifierExpression) Doc ¶ added in v0.24.0
func (e *IdentifierExpression) Doc() prettier.Doc
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) Accept ¶
func (s *IfStatement) Accept(visitor Visitor) Repr
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 ImportDeclaration ¶
type ImportDeclaration struct {
Identifiers []Identifier
Location common.Location
LocationPos Position
Range
}
func NewImportDeclaration ¶ added in v0.24.0
func NewImportDeclaration( gauge common.MemoryGauge, identifiers []Identifier, location common.Location, declRange Range, locationPos Position, ) *ImportDeclaration
func (*ImportDeclaration) Accept ¶
func (d *ImportDeclaration) Accept(visitor Visitor) Repr
func (*ImportDeclaration) DeclarationAccess ¶
func (d *ImportDeclaration) DeclarationAccess() Access
func (*ImportDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *ImportDeclaration) DeclarationDocString() string
func (*ImportDeclaration) DeclarationIdentifier ¶
func (d *ImportDeclaration) DeclarationIdentifier() *Identifier
func (*ImportDeclaration) DeclarationKind ¶
func (d *ImportDeclaration) DeclarationKind() common.DeclarationKind
func (*ImportDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *ImportDeclaration) DeclarationMembers() *Members
func (*ImportDeclaration) 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) Accept ¶
func (e *IndexExpression) Accept(visitor Visitor) Repr
func (*IndexExpression) AcceptExp ¶
func (e *IndexExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*IndexExpression) AccessedExpression ¶
func (e *IndexExpression) AccessedExpression() Expression
func (*IndexExpression) 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
NewInspector returns an Inspector for the specified AST element.
func (*Inspector) Elements ¶ added in v0.25.0
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
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 ¶
func NewIntegerExpression ¶ added in v0.24.0
func NewIntegerExpression( gauge common.MemoryGauge, literal string, value *big.Int, base int, tokenRange Range, ) *IntegerExpression
func (*IntegerExpression) Accept ¶
func (e *IntegerExpression) Accept(visitor Visitor) Repr
func (*IntegerExpression) AcceptExp ¶
func (e *IntegerExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
Access Access
CompositeKind common.CompositeKind
Identifier Identifier
Members *Members
DocString string
Range
}
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) Accept ¶
func (d *InterfaceDeclaration) Accept(visitor Visitor) Repr
func (*InterfaceDeclaration) DeclarationAccess ¶
func (d *InterfaceDeclaration) DeclarationAccess() Access
func (*InterfaceDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *InterfaceDeclaration) DeclarationDocString() string
func (*InterfaceDeclaration) DeclarationIdentifier ¶
func (d *InterfaceDeclaration) DeclarationIdentifier() *Identifier
func (*InterfaceDeclaration) DeclarationKind ¶
func (d *InterfaceDeclaration) DeclarationKind() common.DeclarationKind
func (*InterfaceDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *InterfaceDeclaration) DeclarationMembers() *Members
func (*InterfaceDeclaration) Doc ¶ added in v0.25.0
func (d *InterfaceDeclaration) Doc() prettier.Doc
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) Accept ¶
func (e *InvocationExpression) Accept(visitor Visitor) Repr
func (*InvocationExpression) AcceptExp ¶
func (e *InvocationExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*InvocationExpression) Doc ¶ added in v0.24.0
func (e *InvocationExpression) Doc() prettier.Doc
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
Optional bool
// The position of the token (`.`, `?.`) that separates the accessed expression
// and the identifier of the member
AccessPos Position
Identifier Identifier
}
func NewMemberExpression ¶ added in v0.24.0
func NewMemberExpression( gauge common.MemoryGauge, expression Expression, optional bool, accessPos Position, identifier Identifier, ) *MemberExpression
func (*MemberExpression) Accept ¶
func (e *MemberExpression) Accept(visitor Visitor) Repr
func (*MemberExpression) AcceptExp ¶
func (e *MemberExpression) AcceptExp(visitor ExpressionVisitor) Repr
func (*MemberExpression) AccessedExpression ¶
func (e *MemberExpression) AccessedExpression() Expression
func (*MemberExpression) 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) 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 (*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) Accept ¶
func (e *NilExpression) Accept(visitor Visitor) Repr
func (*NilExpression) AcceptExp ¶
func (e *NilExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
Identifier Identifier
NestedIdentifiers []Identifier `json:",omitempty"`
}
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 NotAnElement ¶
type NotAnElement struct{}
func (NotAnElement) Accept ¶
func (NotAnElement) Accept(Visitor) Repr
func (NotAnElement) ElementType ¶ added in v0.25.0
func (NotAnElement) ElementType() ElementType
func (NotAnElement) EndPosition ¶
func (NotAnElement) EndPosition(common.MemoryGauge) Position
func (NotAnElement) StartPosition ¶
func (NotAnElement) StartPosition() Position
func (NotAnElement) Walk ¶ added in v0.17.0
func (NotAnElement) Walk(_ func(Element))
type Operation ¶
type Operation uint
const ( OperationUnknown Operation = iota OperationOr OperationAnd OperationEqual OperationNotEqual OperationLess OperationGreater OperationLessEqual OperationGreaterEqual OperationPlus OperationMinus OperationMul OperationDiv OperationMod OperationNegate OperationNilCoalesce OperationMove OperationCast OperationFailableCast OperationForceCast OperationBitwiseOr OperationBitwiseXor OperationBitwiseAnd OperationBitwiseLeftShift OperationBitwiseRightShift )
func (Operation) MarshalJSON ¶ added in v0.8.0
type OptionalType ¶
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 {
Label string
Identifier Identifier
TypeAnnotation *TypeAnnotation
Range
}
func NewParameter ¶ added in v0.24.0
func NewParameter( gauge common.MemoryGauge, label string, identifier Identifier, typeAnnotation *TypeAnnotation, astRange Range, ) *Parameter
func (Parameter) EffectiveArgumentLabel ¶
EffectiveArgumentLabel returns the effective argument label that an argument in a call must use: If no argument label is declared for parameter, the parameter name is used as the argument label
type ParameterList ¶
type ParameterList struct {
Parameters []*Parameter
Range
// contains filtered or unexported fields
}
func 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 {
StartPos Position `json:"-"`
Domain Identifier
Identifier Identifier
}
func NewPathExpression ¶ added in v0.24.0
func NewPathExpression( gauge common.MemoryGauge, domain Identifier, identifier Identifier, startPos Position, ) *PathExpression
func (*PathExpression) Accept ¶
func (e *PathExpression) Accept(visitor Visitor) Repr
func (*PathExpression) AcceptExp ¶
func (e *PathExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 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
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) Accept ¶ added in v0.7.0
func (d *PragmaDeclaration) Accept(visitor Visitor) Repr
func (*PragmaDeclaration) DeclarationAccess ¶ added in v0.7.0
func (d *PragmaDeclaration) DeclarationAccess() Access
func (*PragmaDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *PragmaDeclaration) DeclarationDocString() string
func (*PragmaDeclaration) DeclarationIdentifier ¶ added in v0.7.0
func (d *PragmaDeclaration) DeclarationIdentifier() *Identifier
func (*PragmaDeclaration) DeclarationKind ¶ added in v0.7.0
func (d *PragmaDeclaration) DeclarationKind() common.DeclarationKind
func (*PragmaDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *PragmaDeclaration) DeclarationMembers() *Members
func (*PragmaDeclaration) 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) 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 (*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 (*Program) TransactionDeclarations ¶
func (p *Program) TransactionDeclarations() []*TransactionDeclaration
func (*Program) VariableDeclarations ¶ added in v0.17.0
func (p *Program) VariableDeclarations() []*VariableDeclaration
type Range ¶
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 NewUnmeteredRangeFromPositioned ¶ added in v0.24.0
func NewUnmeteredRangeFromPositioned(hasPosition HasPosition) Range
func (Range) EndPosition ¶
func (e Range) EndPosition(common.MemoryGauge) Position
func (Range) StartPosition ¶
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) Accept ¶
func (e *ReferenceExpression) Accept(visitor Visitor) Repr
func (*ReferenceExpression) AcceptExp ¶
func (e *ReferenceExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
Authorized bool
Type Type `json:"ReferencedType"`
StartPos Position `json:"-"`
}
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) Accept ¶
func (s *ReturnStatement) Accept(visitor Visitor) Repr
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 {
Kind common.DeclarationKind
FunctionDeclaration *FunctionDeclaration
}
func NewSpecialFunctionDeclaration ¶ added in v0.24.0
func NewSpecialFunctionDeclaration( gauge common.MemoryGauge, kind common.DeclarationKind, funcDecl *FunctionDeclaration, ) *SpecialFunctionDeclaration
func (*SpecialFunctionDeclaration) Accept ¶ added in v0.9.0
func (d *SpecialFunctionDeclaration) Accept(visitor Visitor) Repr
func (*SpecialFunctionDeclaration) DeclarationAccess ¶ added in v0.9.0
func (d *SpecialFunctionDeclaration) DeclarationAccess() Access
func (*SpecialFunctionDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *SpecialFunctionDeclaration) DeclarationDocString() string
func (*SpecialFunctionDeclaration) DeclarationIdentifier ¶ added in v0.9.0
func (d *SpecialFunctionDeclaration) DeclarationIdentifier() *Identifier
func (*SpecialFunctionDeclaration) DeclarationKind ¶
func (d *SpecialFunctionDeclaration) DeclarationKind() common.DeclarationKind
func (*SpecialFunctionDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *SpecialFunctionDeclaration) DeclarationMembers() *Members
func (*SpecialFunctionDeclaration) Doc ¶ added in v0.25.0
func (d *SpecialFunctionDeclaration) Doc() prettier.Doc
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 StatementDeclarationVisitor ¶ added in v0.25.0
type StatementDeclarationVisitor interface {
VisitVariableDeclaration(*VariableDeclaration) Repr
VisitFunctionDeclaration(*FunctionDeclaration) Repr
VisitSpecialFunctionDeclaration(*SpecialFunctionDeclaration) Repr
VisitCompositeDeclaration(*CompositeDeclaration) Repr
VisitInterfaceDeclaration(*InterfaceDeclaration) Repr
VisitTransactionDeclaration(*TransactionDeclaration) Repr
}
type StatementVisitor ¶
type StatementVisitor interface {
StatementDeclarationVisitor
VisitReturnStatement(*ReturnStatement) Repr
VisitBreakStatement(*BreakStatement) Repr
VisitContinueStatement(*ContinueStatement) Repr
VisitIfStatement(*IfStatement) Repr
VisitSwitchStatement(*SwitchStatement) Repr
VisitWhileStatement(*WhileStatement) Repr
VisitForStatement(*ForStatement) Repr
VisitEmitStatement(*EmitStatement) Repr
VisitAssignmentStatement(*AssignmentStatement) Repr
VisitSwapStatement(*SwapStatement) Repr
VisitExpressionStatement(*ExpressionStatement) Repr
}
type StringExpression ¶
func NewStringExpression ¶ added in v0.24.0
func NewStringExpression(gauge common.MemoryGauge, value string, exprRange Range) *StringExpression
func (*StringExpression) Accept ¶
func (e *StringExpression) Accept(visitor Visitor) Repr
func (*StringExpression) AcceptExp ¶
func (e *StringExpression) AcceptExp(visitor ExpressionVisitor) Repr
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) Accept ¶
func (s *SwapStatement) Accept(visitor Visitor) Repr
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) Accept ¶ added in v0.10.0
func (s *SwitchStatement) Accept(visitor Visitor) Repr
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
Fields []*FieldDeclaration
Prepare *SpecialFunctionDeclaration
PreConditions *Conditions
Execute *SpecialFunctionDeclaration
PostConditions *Conditions
DocString string
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) Accept ¶
func (d *TransactionDeclaration) Accept(visitor Visitor) Repr
func (*TransactionDeclaration) DeclarationAccess ¶
func (d *TransactionDeclaration) DeclarationAccess() Access
func (*TransactionDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *TransactionDeclaration) DeclarationDocString() string
func (*TransactionDeclaration) DeclarationIdentifier ¶
func (d *TransactionDeclaration) DeclarationIdentifier() *Identifier
func (*TransactionDeclaration) DeclarationKind ¶
func (d *TransactionDeclaration) DeclarationKind() common.DeclarationKind
func (*TransactionDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *TransactionDeclaration) DeclarationMembers() *Members
func (*TransactionDeclaration) Doc ¶ added in v0.25.0
func (d *TransactionDeclaration) Doc() prettier.Doc
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) EndPosition ¶
func (f Transfer) EndPosition(memoryGauge common.MemoryGauge) Position
func (Transfer) MarshalJSON ¶ added in v0.8.0
func (Transfer) StartPosition ¶
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 {
IsResource bool
Type Type `json:"AnnotatedType"`
StartPos Position `json:"-"`
}
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 {
Operation Operation
Expression Expression
StartPos Position `json:"-"`
}
func NewUnaryExpression ¶ added in v0.24.0
func NewUnaryExpression( gauge common.MemoryGauge, operation Operation, expression Expression, startPos Position, ) *UnaryExpression
func (*UnaryExpression) Accept ¶
func (e *UnaryExpression) Accept(visitor Visitor) Repr
func (*UnaryExpression) AcceptExp ¶
func (e *UnaryExpression) AcceptExp(visitor ExpressionVisitor) Repr
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 {
Access Access
IsConstant bool
Identifier Identifier
TypeAnnotation *TypeAnnotation
Value Expression
Transfer *Transfer
StartPos Position `json:"-"`
SecondTransfer *Transfer
SecondValue Expression
ParentIfStatement *IfStatement `json:"-"`
DocString string
}
func 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) Accept ¶
func (d *VariableDeclaration) Accept(visitor Visitor) Repr
func (*VariableDeclaration) DeclarationAccess ¶
func (d *VariableDeclaration) DeclarationAccess() Access
func (*VariableDeclaration) DeclarationDocString ¶ added in v0.17.0
func (d *VariableDeclaration) DeclarationDocString() string
func (*VariableDeclaration) DeclarationIdentifier ¶
func (d *VariableDeclaration) DeclarationIdentifier() *Identifier
func (*VariableDeclaration) DeclarationKind ¶
func (d *VariableDeclaration) DeclarationKind() common.DeclarationKind
func (*VariableDeclaration) DeclarationMembers ¶ added in v0.13.0
func (d *VariableDeclaration) DeclarationMembers() *Members
func (*VariableDeclaration) 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 ¶
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 Visitor ¶
type Visitor interface {
StatementVisitor
ExpressionVisitor
DeclarationVisitor
VisitProgram(*Program) Repr
VisitBlock(*Block) Repr
VisitFunctionBlock(*FunctionBlock) Repr
}
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) Accept ¶
func (s *WhileStatement) Accept(visitor Visitor) Repr
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))
Source Files
¶
- access.go
- access_string.go
- argument.go
- ast.go
- block.go
- composite.go
- conditionkind.go
- conditionkind_string.go
- declaration.go
- elementtype.go
- elementtype_string.go
- expression.go
- expression_as_type.go
- expression_extractor.go
- function_declaration.go
- identifier.go
- import.go
- inspect.go
- inspector.go
- interface.go
- memberindices.go
- members.go
- operation.go
- operation_string.go
- parameter.go
- parameterlist.go
- position.go
- pragma.go
- precedence.go
- precedence_string.go
- prettier.go
- program.go
- programindices.go
- statement.go
- string.go
- transaction_declaration.go
- transfer.go
- transferoperation.go
- transferoperation_string.go
- type.go
- variable_declaration.go
- variablekind.go
- variablekind_string.go
- visitor.go
- walk.go