Documentation ¶
Overview ¶
Package ast provides an Abstract Syntax Tree (AST) representation for Solidity contracts. The ast package offers a set of data structures and functions to parse Solidity source code and construct an AST that represents the structure and semantics of the contracts.
The package supports the creation of nodes for various Solidity constructs such as contracts, functions, modifiers, variables, statements, expressions, events, errors, enums, structs, and more. It also includes utilities for traversing and inspecting the AST, as well as generating code from the AST.
By utilizing the ast package, developers can programmatically analyze, manipulate, and generate Solidity code. It serves as a foundation for building tools, analyzers, compilers, and other applications that require deep understanding and processing of Solidity contracts.
Note: The ast package is designed to be used in conjunction with a Solidity parser, provided by ANTLR, to generate the initial AST from Solidity source code. It then enriches the AST with additional information and functionality specific to the Solidity language.
Package ast defines data structures and methods for abstract syntax tree nodes used in a specific programming language. The package contains definitions for various AST nodes that represent different elements of the programming language's syntax.
Index ¶
- func NewTypedStruct(m protoreflect.ProtoMessage, protoType string) *v3.TypedStruct
- func ToNode[T any](node Node[NodeType]) (T, bool)
- type ASTBuilder
- func (b *ASTBuilder) EnterConstantVariableDeclaration(ctx *parser.ConstantVariableDeclarationContext)
- func (b *ASTBuilder) EnterEnumDefinition(ctx *parser.EnumDefinitionContext)
- func (b *ASTBuilder) EnterErrorDefinition(ctx *parser.ErrorDefinitionContext)
- func (b *ASTBuilder) EnterEventDefinition(ctx *parser.EventDefinitionContext)
- func (b *ASTBuilder) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (b *ASTBuilder) EnterSourceUnit(ctx *parser.SourceUnitContext)
- func (b *ASTBuilder) EnterStateVariableDeclaration(ctx *parser.StateVariableDeclarationContext)
- func (b *ASTBuilder) EnterStructDefinition(ctx *parser.StructDefinitionContext)
- func (b *ASTBuilder) EnterUserDefinedValueTypeDefinition(ctx *parser.UserDefinedValueTypeDefinitionContext)
- func (b *ASTBuilder) EnterVariableDeclaration(ctx *parser.VariableDeclarationContext)
- func (b *ASTBuilder) ExitSourceUnit(ctx *parser.SourceUnitContext)
- func (b *ASTBuilder) GarbageCollect()
- func (b *ASTBuilder) GetImports() []Node[NodeType]
- func (b *ASTBuilder) GetNextID() int64
- func (b *ASTBuilder) GetParser() *parser.SolidityParser
- func (b *ASTBuilder) GetResolver() *Resolver
- func (b *ASTBuilder) GetRoot() *RootNode
- func (b *ASTBuilder) GetTree() *Tree
- func (b *ASTBuilder) ImportFromJSON(ctx context.Context, jsonBytes []byte) (*RootNode, error)
- func (b *ASTBuilder) InterfaceToJSON(data interface{}) ([]byte, error)
- func (b *ASTBuilder) ResolveReferences() []error
- func (b *ASTBuilder) ToJSON() ([]byte, error)
- func (b *ASTBuilder) ToProto() *ast_pb.RootSourceUnit
- type AndOperation
- func (f *AndOperation) GetExpressions() []Node[NodeType]
- func (f *AndOperation) GetId() int64
- func (f *AndOperation) GetNodes() []Node[NodeType]
- func (f *AndOperation) GetSrc() SrcNode
- func (f *AndOperation) GetType() ast_pb.NodeType
- func (f *AndOperation) GetTypeDescription() *TypeDescription
- func (f *AndOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *AndOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *AndOperation) ToProto() NodeType
- func (f *AndOperation) UnmarshalJSON(data []byte) error
- type Assignment
- func (a *Assignment) GetExpression() Node[NodeType]
- func (a *Assignment) GetId() int64
- func (a *Assignment) GetLeftExpression() Node[NodeType]
- func (a *Assignment) GetNodes() []Node[NodeType]
- func (a *Assignment) GetOperator() ast_pb.Operator
- func (a *Assignment) GetReferencedDeclaration() int64
- func (a *Assignment) GetRightExpression() Node[NodeType]
- func (a *Assignment) GetSrc() SrcNode
- func (a *Assignment) GetType() ast_pb.NodeType
- func (a *Assignment) GetTypeDescription() *TypeDescription
- func (a *Assignment) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *Assignment) ParseStatement(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (a *Assignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (a *Assignment) ToProto() NodeType
- func (a *Assignment) ToString() string
- func (a *Assignment) UnmarshalJSON(data []byte) error
- type BaseContract
- type BaseContractName
- func (b *BaseContractName) GetContractReferencedDeclaration() int64
- func (b *BaseContractName) GetId() int64
- func (b *BaseContractName) GetName() string
- func (b *BaseContractName) GetReferencedDeclaration() int64
- func (b *BaseContractName) GetSrc() SrcNode
- func (b *BaseContractName) GetType() ast_pb.NodeType
- func (b *BaseContractName) ToProto() *ast_pb.BaseContractName
- type BinaryOperation
- func (a *BinaryOperation) GetId() int64
- func (a *BinaryOperation) GetLeftExpression() Node[NodeType]
- func (a *BinaryOperation) GetNodes() []Node[NodeType]
- func (a *BinaryOperation) GetOperator() ast_pb.Operator
- func (a *BinaryOperation) GetRightExpression() Node[NodeType]
- func (a *BinaryOperation) GetSrc() SrcNode
- func (a *BinaryOperation) GetType() ast_pb.NodeType
- func (a *BinaryOperation) GetTypeDescription() *TypeDescription
- func (a *BinaryOperation) IsConstant() bool
- func (a *BinaryOperation) IsPure() bool
- func (a *BinaryOperation) ParseAddSub(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *BinaryOperation) ParseEqualityComparison(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *BinaryOperation) ParseMulDivMod(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *BinaryOperation) ParseOr(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *BinaryOperation) ParseOrderComparison(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *BinaryOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (a *BinaryOperation) ToProto() NodeType
- func (a *BinaryOperation) UnmarshalJSON(data []byte) error
- type BitAndOperation
- func (f *BitAndOperation) GetExpressions() []Node[NodeType]
- func (f *BitAndOperation) GetId() int64
- func (f *BitAndOperation) GetNodes() []Node[NodeType]
- func (f *BitAndOperation) GetSrc() SrcNode
- func (f *BitAndOperation) GetType() ast_pb.NodeType
- func (f *BitAndOperation) GetTypeDescription() *TypeDescription
- func (f *BitAndOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BitAndOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *BitAndOperation) ToProto() NodeType
- func (b *BitAndOperation) UnmarshalJSON(data []byte) error
- type BitOrOperation
- func (f *BitOrOperation) GetExpressions() []Node[NodeType]
- func (f *BitOrOperation) GetId() int64
- func (f *BitOrOperation) GetNodes() []Node[NodeType]
- func (f *BitOrOperation) GetSrc() SrcNode
- func (f *BitOrOperation) GetType() ast_pb.NodeType
- func (f *BitOrOperation) GetTypeDescription() *TypeDescription
- func (f *BitOrOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BitOrOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *BitOrOperation) ToProto() NodeType
- func (b *BitOrOperation) UnmarshalJSON(data []byte) error
- type BitXorOperation
- func (f *BitXorOperation) GetExpressions() []Node[NodeType]
- func (f *BitXorOperation) GetId() int64
- func (f *BitXorOperation) GetNodes() []Node[NodeType]
- func (f *BitXorOperation) GetSrc() SrcNode
- func (f *BitXorOperation) GetType() ast_pb.NodeType
- func (f *BitXorOperation) GetTypeDescription() *TypeDescription
- func (f *BitXorOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *BitXorOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *BitXorOperation) ToProto() NodeType
- func (b *BitXorOperation) UnmarshalJSON(data []byte) error
- type BodyNode
- func (b *BodyNode) GetId() int64
- func (b *BodyNode) GetKind() ast_pb.NodeType
- func (b *BodyNode) GetNodes() []Node[NodeType]
- func (b *BodyNode) GetSrc() SrcNode
- func (b *BodyNode) GetStatements() []Node[NodeType]
- func (b *BodyNode) GetType() ast_pb.NodeType
- func (b *BodyNode) GetTypeDescription() *TypeDescription
- func (b *BodyNode) IsImplemented() bool
- func (b *BodyNode) ParseBlock(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BodyNode) ParseDefinitions(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BodyNode) ParseUncheckedBlock(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BodyNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (b *BodyNode) ToProto() NodeType
- func (b *BodyNode) ToString() string
- func (b *BodyNode) UnmarshalJSON(data []byte) error
- type BreakStatement
- func (b *BreakStatement) GetId() int64
- func (b *BreakStatement) GetNodes() []Node[NodeType]
- func (b *BreakStatement) GetSrc() SrcNode
- func (b *BreakStatement) GetType() ast_pb.NodeType
- func (b *BreakStatement) GetTypeDescription() *TypeDescription
- func (b *BreakStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *BreakStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (b *BreakStatement) ToProto() NodeType
- type CatchStatement
- func (t *CatchStatement) GetBody() *BodyNode
- func (t *CatchStatement) GetId() int64
- func (t *CatchStatement) GetKind() ast_pb.NodeType
- func (t *CatchStatement) GetName() string
- func (t *CatchStatement) GetNodes() []Node[NodeType]
- func (t *CatchStatement) GetParameters() *ParameterList
- func (t *CatchStatement) GetSrc() SrcNode
- func (t *CatchStatement) GetType() ast_pb.NodeType
- func (t *CatchStatement) GetTypeDescription() *TypeDescription
- func (t *CatchStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (t *CatchStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (t *CatchStatement) ToProto() NodeType
- func (t *CatchStatement) UnmarshalJSON(data []byte) error
- type Comment
- type Conditional
- func (f *Conditional) GetExpressions() []Node[NodeType]
- func (f *Conditional) GetId() int64
- func (f *Conditional) GetNodes() []Node[NodeType]
- func (f *Conditional) GetSrc() SrcNode
- func (f *Conditional) GetType() ast_pb.NodeType
- func (f *Conditional) GetTypeDescription() *TypeDescription
- func (f *Conditional) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *Conditional) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *Conditional) ToProto() NodeType
- func (f *Conditional) UnmarshalJSON(data []byte) error
- type Constructor
- func (c *Constructor) GetBody() *BodyNode
- func (c *Constructor) GetId() int64
- func (c *Constructor) GetKind() ast_pb.NodeType
- func (c *Constructor) GetModifiers() []*ModifierInvocation
- func (c *Constructor) GetNodes() []Node[NodeType]
- func (c *Constructor) GetParameters() *ParameterList
- func (c *Constructor) GetReturnParameters() *ParameterList
- func (c *Constructor) GetScope() int64
- func (c *Constructor) GetSrc() SrcNode
- func (c *Constructor) GetStateMutability() ast_pb.Mutability
- func (c *Constructor) GetType() ast_pb.NodeType
- func (c *Constructor) GetTypeDescription() *TypeDescription
- func (c *Constructor) GetVisibility() ast_pb.Visibility
- func (c *Constructor) IsImplemented() bool
- func (c *Constructor) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (c *Constructor) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (c *Constructor) ToProto() NodeType
- func (c *Constructor) UnmarshalJSON(data []byte) error
- type ContinueStatement
- func (b *ContinueStatement) GetId() int64
- func (b *ContinueStatement) GetNodes() []Node[NodeType]
- func (b *ContinueStatement) GetSrc() SrcNode
- func (b *ContinueStatement) GetType() ast_pb.NodeType
- func (b *ContinueStatement) GetTypeDescription() *TypeDescription
- func (b *ContinueStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *ContinueStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (b *ContinueStatement) ToProto() NodeType
- type Contract
- func (c *Contract) GetBaseContracts() []*BaseContract
- func (s *Contract) GetConstructor() *Constructor
- func (c *Contract) GetContractDependencies() []int64
- func (s *Contract) GetEnums() []*EnumDefinition
- func (s *Contract) GetErrors() []*ErrorDefinition
- func (s *Contract) GetEvents() []*EventDefinition
- func (s *Contract) GetFallback() *Fallback
- func (s *Contract) GetFunctions() []*Function
- func (c *Contract) GetId() int64
- func (c *Contract) GetKind() ast_pb.NodeType
- func (c *Contract) GetLinearizedBaseContracts() []int64
- func (c *Contract) GetName() string
- func (c *Contract) GetNameLocation() SrcNode
- func (c *Contract) GetNodes() []Node[NodeType]
- func (s *Contract) GetReceive() *Receive
- func (c *Contract) GetSrc() SrcNode
- func (s *Contract) GetStateVariables() []*StateVariableDeclaration
- func (s *Contract) GetStructs() []*StructDefinition
- func (c *Contract) GetType() ast_pb.NodeType
- func (c *Contract) GetTypeDescription() *TypeDescription
- func (c *Contract) IsAbstract() bool
- func (c *Contract) IsFullyImplemented() bool
- func (c *Contract) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.ContractDefinitionContext, ...)
- func (c *Contract) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (c *Contract) ToProto() NodeType
- func (s *Contract) UnmarshalJSON(data []byte) error
- type Declaration
- func (d *Declaration) GetId() int64
- func (d *Declaration) GetIsStateVariable() bool
- func (d *Declaration) GetName() string
- func (d *Declaration) GetNameLocation() SrcNode
- func (d *Declaration) GetNodes() []Node[NodeType]
- func (d *Declaration) GetScope() int64
- func (d *Declaration) GetSrc() SrcNode
- func (d *Declaration) GetStateMutability() ast_pb.Mutability
- func (d *Declaration) GetStorageLocation() ast_pb.StorageLocation
- func (d *Declaration) GetType() ast_pb.NodeType
- func (d *Declaration) GetTypeDescription() *TypeDescription
- func (d *Declaration) GetTypeName() *TypeName
- func (d *Declaration) GetVisibility() ast_pb.Visibility
- func (d *Declaration) ParseVariableDeclaration(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (v *Declaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (d *Declaration) ToProto() NodeType
- type DoWhileStatement
- func (d *DoWhileStatement) GetBody() *BodyNode
- func (d *DoWhileStatement) GetCondition() Node[NodeType]
- func (d *DoWhileStatement) GetId() int64
- func (d *DoWhileStatement) GetNodes() []Node[NodeType]
- func (d *DoWhileStatement) GetSrc() SrcNode
- func (d *DoWhileStatement) GetType() ast_pb.NodeType
- func (d *DoWhileStatement) GetTypeDescription() *TypeDescription
- func (d *DoWhileStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (d *DoWhileStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (d *DoWhileStatement) ToProto() NodeType
- func (d *DoWhileStatement) UnmarshalJSON(data []byte) error
- type Emit
- func (e *Emit) GetArguments() []Node[NodeType]
- func (e *Emit) GetExpression() Node[NodeType]
- func (e *Emit) GetId() int64
- func (e *Emit) GetNodes() []Node[NodeType]
- func (e *Emit) GetSrc() SrcNode
- func (e *Emit) GetType() ast_pb.NodeType
- func (e *Emit) GetTypeDescription() *TypeDescription
- func (e *Emit) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (e *Emit) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (e *Emit) ToProto() NodeType
- func (e *Emit) UnmarshalJSON(data []byte) error
- type EnumDefinition
- func (e *EnumDefinition) GetCanonicalName() string
- func (e *EnumDefinition) GetId() int64
- func (e *EnumDefinition) GetMembers() []*Parameter
- func (e *EnumDefinition) GetName() string
- func (e *EnumDefinition) GetNameLocation() SrcNode
- func (e *EnumDefinition) GetNodes() []Node[NodeType]
- func (e *EnumDefinition) GetSourceUnitName() string
- func (e *EnumDefinition) GetSrc() SrcNode
- func (e *EnumDefinition) GetType() ast_pb.NodeType
- func (e *EnumDefinition) GetTypeDescription() *TypeDescription
- func (e *EnumDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (e *EnumDefinition) ParseGlobal(ctx *parser.EnumDefinitionContext) Node[NodeType]
- func (e *EnumDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (e *EnumDefinition) ToProto() NodeType
- func (e *EnumDefinition) UnmarshalJSON(data []byte) error
- type ErrorDefinition
- func (e *ErrorDefinition) GetId() int64
- func (e *ErrorDefinition) GetName() string
- func (e *ErrorDefinition) GetNameLocation() SrcNode
- func (e *ErrorDefinition) GetNodes() []Node[NodeType]
- func (e *ErrorDefinition) GetParameters() *ParameterList
- func (e *ErrorDefinition) GetSourceUnitName() string
- func (e *ErrorDefinition) GetSrc() SrcNode
- func (e *ErrorDefinition) GetType() ast_pb.NodeType
- func (e *ErrorDefinition) GetTypeDescription() *TypeDescription
- func (e *ErrorDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (e *ErrorDefinition) ParseGlobal(ctx *parser.ErrorDefinitionContext) Node[NodeType]
- func (e *ErrorDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (e *ErrorDefinition) ToProto() NodeType
- type EventDefinition
- func (e *EventDefinition) GetId() int64
- func (e *EventDefinition) GetName() string
- func (e *EventDefinition) GetNodes() []Node[NodeType]
- func (e *EventDefinition) GetParameters() *ParameterList
- func (e *EventDefinition) GetSrc() SrcNode
- func (e *EventDefinition) GetType() ast_pb.NodeType
- func (e *EventDefinition) GetTypeDescription() *TypeDescription
- func (e *EventDefinition) IsAnonymous() bool
- func (e *EventDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (e *EventDefinition) ParseGlobal(ctx *parser.EventDefinitionContext) Node[NodeType]
- func (e *EventDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (e *EventDefinition) ToProto() NodeType
- type ExprOperation
- func (f *ExprOperation) GetId() int64
- func (f *ExprOperation) GetLeftExpression() Node[NodeType]
- func (f *ExprOperation) GetNodes() []Node[NodeType]
- func (f *ExprOperation) GetRightExpression() Node[NodeType]
- func (f *ExprOperation) GetSrc() SrcNode
- func (f *ExprOperation) GetType() ast_pb.NodeType
- func (f *ExprOperation) GetTypeDescription() *TypeDescription
- func (f *ExprOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *ExprOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *ExprOperation) ToProto() NodeType
- func (f *ExprOperation) UnmarshalJSON(data []byte) error
- type Expression
- type ExpressionContext
- func (f *ExpressionContext) GetId() int64
- func (f *ExpressionContext) GetNodes() []Node[NodeType]
- func (f *ExpressionContext) GetSrc() SrcNode
- func (f *ExpressionContext) GetType() ast_pb.NodeType
- func (f *ExpressionContext) GetTypeDescription() *TypeDescription
- func (f *ExpressionContext) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *ExpressionContext) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *ExpressionContext) ToProto() NodeType
- type Fallback
- func (f *Fallback) GetBody() *BodyNode
- func (f *Fallback) GetId() int64
- func (f *Fallback) GetKind() ast_pb.NodeType
- func (f *Fallback) GetModifiers() []*ModifierInvocation
- func (f *Fallback) GetNodes() []Node[NodeType]
- func (f *Fallback) GetOverrides() []*OverrideSpecifier
- func (f *Fallback) GetParameters() *ParameterList
- func (f *Fallback) GetReturnParameters() *ParameterList
- func (f *Fallback) GetSrc() SrcNode
- func (f *Fallback) GetStateMutability() ast_pb.Mutability
- func (f *Fallback) GetType() ast_pb.NodeType
- func (f *Fallback) GetTypeDescription() *TypeDescription
- func (f *Fallback) GetVisibility() ast_pb.Visibility
- func (f *Fallback) IsImplemented() bool
- func (f *Fallback) IsVirtual() bool
- func (f *Fallback) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *Fallback) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *Fallback) ToProto() NodeType
- type ForStatement
- func (f *ForStatement) GetBody() *BodyNode
- func (f *ForStatement) GetClosure() Node[NodeType]
- func (f *ForStatement) GetCondition() Node[NodeType]
- func (f *ForStatement) GetId() int64
- func (f *ForStatement) GetInitialiser() Node[NodeType]
- func (f *ForStatement) GetNodes() []Node[NodeType]
- func (f *ForStatement) GetSrc() SrcNode
- func (f *ForStatement) GetType() ast_pb.NodeType
- func (f *ForStatement) GetTypeDescription() *TypeDescription
- func (f *ForStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *ForStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *ForStatement) ToProto() NodeType
- func (f *ForStatement) UnmarshalJSON(data []byte) error
- type Function
- func (f *Function) ComputeSignature()
- func (f *Function) GetBody() *BodyNode
- func (f *Function) GetId() int64
- func (f *Function) GetKind() ast_pb.NodeType
- func (f *Function) GetModifiers() []*ModifierInvocation
- func (f *Function) GetName() string
- func (f *Function) GetNameLocation() SrcNode
- func (f *Function) GetNodes() []Node[NodeType]
- func (f *Function) GetOverrides() []*OverrideSpecifier
- func (f *Function) GetParameters() *ParameterList
- func (f *Function) GetReferencedDeclaration() int64
- func (f *Function) GetReturnParameters() *ParameterList
- func (f *Function) GetScope() int64
- func (f *Function) GetSignature() string
- func (f *Function) GetSignatureBytes() []byte
- func (f *Function) GetSignatureRaw() string
- func (f *Function) GetSrc() SrcNode
- func (f *Function) GetStateMutability() ast_pb.Mutability
- func (f *Function) GetType() ast_pb.NodeType
- func (f *Function) GetTypeDescription() *TypeDescription
- func (f *Function) GetVisibility() ast_pb.Visibility
- func (f *Function) IsImplemented() bool
- func (f *Function) IsVirtual() bool
- func (f *Function) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *Function) ParseTypeName(unit *SourceUnit[Node[ast_pb.SourceUnit]], parentNodeId int64, ...) Node[NodeType]
- func (f *Function) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *Function) ToProto() NodeType
- func (f *Function) ToString() string
- func (f *Function) UnmarshalJSON(data []byte) error
- type FunctionCall
- func (f *FunctionCall) GetArgumentTypes() []*TypeDescription
- func (f *FunctionCall) GetArguments() []Node[NodeType]
- func (f *FunctionCall) GetExpression() Node[NodeType]
- func (f *FunctionCall) GetId() int64
- func (f *FunctionCall) GetKind() ast_pb.NodeType
- func (f *FunctionCall) GetNodes() []Node[NodeType]
- func (f *FunctionCall) GetReferenceDeclaration() int64
- func (f *FunctionCall) GetSrc() SrcNode
- func (f *FunctionCall) GetType() ast_pb.NodeType
- func (f *FunctionCall) GetTypeDescription() *TypeDescription
- func (f *FunctionCall) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *FunctionCall) RebuildDescriptions()
- func (f *FunctionCall) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *FunctionCall) ToProto() NodeType
- func (f *FunctionCall) UnmarshalJSON(data []byte) error
- type FunctionCallOption
- func (f *FunctionCallOption) GetExpression() Node[NodeType]
- func (f *FunctionCallOption) GetId() int64
- func (f *FunctionCallOption) GetKind() ast_pb.NodeType
- func (f *FunctionCallOption) GetNodes() []Node[NodeType]
- func (f *FunctionCallOption) GetReferenceDeclaration() int64
- func (f *FunctionCallOption) GetSrc() SrcNode
- func (f *FunctionCallOption) GetType() ast_pb.NodeType
- func (f *FunctionCallOption) GetTypeDescription() *TypeDescription
- func (f *FunctionCallOption) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *FunctionCallOption) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *FunctionCallOption) ToProto() NodeType
- func (f *FunctionCallOption) UnmarshalJSON(data []byte) error
- type IfStatement
- func (i *IfStatement) GetBody() Node[NodeType]
- func (i *IfStatement) GetCondition() Node[NodeType]
- func (i *IfStatement) GetId() int64
- func (i *IfStatement) GetNodes() []Node[NodeType]
- func (i *IfStatement) GetSrc() SrcNode
- func (i *IfStatement) GetType() ast_pb.NodeType
- func (i *IfStatement) GetTypeDescription() *TypeDescription
- func (i *IfStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (i *IfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (i *IfStatement) ToProto() NodeType
- func (i *IfStatement) UnmarshalJSON(data []byte) error
- type Import
- func (i *Import) GetAbsolutePath() string
- func (i *Import) GetAs() string
- func (i *Import) GetFile() string
- func (i *Import) GetId() int64
- func (i *Import) GetName() string
- func (i *Import) GetNameLocation() *SrcNode
- func (i *Import) GetNodes() []Node[NodeType]
- func (i *Import) GetScope() int64
- func (i *Import) GetSourceUnit() int64
- func (i *Import) GetSrc() SrcNode
- func (i *Import) GetType() ast_pb.NodeType
- func (i *Import) GetTypeDescription() *TypeDescription
- func (i *Import) GetUnitAlias() string
- func (i *Import) GetUnitAliases() []string
- func (i *Import) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (i *Import) ToProto() NodeType
- type IndexAccess
- func (i *IndexAccess) GetBaseExpression() Node[NodeType]
- func (i *IndexAccess) GetId() int64
- func (i *IndexAccess) GetIndexExpression() Node[NodeType]
- func (i *IndexAccess) GetName() string
- func (i *IndexAccess) GetNodes() []Node[NodeType]
- func (i *IndexAccess) GetReferencedDeclaration() int64
- func (i *IndexAccess) GetSrc() SrcNode
- func (i *IndexAccess) GetType() ast_pb.NodeType
- func (i *IndexAccess) GetTypeDescription() *TypeDescription
- func (i *IndexAccess) GetTypeDescriptions() []*TypeDescription
- func (i *IndexAccess) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (i *IndexAccess) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (i *IndexAccess) ToProto() NodeType
- func (i *IndexAccess) UnmarshalJSON(data []byte) error
- type IndexRange
- func (f *IndexRange) GetId() int64
- func (f *IndexRange) GetLeftExpression() Node[NodeType]
- func (f *IndexRange) GetNodes() []Node[NodeType]
- func (f *IndexRange) GetRightExpression() Node[NodeType]
- func (f *IndexRange) GetSrc() SrcNode
- func (f *IndexRange) GetType() ast_pb.NodeType
- func (f *IndexRange) GetTypeDescription() *TypeDescription
- func (f *IndexRange) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *IndexRange) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *IndexRange) ToProto() NodeType
- func (f *IndexRange) UnmarshalJSON(data []byte) error
- type InlineArray
- func (f *InlineArray) GetExpressions() []Node[NodeType]
- func (f *InlineArray) GetId() int64
- func (f *InlineArray) GetNodes() []Node[NodeType]
- func (f *InlineArray) GetSrc() SrcNode
- func (f *InlineArray) GetType() ast_pb.NodeType
- func (f *InlineArray) GetTypeDescription() *TypeDescription
- func (f *InlineArray) GetTypeDescriptions() []*TypeDescription
- func (f *InlineArray) IsEmpty() bool
- func (f *InlineArray) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *InlineArray) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *InlineArray) ToProto() NodeType
- func (f *InlineArray) UnmarshalJSON(data []byte) error
- type Interface
- func (l *Interface) GetBaseContracts() []*BaseContract
- func (l *Interface) GetConstructor() *Constructor
- func (l *Interface) GetContractDependencies() []int64
- func (l *Interface) GetEnums() []*EnumDefinition
- func (l *Interface) GetErrors() []*ErrorDefinition
- func (l *Interface) GetEvents() []*EventDefinition
- func (l *Interface) GetFallback() *Fallback
- func (l *Interface) GetFunctions() []*Function
- func (l *Interface) GetId() int64
- func (l *Interface) GetKind() ast_pb.NodeType
- func (l *Interface) GetLinearizedBaseContracts() []int64
- func (l *Interface) GetName() string
- func (l *Interface) GetNameLocation() SrcNode
- func (l *Interface) GetNodes() []Node[NodeType]
- func (l *Interface) GetReceive() *Receive
- func (l *Interface) GetSrc() SrcNode
- func (l *Interface) GetStateVariables() []*StateVariableDeclaration
- func (l *Interface) GetStructs() []*StructDefinition
- func (l *Interface) GetType() ast_pb.NodeType
- func (l *Interface) GetTypeDescription() *TypeDescription
- func (l *Interface) IsAbstract() bool
- func (l *Interface) IsFullyImplemented() bool
- func (l *Interface) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.InterfaceDefinitionContext, ...)
- func (l *Interface) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (l *Interface) ToProto() NodeType
- func (l *Interface) UnmarshalJSON(data []byte) error
- type Library
- func (l *Library) GetBaseContracts() []*BaseContract
- func (l *Library) GetConstructor() *Constructor
- func (l *Library) GetContractDependencies() []int64
- func (l *Library) GetEnums() []*EnumDefinition
- func (l *Library) GetErrors() []*ErrorDefinition
- func (l *Library) GetEvents() []*EventDefinition
- func (l *Library) GetFallback() *Fallback
- func (l *Library) GetFunctions() []*Function
- func (l *Library) GetId() int64
- func (l *Library) GetKind() ast_pb.NodeType
- func (l *Library) GetLinearizedBaseContracts() []int64
- func (l *Library) GetName() string
- func (l *Library) GetNameLocation() SrcNode
- func (l *Library) GetNodes() []Node[NodeType]
- func (l *Library) GetReceive() *Receive
- func (l *Library) GetSrc() SrcNode
- func (l *Library) GetStateVariables() []*StateVariableDeclaration
- func (l *Library) GetStructs() []*StructDefinition
- func (l *Library) GetType() ast_pb.NodeType
- func (l *Library) GetTypeDescription() *TypeDescription
- func (l *Library) IsAbstract() bool
- func (l *Library) IsFullyImplemented() bool
- func (l *Library) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.LibraryDefinitionContext, ...)
- func (l *Library) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (l *Library) ToProto() NodeType
- func (l *Library) UnmarshalJSON(data []byte) error
- type LibraryName
- type MemberAccessExpression
- func (m *MemberAccessExpression) GetArgumentTypes() []*TypeDescription
- func (m *MemberAccessExpression) GetExpression() Node[NodeType]
- func (m *MemberAccessExpression) GetId() int64
- func (m *MemberAccessExpression) GetMemberLocation() SrcNode
- func (m *MemberAccessExpression) GetMemberName() string
- func (m *MemberAccessExpression) GetNodes() []Node[NodeType]
- func (m *MemberAccessExpression) GetReferencedDeclaration() int64
- func (m *MemberAccessExpression) GetSrc() SrcNode
- func (m *MemberAccessExpression) GetType() ast_pb.NodeType
- func (m *MemberAccessExpression) GetTypeDescription() *TypeDescription
- func (m *MemberAccessExpression) IsConstant() bool
- func (m *MemberAccessExpression) IsLValue() bool
- func (m *MemberAccessExpression) IsLValueRequested() bool
- func (m *MemberAccessExpression) IsPure() bool
- func (m *MemberAccessExpression) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (m *MemberAccessExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (m *MemberAccessExpression) ToProto() NodeType
- func (m *MemberAccessExpression) ToText() string
- func (m *MemberAccessExpression) UnmarshalJSON(data []byte) error
- type MetaType
- func (m *MetaType) GetId() int64
- func (m *MetaType) GetName() string
- func (m *MetaType) GetNodes() []Node[NodeType]
- func (m *MetaType) GetReferencedDeclaration() int64
- func (m *MetaType) GetSrc() SrcNode
- func (m *MetaType) GetType() ast_pb.NodeType
- func (m *MetaType) GetTypeDescription() *TypeDescription
- func (m *MetaType) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (m *MetaType) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (m *MetaType) ToProto() NodeType
- type ModifierDefinition
- func (m *ModifierDefinition) GetBody() *BodyNode
- func (m *ModifierDefinition) GetId() int64
- func (m *ModifierDefinition) GetName() string
- func (m *ModifierDefinition) GetNameLocation() SrcNode
- func (m *ModifierDefinition) GetNodes() []Node[NodeType]
- func (m *ModifierDefinition) GetParameters() *ParameterList
- func (m *ModifierDefinition) GetSrc() SrcNode
- func (m *ModifierDefinition) GetType() ast_pb.NodeType
- func (m *ModifierDefinition) GetTypeDescription() *TypeDescription
- func (m *ModifierDefinition) GetVisibility() ast_pb.Visibility
- func (m *ModifierDefinition) IsVirtual() bool
- func (m *ModifierDefinition) ParseDefinition(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (m *ModifierDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (m *ModifierDefinition) ToProto() NodeType
- func (m *ModifierDefinition) UnmarshalJSON(data []byte) error
- type ModifierInvocation
- func (m *ModifierInvocation) GetArgumentTypes() []*TypeDescription
- func (m *ModifierInvocation) GetArguments() []Node[NodeType]
- func (m *ModifierInvocation) GetId() int64
- func (m *ModifierInvocation) GetKind() ast_pb.NodeType
- func (m *ModifierInvocation) GetName() string
- func (m *ModifierInvocation) GetNodes() []Node[NodeType]
- func (m *ModifierInvocation) GetSrc() SrcNode
- func (m *ModifierInvocation) GetType() ast_pb.NodeType
- func (m *ModifierInvocation) GetTypeDescription() *TypeDescription
- func (m *ModifierInvocation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (m *ModifierInvocation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (m *ModifierInvocation) ToProto() NodeType
- func (m *ModifierInvocation) UnmarshalJSON(data []byte) error
- type ModifierName
- type NewExpr
- func (n *NewExpr) GetArgumentTypes() []*TypeDescription
- func (n *NewExpr) GetId() int64
- func (n *NewExpr) GetNodes() []Node[NodeType]
- func (n *NewExpr) GetReferencedDeclaration() int64
- func (n *NewExpr) GetSrc() SrcNode
- func (n *NewExpr) GetType() ast_pb.NodeType
- func (n *NewExpr) GetTypeDescription() *TypeDescription
- func (n *NewExpr) GetTypeName() *TypeName
- func (n *NewExpr) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (n *NewExpr) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (n *NewExpr) ToProto() NodeType
- type Node
- type NodeType
- type NodeVisitor
- type OverridePath
- func (m *OverridePath) GetId() int64
- func (m *OverridePath) GetName() string
- func (m *OverridePath) GetNodes() []Node[NodeType]
- func (m *OverridePath) GetReferencedDeclaration() int64
- func (m *OverridePath) GetSrc() SrcNode
- func (m *OverridePath) GetType() ast_pb.NodeType
- func (m *OverridePath) GetTypeDescription() *TypeDescription
- func (op *OverridePath) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (m *OverridePath) ToProto() *ast_pb.OverridePath
- type OverrideSpecifier
- func (o *OverrideSpecifier) GetId() int64
- func (o *OverrideSpecifier) GetNodes() []Node[NodeType]
- func (o *OverrideSpecifier) GetOverrides() []*OverridePath
- func (o *OverrideSpecifier) GetReferencedDeclaration() int64
- func (o *OverrideSpecifier) GetSrc() SrcNode
- func (o *OverrideSpecifier) GetType() ast_pb.NodeType
- func (o *OverrideSpecifier) GetTypeDescription() *TypeDescription
- func (o *OverrideSpecifier) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (o *OverrideSpecifier) SetReferenceDescriptor(refId int64, refType *TypeDescription) bool
- func (o *OverrideSpecifier) ToProto() NodeType
- type Parameter
- func (p *Parameter) GetId() int64
- func (p *Parameter) GetName() string
- func (p *Parameter) GetNameLocation() *SrcNode
- func (p *Parameter) GetNodes() []Node[NodeType]
- func (p *Parameter) GetScope() int64
- func (p *Parameter) GetSrc() SrcNode
- func (p *Parameter) GetStateMutability() ast_pb.Mutability
- func (p *Parameter) GetStorageLocation() ast_pb.StorageLocation
- func (p *Parameter) GetType() ast_pb.NodeType
- func (p *Parameter) GetTypeDescription() *TypeDescription
- func (p *Parameter) GetTypeName() *TypeName
- func (p *Parameter) GetVisibility() ast_pb.Visibility
- func (p *Parameter) IsConstant() bool
- func (p *Parameter) IsIndexed() bool
- func (p *Parameter) IsStateVariable() bool
- func (p *Parameter) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (p *Parameter) ParseErrorParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (p *Parameter) ParseEventParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (p *Parameter) ParseStructParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (p *Parameter) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *Parameter) ToProto() NodeType
- func (p *Parameter) UnmarshalJSON(data []byte) error
- type ParameterList
- func (p *ParameterList) GetId() int64
- func (p *ParameterList) GetNodes() []Node[NodeType]
- func (p *ParameterList) GetParameterTypes() []*TypeDescription
- func (p *ParameterList) GetParameters() []*Parameter
- func (p *ParameterList) GetSrc() SrcNode
- func (p *ParameterList) GetType() ast_pb.NodeType
- func (p *ParameterList) GetTypeDescription() *TypeDescription
- func (p *ParameterList) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fNode Node[NodeType], ...)
- func (p *ParameterList) ParseErrorParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ...)
- func (p *ParameterList) ParseEventParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ...)
- func (p *ParameterList) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *ParameterList) ToProto() *ast_pb.ParameterList
- func (p *ParameterList) UnmarshalJSON(data []byte) error
- type PathNode
- func (pn *PathNode) GetId() int64
- func (pn *PathNode) GetName() string
- func (pn *PathNode) GetNameLocation() *SrcNode
- func (pn *PathNode) GetNodes() []Node[NodeType]
- func (pn *PathNode) GetReferencedDeclaration() int64
- func (pn *PathNode) GetSrc() SrcNode
- func (pn *PathNode) GetType() ast_pb.NodeType
- func (pn *PathNode) GetTypeDescription() *TypeDescription
- func (pn *PathNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (pn *PathNode) ToProto() NodeType
- type PayableConversion
- func (p *PayableConversion) GetArgumentTypes() []*TypeDescription
- func (p *PayableConversion) GetArguments() []Node[NodeType]
- func (p *PayableConversion) GetId() int64
- func (p *PayableConversion) GetNodes() []Node[NodeType]
- func (p *PayableConversion) GetReferencedDeclaration() int64
- func (p *PayableConversion) GetSrc() SrcNode
- func (p *PayableConversion) GetType() ast_pb.NodeType
- func (p *PayableConversion) GetTypeDescription() *TypeDescription
- func (p *PayableConversion) IsPayable() bool
- func (p *PayableConversion) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (p *PayableConversion) RebuildDescriptions()
- func (p *PayableConversion) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *PayableConversion) ToProto() NodeType
- func (p *PayableConversion) UnmarshalJSON(data []byte) error
- type Pragma
- func (p *Pragma) GetId() int64
- func (p *Pragma) GetLiterals() []string
- func (p *Pragma) GetNodes() []Node[NodeType]
- func (p *Pragma) GetSrc() SrcNode
- func (p *Pragma) GetText() string
- func (p *Pragma) GetType() ast_pb.NodeType
- func (p *Pragma) GetTypeDescription() *TypeDescription
- func (p *Pragma) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *Pragma) ToProto() NodeType
- type PrimaryExpression
- func (p *PrimaryExpression) GetArgumentTypes() []*TypeDescription
- func (p *PrimaryExpression) GetHexValue() string
- func (p *PrimaryExpression) GetId() int64
- func (p *PrimaryExpression) GetKind() ast_pb.NodeType
- func (p *PrimaryExpression) GetName() string
- func (p *PrimaryExpression) GetNodes() []Node[NodeType]
- func (p *PrimaryExpression) GetOverloadedDeclarations() []int64
- func (p *PrimaryExpression) GetReferencedDeclaration() int64
- func (p *PrimaryExpression) GetSrc() SrcNode
- func (p *PrimaryExpression) GetType() ast_pb.NodeType
- func (p *PrimaryExpression) GetTypeDescription() *TypeDescription
- func (p *PrimaryExpression) GetTypeName() *TypeName
- func (p *PrimaryExpression) GetValue() string
- func (p *PrimaryExpression) IsPure() bool
- func (p *PrimaryExpression) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (p *PrimaryExpression) Rebuild()
- func (p *PrimaryExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *PrimaryExpression) ToProto() NodeType
- type Receive
- func (f *Receive) GetBody() *BodyNode
- func (f *Receive) GetId() int64
- func (f *Receive) GetKind() ast_pb.NodeType
- func (f *Receive) GetModifiers() []*ModifierInvocation
- func (f *Receive) GetNodes() []Node[NodeType]
- func (f *Receive) GetOverrides() []*OverrideSpecifier
- func (f *Receive) GetParameters() *ParameterList
- func (f *Receive) GetReturnParameters() *ParameterList
- func (f *Receive) GetSrc() SrcNode
- func (f *Receive) GetStateMutability() ast_pb.Mutability
- func (f *Receive) GetType() ast_pb.NodeType
- func (f *Receive) GetTypeDescription() *TypeDescription
- func (f *Receive) GetVisibility() ast_pb.Visibility
- func (f *Receive) IsImplemented() bool
- func (f *Receive) IsVirtual() bool
- func (f *Receive) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *Receive) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *Receive) ToProto() NodeType
- func (f *Receive) UnmarshalJSON(data []byte) error
- type Resolver
- type ReturnStatement
- func (r *ReturnStatement) GetExpression() Node[NodeType]
- func (r *ReturnStatement) GetFunctionReturnParameters() int64
- func (r *ReturnStatement) GetId() int64
- func (r *ReturnStatement) GetNodes() []Node[NodeType]
- func (r *ReturnStatement) GetSrc() SrcNode
- func (r *ReturnStatement) GetType() ast_pb.NodeType
- func (r *ReturnStatement) GetTypeDescription() *TypeDescription
- func (r *ReturnStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (r *ReturnStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (r *ReturnStatement) ToProto() NodeType
- func (r *ReturnStatement) UnmarshalJSON(data []byte) error
- type RevertStatement
- func (r *RevertStatement) GetArguments() []Node[NodeType]
- func (r *RevertStatement) GetExpression() Node[NodeType]
- func (r *RevertStatement) GetId() int64
- func (r *RevertStatement) GetNodes() []Node[NodeType]
- func (r *RevertStatement) GetSrc() SrcNode
- func (r *RevertStatement) GetType() ast_pb.NodeType
- func (r *RevertStatement) GetTypeDescription() *TypeDescription
- func (r *RevertStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (r *RevertStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (r *RevertStatement) ToProto() NodeType
- func (r *RevertStatement) UnmarshalJSON(data []byte) error
- type RootNode
- func (r *RootNode) GetComments() []*Comment
- func (r *RootNode) GetEntrySourceUnit() int64
- func (r *RootNode) GetGlobalNodes() []Node[NodeType]
- func (r *RootNode) GetId() int64
- func (r *RootNode) GetNodes() []Node[NodeType]
- func (r *RootNode) GetSourceUnitById(id int64) *SourceUnit[Node[ast_pb.SourceUnit]]
- func (r *RootNode) GetSourceUnitByName(name string) *SourceUnit[Node[ast_pb.SourceUnit]]
- func (r *RootNode) GetSourceUnitCount() int32
- func (r *RootNode) GetSourceUnits() []*SourceUnit[Node[ast_pb.SourceUnit]]
- func (r *RootNode) GetSrc() SrcNode
- func (r *RootNode) GetType() ast_pb.NodeType
- func (r *RootNode) GetTypeDescription() *TypeDescription
- func (r *RootNode) HasSourceUnits() bool
- func (r *RootNode) SetEntrySourceUnit(entrySourceUnit int64)
- func (r *RootNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (r *RootNode) ToProto() *ast_pb.RootSourceUnit
- func (r *RootNode) UnmarshalJSON(data []byte) error
- type ShiftOperation
- func (f *ShiftOperation) GetExpressions() []Node[NodeType]
- func (f *ShiftOperation) GetId() int64
- func (f *ShiftOperation) GetNodes() []Node[NodeType]
- func (f *ShiftOperation) GetSrc() SrcNode
- func (f *ShiftOperation) GetType() ast_pb.NodeType
- func (f *ShiftOperation) GetTypeDescription() *TypeDescription
- func (f *ShiftOperation) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (f *ShiftOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *ShiftOperation) ToProto() NodeType
- func (f *ShiftOperation) UnmarshalJSON(data []byte) error
- type SimpleStatement
- type SourceUnit
- func (s *SourceUnit[T]) GetAbsolutePath() string
- func (s *SourceUnit[T]) GetBaseContracts() []*BaseContract
- func (s *SourceUnit[T]) GetContract() Node[NodeType]
- func (s *SourceUnit[T]) GetExportedSymbols() []Symbol
- func (s *SourceUnit[T]) GetId() int64
- func (s *SourceUnit[T]) GetImports() []*Import
- func (s *SourceUnit[T]) GetKind() ast_pb.NodeType
- func (s *SourceUnit[T]) GetLicense() string
- func (s *SourceUnit[T]) GetName() string
- func (s *SourceUnit[T]) GetNodes() []Node[NodeType]
- func (s *SourceUnit[T]) GetPragmas() []*Pragma
- func (s *SourceUnit[T]) GetSrc() SrcNode
- func (s *SourceUnit[T]) GetType() ast_pb.NodeType
- func (s *SourceUnit[T]) GetTypeDescription() *TypeDescription
- func (s *SourceUnit[T]) SetAbsolutePathFromSources(sources *solgo.Sources)
- func (s *SourceUnit[T]) SetContract(contract Node[NodeType])
- func (s *SourceUnit[T]) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (s *SourceUnit[T]) ToProto() NodeType
- func (s *SourceUnit[T]) UnmarshalJSON(data []byte) error
- type SrcNode
- type StateVariableDeclaration
- func (v *StateVariableDeclaration) GetId() int64
- func (v *StateVariableDeclaration) GetInitialValue() Node[NodeType]
- func (v *StateVariableDeclaration) GetName() string
- func (v *StateVariableDeclaration) GetNodes() []Node[NodeType]
- func (v *StateVariableDeclaration) GetReferencedDeclaration() int64
- func (v *StateVariableDeclaration) GetScope() int64
- func (v *StateVariableDeclaration) GetSrc() SrcNode
- func (v *StateVariableDeclaration) GetStateMutability() ast_pb.Mutability
- func (v *StateVariableDeclaration) GetStorageLocation() ast_pb.StorageLocation
- func (v *StateVariableDeclaration) GetType() ast_pb.NodeType
- func (v *StateVariableDeclaration) GetTypeDescription() *TypeDescription
- func (v *StateVariableDeclaration) GetTypeName() *TypeName
- func (v *StateVariableDeclaration) GetVisibility() ast_pb.Visibility
- func (v *StateVariableDeclaration) IsConstant() bool
- func (v *StateVariableDeclaration) IsStateVariable() bool
- func (v *StateVariableDeclaration) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (v *StateVariableDeclaration) ParseGlobal(ctx *parser.StateVariableDeclarationContext)
- func (v *StateVariableDeclaration) ParseGlobalConstant(ctx *parser.ConstantVariableDeclarationContext)
- func (v *StateVariableDeclaration) ParseGlobalVariable(ctx *parser.VariableDeclarationContext)
- func (v *StateVariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (v *StateVariableDeclaration) ToProto() NodeType
- func (v *StateVariableDeclaration) UnmarshalJSON(data []byte) error
- type StructDefinition
- func (s *StructDefinition) GetCanonicalName() string
- func (s *StructDefinition) GetId() int64
- func (s *StructDefinition) GetMembers() []*Parameter
- func (s *StructDefinition) GetName() string
- func (s *StructDefinition) GetNameLocation() SrcNode
- func (s *StructDefinition) GetNodes() []Node[NodeType]
- func (s *StructDefinition) GetReferencedDeclaration() int64
- func (s *StructDefinition) GetSourceUnitName() string
- func (s *StructDefinition) GetSrc() SrcNode
- func (s *StructDefinition) GetStorageLocation() ast_pb.StorageLocation
- func (s *StructDefinition) GetType() ast_pb.NodeType
- func (s *StructDefinition) GetTypeDescription() *TypeDescription
- func (s *StructDefinition) GetVisibility() ast_pb.Visibility
- func (s *StructDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (s *StructDefinition) ParseGlobal(ctx *parser.StructDefinitionContext) Node[NodeType]
- func (s *StructDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (s *StructDefinition) ToProto() NodeType
- func (s *StructDefinition) UnmarshalJSON(data []byte) error
- type Symbol
- type Tree
- func (t *Tree) AppendGlobalNodes(nodes ...Node[NodeType])
- func (t *Tree) AppendRootNodes(roots ...*SourceUnit[Node[ast_pb.SourceUnit]])
- func (t *Tree) ExecuteCustomTypeVisit(nodes []Node[NodeType], nodeType ast_pb.NodeType, ...) (bool, error)
- func (t *Tree) ExecuteTypeVisit(nodeType ast_pb.NodeType, visitFunc func(node Node[NodeType]) (bool, error)) (bool, error)
- func (t *Tree) GetById(id int64) Node[NodeType]
- func (t *Tree) GetRoot() *RootNode
- func (t *Tree) SetRoot(root *RootNode)
- func (t *Tree) UpdateNodeReferenceById(nodeId int64, nodeRefId int64, typeRef *TypeDescription) bool
- func (t *Tree) Walk(visitor *NodeVisitor) error
- func (t *Tree) WalkNode(startNode Node[NodeType], visitor *NodeVisitor) error
- func (t *Tree) WalkNodes(startNodes []Node[NodeType], visitor *NodeVisitor) error
- type TryStatement
- func (t *TryStatement) GetBody() *BodyNode
- func (t *TryStatement) GetClauses() []Node[NodeType]
- func (t *TryStatement) GetExpression() Node[NodeType]
- func (t *TryStatement) GetId() int64
- func (t *TryStatement) GetKind() ast_pb.NodeType
- func (t *TryStatement) GetNodes() []Node[NodeType]
- func (t *TryStatement) GetReturnParameters() *ParameterList
- func (t *TryStatement) GetReturns() bool
- func (t *TryStatement) GetSrc() SrcNode
- func (t *TryStatement) GetType() ast_pb.NodeType
- func (t *TryStatement) GetTypeDescription() *TypeDescription
- func (t *TryStatement) IsImplemented() bool
- func (t *TryStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (t *TryStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (t *TryStatement) ToProto() NodeType
- func (t *TryStatement) UnmarshalJSON(data []byte) error
- type TupleExpression
- func (t *TupleExpression) GetComponents() []Node[NodeType]
- func (t *TupleExpression) GetId() int64
- func (t *TupleExpression) GetNodes() []Node[NodeType]
- func (t *TupleExpression) GetReferencedDeclaration() int64
- func (t *TupleExpression) GetSrc() SrcNode
- func (t *TupleExpression) GetType() ast_pb.NodeType
- func (t *TupleExpression) GetTypeDescription() *TypeDescription
- func (t *TupleExpression) IsConstant() bool
- func (t *TupleExpression) IsPure() bool
- func (t *TupleExpression) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (t *TupleExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (t *TupleExpression) ToProto() NodeType
- func (t *TupleExpression) UnmarshalJSON(data []byte) error
- type TypeDescription
- type TypeName
- func (t *TypeName) GetExpression() Node[NodeType]
- func (t *TypeName) GetId() int64
- func (t *TypeName) GetKeyNameLocation() *SrcNode
- func (t *TypeName) GetKeyType() *TypeName
- func (t *TypeName) GetName() string
- func (t *TypeName) GetNodes() []Node[NodeType]
- func (t *TypeName) GetPathNode() *PathNode
- func (t *TypeName) GetReferencedDeclaration() int64
- func (t *TypeName) GetSrc() SrcNode
- func (t *TypeName) GetStateMutability() ast_pb.Mutability
- func (t *TypeName) GetType() ast_pb.NodeType
- func (t *TypeName) GetTypeDescription() *TypeDescription
- func (t *TypeName) GetValueNameLocation() *SrcNode
- func (t *TypeName) GetValueType() *TypeName
- func (t *TypeName) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (t *TypeName) ParseElementaryType(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (t *TypeName) ParseMul(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ...)
- func (t *TypeName) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (t *TypeName) StorageSize() (int64, bool)
- func (t *TypeName) ToProto() NodeType
- func (t *TypeName) UnmarshalJSON(data []byte) error
- func (t *TypeName) WithBodyNode(b *BodyNode)
- func (t *TypeName) WithParameterList(p Node[*ast_pb.ParameterList])
- func (t *TypeName) WithParentNode(p Node[NodeType])
- type UnaryPrefix
- func (u *UnaryPrefix) GetExpression() Node[NodeType]
- func (u *UnaryPrefix) GetId() int64
- func (u *UnaryPrefix) GetKind() ast_pb.NodeType
- func (u *UnaryPrefix) GetNodes() []Node[NodeType]
- func (u *UnaryPrefix) GetOperator() ast_pb.Operator
- func (u *UnaryPrefix) GetPrefix() bool
- func (u *UnaryPrefix) GetReferencedDeclaration() int64
- func (u *UnaryPrefix) GetSrc() SrcNode
- func (u *UnaryPrefix) GetType() ast_pb.NodeType
- func (u *UnaryPrefix) GetTypeDescription() *TypeDescription
- func (u *UnaryPrefix) IsConstant() bool
- func (u *UnaryPrefix) IsLValue() bool
- func (u *UnaryPrefix) IsLValueRequested() bool
- func (u *UnaryPrefix) IsPure() bool
- func (u *UnaryPrefix) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (u *UnaryPrefix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (u *UnaryPrefix) ToProto() NodeType
- func (u *UnaryPrefix) UnmarshalJSON(data []byte) error
- type UnarySuffix
- func (u *UnarySuffix) GetExpression() Node[NodeType]
- func (u *UnarySuffix) GetId() int64
- func (u *UnarySuffix) GetKind() ast_pb.NodeType
- func (u *UnarySuffix) GetNodes() []Node[NodeType]
- func (u *UnarySuffix) GetOperator() ast_pb.Operator
- func (u *UnarySuffix) GetPrefix() bool
- func (u *UnarySuffix) GetReferencedDeclaration() int64
- func (u *UnarySuffix) GetSrc() SrcNode
- func (u *UnarySuffix) GetType() ast_pb.NodeType
- func (u *UnarySuffix) GetTypeDescription() *TypeDescription
- func (u *UnarySuffix) IsConstant() bool
- func (u *UnarySuffix) IsLValue() bool
- func (u *UnarySuffix) IsLValueRequested() bool
- func (u *UnarySuffix) IsPure() bool
- func (u *UnarySuffix) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (u *UnarySuffix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (u *UnarySuffix) ToProto() NodeType
- func (u *UnarySuffix) UnmarshalJSON(data []byte) error
- type UnprocessedNode
- type UserDefinedValueTypeDefinition
- func (b *UserDefinedValueTypeDefinition) GetId() int64
- func (b *UserDefinedValueTypeDefinition) GetIs() bool
- func (b *UserDefinedValueTypeDefinition) GetName() string
- func (b *UserDefinedValueTypeDefinition) GetNameLocation() SrcNode
- func (b *UserDefinedValueTypeDefinition) GetNodes() []Node[NodeType]
- func (b *UserDefinedValueTypeDefinition) GetReferencedDeclaration() int64
- func (b *UserDefinedValueTypeDefinition) GetSrc() SrcNode
- func (b *UserDefinedValueTypeDefinition) GetType() ast_pb.NodeType
- func (b *UserDefinedValueTypeDefinition) GetTypeDescription() *TypeDescription
- func (b *UserDefinedValueTypeDefinition) GetTypeLocation() SrcNode
- func (b *UserDefinedValueTypeDefinition) GetTypeName() *TypeName
- func (b *UserDefinedValueTypeDefinition) GetUserType() string
- func (b *UserDefinedValueTypeDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (b *UserDefinedValueTypeDefinition) ParseGlobal(ctx *parser.UserDefinedValueTypeDefinitionContext) Node[NodeType]
- func (b *UserDefinedValueTypeDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (b *UserDefinedValueTypeDefinition) ToProto() NodeType
- type UsingDirective
- func (u *UsingDirective) GetId() int64
- func (u *UsingDirective) GetLibraryName() *LibraryName
- func (u *UsingDirective) GetNodes() []Node[NodeType]
- func (u *UsingDirective) GetPathNode() *PathNode
- func (u *UsingDirective) GetReferencedDeclaration() int64
- func (u *UsingDirective) GetSrc() SrcNode
- func (u *UsingDirective) GetType() ast_pb.NodeType
- func (u *UsingDirective) GetTypeDescription() *TypeDescription
- func (u *UsingDirective) GetTypeName() *TypeName
- func (u *UsingDirective) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (u *UsingDirective) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (u *UsingDirective) ToProto() NodeType
- type VariableDeclaration
- func (v *VariableDeclaration) GetAssignments() []int64
- func (v *VariableDeclaration) GetDeclarations() []*Declaration
- func (v *VariableDeclaration) GetId() int64
- func (v *VariableDeclaration) GetInitialValue() Node[NodeType]
- func (v *VariableDeclaration) GetNodes() []Node[NodeType]
- func (v *VariableDeclaration) GetSrc() SrcNode
- func (v *VariableDeclaration) GetType() ast_pb.NodeType
- func (v *VariableDeclaration) GetTypeDescription() *TypeDescription
- func (v *VariableDeclaration) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...)
- func (v *VariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (v *VariableDeclaration) ToProto() NodeType
- func (v *VariableDeclaration) UnmarshalJSON(data []byte) error
- type WhileStatement
- func (w *WhileStatement) GetBody() *BodyNode
- func (w *WhileStatement) GetCondition() Node[NodeType]
- func (w *WhileStatement) GetId() int64
- func (w *WhileStatement) GetKind() ast_pb.NodeType
- func (w *WhileStatement) GetNodes() []Node[NodeType]
- func (w *WhileStatement) GetSrc() SrcNode
- func (w *WhileStatement) GetType() ast_pb.NodeType
- func (w *WhileStatement) GetTypeDescription() *TypeDescription
- func (w *WhileStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (w *WhileStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (w *WhileStatement) ToProto() NodeType
- func (w *WhileStatement) UnmarshalJSON(data []byte) error
- type Yul
- func (a *Yul) GetBody() *BodyNode
- func (a *Yul) GetId() int64
- func (a *Yul) GetNodes() []Node[NodeType]
- func (a *Yul) GetSrc() SrcNode
- func (a *Yul) GetType() ast_pb.NodeType
- func (a *Yul) GetTypeDescription() *TypeDescription
- func (a *Yul) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *Yul) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (a *Yul) ToProto() NodeType
- type YulAssignment
- func (y *YulAssignment) GetId() int64
- func (y *YulAssignment) GetNodes() []Node[NodeType]
- func (y *YulAssignment) GetSrc() SrcNode
- func (y *YulAssignment) GetType() ast_pb.NodeType
- func (y *YulAssignment) GetTypeDescription() *TypeDescription
- func (y *YulAssignment) GetValue() Node[NodeType]
- func (y *YulAssignment) GetVariableNames() []*YulIdentifier
- func (y *YulAssignment) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulAssignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulAssignment) ToProto() NodeType
- func (f *YulAssignment) UnmarshalJSON(data []byte) error
- type YulBlockStatement
- func (y *YulBlockStatement) GetId() int64
- func (y *YulBlockStatement) GetNodes() []Node[NodeType]
- func (y *YulBlockStatement) GetSrc() SrcNode
- func (y *YulBlockStatement) GetStatements() []Node[NodeType]
- func (y *YulBlockStatement) GetType() ast_pb.NodeType
- func (y *YulBlockStatement) GetTypeDescription() *TypeDescription
- func (y *YulBlockStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulBlockStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulBlockStatement) ToProto() NodeType
- func (f *YulBlockStatement) UnmarshalJSON(data []byte) error
- type YulBreakStatement
- func (y *YulBreakStatement) GetId() int64
- func (y *YulBreakStatement) GetNodes() []Node[NodeType]
- func (y *YulBreakStatement) GetSrc() SrcNode
- func (y *YulBreakStatement) GetType() ast_pb.NodeType
- func (y *YulBreakStatement) GetTypeDescription() *TypeDescription
- func (y *YulBreakStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulBreakStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulBreakStatement) ToProto() NodeType
- type YulContinueStatement
- func (y *YulContinueStatement) GetId() int64
- func (y *YulContinueStatement) GetNodes() []Node[NodeType]
- func (y *YulContinueStatement) GetSrc() SrcNode
- func (y *YulContinueStatement) GetType() ast_pb.NodeType
- func (y *YulContinueStatement) GetTypeDescription() *TypeDescription
- func (y *YulContinueStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulContinueStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulContinueStatement) ToProto() NodeType
- type YulExpressionStatement
- func (y *YulExpressionStatement) GetExpression() Node[NodeType]
- func (y *YulExpressionStatement) GetId() int64
- func (y *YulExpressionStatement) GetNodes() []Node[NodeType]
- func (y *YulExpressionStatement) GetSrc() SrcNode
- func (y *YulExpressionStatement) GetType() ast_pb.NodeType
- func (y *YulExpressionStatement) GetTypeDescription() *TypeDescription
- func (y *YulExpressionStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulExpressionStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulExpressionStatement) ToProto() NodeType
- func (f *YulExpressionStatement) UnmarshalJSON(data []byte) error
- type YulForStatement
- func (y *YulForStatement) GetBody() Node[NodeType]
- func (y *YulForStatement) GetCondition() Node[NodeType]
- func (y *YulForStatement) GetId() int64
- func (y *YulForStatement) GetNodes() []Node[NodeType]
- func (y *YulForStatement) GetPost() Node[NodeType]
- func (y *YulForStatement) GetPre() Node[NodeType]
- func (y *YulForStatement) GetSrc() SrcNode
- func (y *YulForStatement) GetType() ast_pb.NodeType
- func (y *YulForStatement) GetTypeDescription() *TypeDescription
- func (y *YulForStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulForStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulForStatement) ToProto() NodeType
- func (f *YulForStatement) UnmarshalJSON(data []byte) error
- type YulFunctionCallStatement
- func (y *YulFunctionCallStatement) GetArguments() []Node[NodeType]
- func (y *YulFunctionCallStatement) GetFunctionName() *YulIdentifier
- func (y *YulFunctionCallStatement) GetId() int64
- func (y *YulFunctionCallStatement) GetNodes() []Node[NodeType]
- func (y *YulFunctionCallStatement) GetSrc() SrcNode
- func (y *YulFunctionCallStatement) GetType() ast_pb.NodeType
- func (y *YulFunctionCallStatement) GetTypeDescription() *TypeDescription
- func (y *YulFunctionCallStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulFunctionCallStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulFunctionCallStatement) ToProto() NodeType
- func (y *YulFunctionCallStatement) UnmarshalJSON(data []byte) error
- type YulFunctionDefinition
- func (y *YulFunctionDefinition) GetArguments() []*YulIdentifier
- func (y *YulFunctionDefinition) GetBody() Node[NodeType]
- func (y *YulFunctionDefinition) GetId() int64
- func (y *YulFunctionDefinition) GetNodes() []Node[NodeType]
- func (y *YulFunctionDefinition) GetReturnParameters() []*YulIdentifier
- func (y *YulFunctionDefinition) GetSrc() SrcNode
- func (y *YulFunctionDefinition) GetType() ast_pb.NodeType
- func (y *YulFunctionDefinition) GetTypeDescription() *TypeDescription
- func (y *YulFunctionDefinition) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulFunctionDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulFunctionDefinition) ToProto() NodeType
- func (f *YulFunctionDefinition) UnmarshalJSON(data []byte) error
- type YulIdentifier
- func (y *YulIdentifier) GetId() int64
- func (y *YulIdentifier) GetName() string
- func (y *YulIdentifier) GetNodes() []Node[NodeType]
- func (y *YulIdentifier) GetSrc() SrcNode
- func (y *YulIdentifier) GetType() ast_pb.NodeType
- func (y *YulIdentifier) GetTypeDescription() *TypeDescription
- func (y *YulIdentifier) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulIdentifier) ToProto() NodeType
- type YulIfStatement
- func (y *YulIfStatement) GetBody() Node[NodeType]
- func (y *YulIfStatement) GetCondition() Node[NodeType]
- func (y *YulIfStatement) GetId() int64
- func (y *YulIfStatement) GetNodes() []Node[NodeType]
- func (y *YulIfStatement) GetSrc() SrcNode
- func (y *YulIfStatement) GetType() ast_pb.NodeType
- func (y *YulIfStatement) GetTypeDescription() *TypeDescription
- func (y *YulIfStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulIfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulIfStatement) ToProto() NodeType
- func (f *YulIfStatement) UnmarshalJSON(data []byte) error
- type YulLeaveStatement
- func (y *YulLeaveStatement) GetId() int64
- func (y *YulLeaveStatement) GetNodes() []Node[NodeType]
- func (y *YulLeaveStatement) GetSrc() SrcNode
- func (y *YulLeaveStatement) GetType() ast_pb.NodeType
- func (y *YulLeaveStatement) GetTypeDescription() *TypeDescription
- func (y *YulLeaveStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulLeaveStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulLeaveStatement) ToProto() NodeType
- type YulLiteralStatement
- func (y *YulLiteralStatement) GetHexValue() string
- func (y *YulLiteralStatement) GetId() int64
- func (y *YulLiteralStatement) GetKind() ast_pb.NodeType
- func (y *YulLiteralStatement) GetNodes() []Node[NodeType]
- func (y *YulLiteralStatement) GetSrc() SrcNode
- func (y *YulLiteralStatement) GetType() ast_pb.NodeType
- func (y *YulLiteralStatement) GetTypeDescription() *TypeDescription
- func (y *YulLiteralStatement) GetValue() string
- func (y *YulLiteralStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulLiteralStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulLiteralStatement) ToProto() NodeType
- type YulStatement
- func (y *YulStatement) GetId() int64
- func (y *YulStatement) GetNodes() []Node[NodeType]
- func (y *YulStatement) GetSrc() SrcNode
- func (y *YulStatement) GetStatements() []Node[NodeType]
- func (y *YulStatement) GetType() ast_pb.NodeType
- func (y *YulStatement) GetTypeDescription() *TypeDescription
- func (y *YulStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulStatement) ToProto() NodeType
- func (f *YulStatement) UnmarshalJSON(data []byte) error
- type YulSwitchCaseStatement
- func (y *YulSwitchCaseStatement) GetBody() Node[NodeType]
- func (y *YulSwitchCaseStatement) GetCase() Node[NodeType]
- func (y *YulSwitchCaseStatement) GetId() int64
- func (y *YulSwitchCaseStatement) GetNodes() []Node[NodeType]
- func (y *YulSwitchCaseStatement) GetSrc() SrcNode
- func (y *YulSwitchCaseStatement) GetType() ast_pb.NodeType
- func (y *YulSwitchCaseStatement) GetTypeDescription() *TypeDescription
- func (y *YulSwitchCaseStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulSwitchCaseStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulSwitchCaseStatement) ToProto() NodeType
- func (f *YulSwitchCaseStatement) UnmarshalJSON(data []byte) error
- type YulSwitchStatement
- func (y *YulSwitchStatement) GetCases() []Node[NodeType]
- func (y *YulSwitchStatement) GetId() int64
- func (y *YulSwitchStatement) GetNodes() []Node[NodeType]
- func (y *YulSwitchStatement) GetSrc() SrcNode
- func (y *YulSwitchStatement) GetType() ast_pb.NodeType
- func (y *YulSwitchStatement) GetTypeDescription() *TypeDescription
- func (y *YulSwitchStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulSwitchStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulSwitchStatement) ToProto() NodeType
- func (f *YulSwitchStatement) UnmarshalJSON(data []byte) error
- type YulVariable
- func (y *YulVariable) GetId() int64
- func (y *YulVariable) GetNodes() []Node[NodeType]
- func (y *YulVariable) GetSrc() SrcNode
- func (y *YulVariable) GetType() ast_pb.NodeType
- func (y *YulVariable) GetTypeDescription() *TypeDescription
- func (y *YulVariable) GetValue() Node[NodeType]
- func (y *YulVariable) GetVariables() []*YulIdentifier
- func (y *YulVariable) IsLet() bool
- func (y *YulVariable) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (y *YulVariable) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (y *YulVariable) ToProto() NodeType
- func (y *YulVariable) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTypedStruct ¶
func NewTypedStruct(m protoreflect.ProtoMessage, protoType string) *v3.TypedStruct
NewTypedStruct creates a new v3.TypedStruct instance based on the provided protoreflect.ProtoMessage and protoType. It marshals the given ProtoMessage into JSON, then unmarshals it into a structpb.Struct, and constructs a TypedStruct with the appropriate type URL and structpb.Value. It returns the created TypedStruct instance or nil in case of errors during marshaling or unmarshaling.
Types ¶
type ASTBuilder ¶
type ASTBuilder struct { *parser.BaseSolidityParserListener // contains filtered or unexported fields }
ASTBuilder is a structure that helps in building and manipulating an Abstract Syntax Tree (AST). It contains a reference to a Solidity parser, the source code of the Solidity files, and various nodes of the AST.
func NewAstBuilder ¶
func NewAstBuilder(parser *parser.SolidityParser, sources *solgo.Sources) *ASTBuilder
NewAstBuilder creates a new ASTBuilder with the provided Solidity parser and source code.
func (*ASTBuilder) EnterConstantVariableDeclaration ¶ added in v0.3.1
func (b *ASTBuilder) EnterConstantVariableDeclaration(ctx *parser.ConstantVariableDeclarationContext)
func (*ASTBuilder) EnterEnumDefinition ¶ added in v0.3.1
func (b *ASTBuilder) EnterEnumDefinition(ctx *parser.EnumDefinitionContext)
There can be global enums that are outside of the contract body, so we need to handle them here.
func (*ASTBuilder) EnterErrorDefinition ¶ added in v0.3.1
func (b *ASTBuilder) EnterErrorDefinition(ctx *parser.ErrorDefinitionContext)
There can be global enums that are outside of the contract body, so we need to handle them here.
func (*ASTBuilder) EnterEventDefinition ¶ added in v0.3.1
func (b *ASTBuilder) EnterEventDefinition(ctx *parser.EventDefinitionContext)
There can be global enums that are outside of the contract body, so we need to handle them here.
func (*ASTBuilder) EnterEveryRule ¶
func (b *ASTBuilder) EnterEveryRule(ctx antlr.ParserRuleContext)
EnterEveryRule is called when the parser enters any rule in the grammar. It is used to search for licenses and comments in the code. ANTLR parser, by default, has comments disabled to be parsed as tokens. Therefore, we manually search for them using the CommonTokenStream.
func (*ASTBuilder) EnterSourceUnit ¶
func (b *ASTBuilder) EnterSourceUnit(ctx *parser.SourceUnitContext)
EnterSourceUnit is called when the ASTBuilder enters a source unit context. It initializes a new root node and source units based on the context.
func (*ASTBuilder) EnterStateVariableDeclaration ¶ added in v0.3.1
func (b *ASTBuilder) EnterStateVariableDeclaration(ctx *parser.StateVariableDeclarationContext)
func (*ASTBuilder) EnterStructDefinition ¶ added in v0.3.1
func (b *ASTBuilder) EnterStructDefinition(ctx *parser.StructDefinitionContext)
func (*ASTBuilder) EnterUserDefinedValueTypeDefinition ¶ added in v0.3.1
func (b *ASTBuilder) EnterUserDefinedValueTypeDefinition(ctx *parser.UserDefinedValueTypeDefinitionContext)
func (*ASTBuilder) EnterVariableDeclaration ¶ added in v0.3.1
func (b *ASTBuilder) EnterVariableDeclaration(ctx *parser.VariableDeclarationContext)
func (*ASTBuilder) ExitSourceUnit ¶
func (b *ASTBuilder) ExitSourceUnit(ctx *parser.SourceUnitContext)
ExitSourceUnit is called when the ASTBuilder exits a source unit context. It appends the source units to the root node.
func (*ASTBuilder) GarbageCollect ¶
func (b *ASTBuilder) GarbageCollect()
GarbageCollect cleans up the ASTBuilder after resolving references.
func (*ASTBuilder) GetImports ¶ added in v0.3.5
func (b *ASTBuilder) GetImports() []Node[NodeType]
func (*ASTBuilder) GetNextID ¶
func (b *ASTBuilder) GetNextID() int64
GetNextID generates the next unique identifier for nodes in the abstract syntax tree (AST). It uses an atomic operation to ensure thread safety.
func (*ASTBuilder) GetParser ¶
func (b *ASTBuilder) GetParser() *parser.SolidityParser
GetParser returns the Solidity parser of the ASTBuilder.
func (*ASTBuilder) GetResolver ¶
func (b *ASTBuilder) GetResolver() *Resolver
GetResolver returns the Resolver of the ASTBuilder.
func (*ASTBuilder) GetRoot ¶
func (b *ASTBuilder) GetRoot() *RootNode
GetRoot returns the root node of the AST from the Tree of the ASTBuilder.
func (*ASTBuilder) GetTree ¶
func (b *ASTBuilder) GetTree() *Tree
GetTree returns the Tree of the ASTBuilder.
func (*ASTBuilder) ImportFromJSON ¶ added in v0.3.1
ImportFromJSON imports the AST from a JSON byte array. Note that parser content won't be imported. Only the results for future manipulation.
func (*ASTBuilder) InterfaceToJSON ¶
func (b *ASTBuilder) InterfaceToJSON(data interface{}) ([]byte, error)
InterfaceToJSON converts the provided data to a JSON byte array.
func (*ASTBuilder) ResolveReferences ¶
func (b *ASTBuilder) ResolveReferences() []error
ResolveReferences resolves the references in the AST using the Resolver of the ASTBuilder.
func (*ASTBuilder) ToJSON ¶
func (b *ASTBuilder) ToJSON() ([]byte, error)
ToJSON converts the root node of the AST to a JSON byte array.
func (*ASTBuilder) ToProto ¶
func (b *ASTBuilder) ToProto() *ast_pb.RootSourceUnit
type AndOperation ¶
type AndOperation struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` }
AndOperation represents an 'and' operation in an abstract syntax tree.
func NewAndOperationExpression ¶
func NewAndOperationExpression(b *ASTBuilder) *AndOperation
NewAndOperationExpression creates a new AndOperation instance.
func (*AndOperation) GetExpressions ¶
func (f *AndOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the AndOperation.
func (*AndOperation) GetId ¶
func (f *AndOperation) GetId() int64
GetId returns the ID of the AndOperation.
func (*AndOperation) GetNodes ¶
func (f *AndOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the AndOperation.
func (*AndOperation) GetSrc ¶
func (f *AndOperation) GetSrc() SrcNode
GetSrc returns the source information of the AndOperation.
func (*AndOperation) GetType ¶
func (f *AndOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the AndOperation.
func (*AndOperation) GetTypeDescription ¶
func (f *AndOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the AndOperation.
func (*AndOperation) Parse ¶
func (f *AndOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.AndOperationContext, ) Node[NodeType]
Parse parses the AndOperation node from the parsing context and associates it with other nodes.
func (*AndOperation) SetReferenceDescriptor ¶
func (b *AndOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the AndOperation node. This function always returns false for now.
func (*AndOperation) ToProto ¶
func (f *AndOperation) ToProto() NodeType
ToProto converts the AndOperation to its corresponding protocol buffer representation.
func (*AndOperation) UnmarshalJSON ¶ added in v0.3.1
func (f *AndOperation) UnmarshalJSON(data []byte) error
type Assignment ¶
type Assignment struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the Assignment node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. Expression Node[NodeType] `json:"expression,omitempty"` // Expression for the assignment (if used). Operator ast_pb.Operator `json:"operator,omitempty"` // Operator used in the assignment. LeftExpression Node[NodeType] `json:"leftExpression,omitempty"` // Left-hand side expression. RightExpression Node[NodeType] `json:"rightExpression,omitempty"` // Right-hand side expression. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration identifier (if used). TypeDescription *TypeDescription `json:"typeDescription,omitempty"` // Type description associated with the Assignment node. Text string `json:"text,omitempty"` // Text of the Assignment node. }
Assignment represents an assignment statement in the AST.
func NewAssignment ¶
func NewAssignment(b *ASTBuilder) *Assignment
NewAssignment creates a new Assignment node with a given ASTBuilder.
func (*Assignment) GetExpression ¶
func (a *Assignment) GetExpression() Node[NodeType]
GetExpression returns the expression of the Assignment node.
func (*Assignment) GetId ¶
func (a *Assignment) GetId() int64
GetId returns the ID of the Assignment node.
func (*Assignment) GetLeftExpression ¶
func (a *Assignment) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression of the Assignment node.
func (*Assignment) GetNodes ¶
func (a *Assignment) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the Assignment node.
func (*Assignment) GetOperator ¶
func (a *Assignment) GetOperator() ast_pb.Operator
GetOperator returns the operator of the Assignment node.
func (*Assignment) GetReferencedDeclaration ¶
func (a *Assignment) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the Assignment node.
func (*Assignment) GetRightExpression ¶
func (a *Assignment) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression of the Assignment node.
func (*Assignment) GetSrc ¶
func (a *Assignment) GetSrc() SrcNode
GetSrc returns the SrcNode of the Assignment node.
func (*Assignment) GetType ¶
func (a *Assignment) GetType() ast_pb.NodeType
GetType returns the NodeType of the Assignment node.
func (*Assignment) GetTypeDescription ¶
func (a *Assignment) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the Assignment node.
func (*Assignment) Parse ¶
func (a *Assignment) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.AssignmentContext, ) Node[NodeType]
Parse parses an assignment context into the Assignment node.
func (*Assignment) ParseStatement ¶
func (a *Assignment) ParseStatement( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, parentNode Node[NodeType], eCtx *parser.ExpressionStatementContext, parentNodeId int64, ctx *parser.AssignmentContext, )
ParseStatement parses an expression statement context into the Assignment node.
func (*Assignment) SetReferenceDescriptor ¶
func (a *Assignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Assignment node.
func (*Assignment) ToProto ¶
func (a *Assignment) ToProto() NodeType
ToProto returns a protobuf representation of the Assignment node.
func (*Assignment) ToString ¶ added in v0.3.2
func (a *Assignment) ToString() string
ToString returns the string representation of the Assignment node.
func (*Assignment) UnmarshalJSON ¶ added in v0.3.1
func (a *Assignment) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the Assignment node data from the JSON byte array.
type BaseContract ¶
type BaseContract struct { // Id is the unique identifier of the base contract. Id int64 `json:"id"` // NodeType is the type of the node. // For a BaseContract, this is always NodeType_BASE_CONTRACT. NodeType ast_pb.NodeType `json:"nodeType"` // Src contains source information about the node, such as its line and column numbers in the source file. Src SrcNode `json:"src"` // BaseName is the name of the base contract. BaseName *BaseContractName `json:"baseName"` }
BaseContract represents a base contract in a Solidity source file. A base contract is a contract that is inherited by another contract.
func (*BaseContract) GetBaseName ¶
func (b *BaseContract) GetBaseName() *BaseContractName
GetBaseName returns the name of the base contract.
func (*BaseContract) GetId ¶
func (b *BaseContract) GetId() int64
GetId returns the unique identifier of the base contract.
func (*BaseContract) GetSrc ¶
func (b *BaseContract) GetSrc() SrcNode
GetSrc returns source information about the node, such as its line and column numbers in the source file.
func (*BaseContract) GetType ¶
func (b *BaseContract) GetType() ast_pb.NodeType
GetType returns the type of the node. For a BaseContract, this is always NodeType_BASE_CONTRACT.
func (*BaseContract) ToProto ¶
func (b *BaseContract) ToProto() *ast_pb.BaseContract
ToProto returns the protobuf representation of the base contract.
type BaseContractName ¶
type BaseContractName struct { // Id is the unique identifier of the base contract name. Id int64 `json:"id"` // NodeType is the type of the node. // For a BaseContractName, this is always NodeType_BASE_CONTRACT_NAME. NodeType ast_pb.NodeType `json:"nodeType"` // Src contains source information about the node, such as its line and column numbers in the source file. Src SrcNode `json:"src"` // Name is the name of the base contract. Name string `json:"name"` // ReferencedDeclaration is the unique identifier of the source unit declaration that this name references. ReferencedDeclaration int64 `json:"referencedDeclaration"` // ContractReferencedDeclaration is the unique identifier of the source unit contract declaration that this name references. ContractReferencedDeclaration int64 `json:"contractReferencedDeclaration"` }
BaseContractName represents the name of a base contract in a Solidity source file.
func (*BaseContractName) GetContractReferencedDeclaration ¶ added in v0.3.2
func (b *BaseContractName) GetContractReferencedDeclaration() int64
GetContractReferencedDeclaration returns the unique identifier of the source unit contract declaration that this name references.
func (*BaseContractName) GetId ¶
func (b *BaseContractName) GetId() int64
GetId returns the unique identifier of the base contract name.
func (*BaseContractName) GetName ¶
func (b *BaseContractName) GetName() string
GetName returns the name of the base contract name.
func (*BaseContractName) GetReferencedDeclaration ¶
func (b *BaseContractName) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the unique identifier of the source unit contract declaration that this name references.
func (*BaseContractName) GetSrc ¶
func (b *BaseContractName) GetSrc() SrcNode
GetSrc returns source information about the node, such as its line and column numbers in the source file.
func (*BaseContractName) GetType ¶
func (b *BaseContractName) GetType() ast_pb.NodeType
GetType returns the type of the node. For a BaseContractName, this is always NodeType_BASE_CONTRACT_NAME.
func (*BaseContractName) ToProto ¶
func (b *BaseContractName) ToProto() *ast_pb.BaseContractName
ToProto returns the protobuf representation of the base contract name.
type BinaryOperation ¶
type BinaryOperation struct { *ASTBuilder // Embedding the ASTBuilder to provide common functionality across all AST nodes. // Id is the unique identifier of the binary operation. Id int64 `json:"id"` // IsConstant indicates whether the binary operation is a constant. Constant bool `json:"isConstant"` // IsPure indicates whether the binary operation is pure (i.e., it does not read or modify state). Pure bool `json:"isPure"` // NodeType is the type of the node. // For a BinaryOperation, this is always NodeType_BINARY_OPERATION. NodeType ast_pb.NodeType `json:"nodeType"` // Src contains source information about the node, such as its line and column numbers in the source file. Src SrcNode `json:"src"` // Operator is the operator of the binary operation. Operator ast_pb.Operator `json:"operator"` // LeftExpression is the left operand of the binary operation. LeftExpression Node[NodeType] `json:"leftExpression"` // RightExpression is the right operand of the binary operation. RightExpression Node[NodeType] `json:"rightExpression"` // TypeDescription is the type description of the binary operation. TypeDescription *TypeDescription `json:"typeDescription"` }
BinaryOperation represents a binary operation in a Solidity source file. A binary operation is an operation that operates on two operands like +, -, *, / etc.
func NewBinaryOperationExpression ¶
func NewBinaryOperationExpression(b *ASTBuilder) *BinaryOperation
NewBinaryOperationExpression is a constructor function that initializes a new BinaryOperation with a unique ID and the NodeType set to NodeType_BINARY_OPERATION.
func (*BinaryOperation) GetId ¶
func (a *BinaryOperation) GetId() int64
GetId is a getter method that returns the unique identifier of the binary operation.
func (*BinaryOperation) GetLeftExpression ¶
func (a *BinaryOperation) GetLeftExpression() Node[NodeType]
GetLeftExpression is a getter method that returns the left operand of the binary operation.
func (*BinaryOperation) GetNodes ¶
func (a *BinaryOperation) GetNodes() []Node[NodeType]
GetNodes is a getter method that returns a slice of the operands of the binary operation.
func (*BinaryOperation) GetOperator ¶
func (a *BinaryOperation) GetOperator() ast_pb.Operator
GetOperator is a getter method that returns the operator of the binary operation.
func (*BinaryOperation) GetRightExpression ¶
func (a *BinaryOperation) GetRightExpression() Node[NodeType]
GetRightExpression is a getter method that returns the right operand of the binary operation.
func (*BinaryOperation) GetSrc ¶
func (a *BinaryOperation) GetSrc() SrcNode
GetSrc is a getter method that returns the source information of the binary operation.
func (*BinaryOperation) GetType ¶
func (a *BinaryOperation) GetType() ast_pb.NodeType
GetType is a getter method that returns the node type of the binary operation.
func (*BinaryOperation) GetTypeDescription ¶
func (a *BinaryOperation) GetTypeDescription() *TypeDescription
GetTypeDescription is a getter method that returns the type description of the left operand of the binary operation.
func (*BinaryOperation) IsConstant ¶
func (a *BinaryOperation) IsConstant() bool
IsConstant is a getter method that returns whether the binary operation is a constant.
func (*BinaryOperation) IsPure ¶
func (a *BinaryOperation) IsPure() bool
IsPure is a getter method that returns whether the binary operation is pure.
func (*BinaryOperation) ParseAddSub ¶
func (a *BinaryOperation) ParseAddSub( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.AddSubOperationContext, ) Node[NodeType]
ParseAddSub is a method that parses addition and subtraction operations.
func (*BinaryOperation) ParseEqualityComparison ¶
func (a *BinaryOperation) ParseEqualityComparison( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.EqualityComparisonContext, ) Node[NodeType]
ParseEqualityComparison is a method that parses equality comparison operations.
func (*BinaryOperation) ParseMulDivMod ¶
func (a *BinaryOperation) ParseMulDivMod( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.MulDivModOperationContext, ) Node[NodeType]
ParseMulDivMod is a method that parses multiplication, division, and modulo operations.
func (*BinaryOperation) ParseOr ¶
func (a *BinaryOperation) ParseOr( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.OrOperationContext, ) Node[NodeType]
ParseOr is a method that parses or comparison operations.
func (*BinaryOperation) ParseOrderComparison ¶
func (a *BinaryOperation) ParseOrderComparison( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.OrderComparisonContext, ) Node[NodeType]
ParseOrderComparison is a method that parses order comparison operations.
func (*BinaryOperation) SetReferenceDescriptor ¶
func (a *BinaryOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BinaryOperation node.
func (*BinaryOperation) ToProto ¶
func (a *BinaryOperation) ToProto() NodeType
ToProto is a method that returns the protobuf representation of the binary operation.
func (*BinaryOperation) UnmarshalJSON ¶ added in v0.3.1
func (a *BinaryOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the BinaryOperation node data from the JSON byte array.
type BitAndOperation ¶ added in v0.3.1
type BitAndOperation struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` }
BitAndOperation represents an 'bit and' operation in an abstract syntax tree.
func NewBitAndOperationExpression ¶ added in v0.3.1
func NewBitAndOperationExpression(b *ASTBuilder) *BitAndOperation
NewBitAndOperationExpression creates a new BitAndOperation instance.
func (*BitAndOperation) GetExpressions ¶ added in v0.3.1
func (f *BitAndOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the BitAndOperation.
func (*BitAndOperation) GetId ¶ added in v0.3.1
func (f *BitAndOperation) GetId() int64
GetId returns the ID of the BitAndOperation.
func (*BitAndOperation) GetNodes ¶ added in v0.3.1
func (f *BitAndOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the BitAndOperation.
func (*BitAndOperation) GetSrc ¶ added in v0.3.1
func (f *BitAndOperation) GetSrc() SrcNode
GetSrc returns the source information of the BitAndOperation.
func (*BitAndOperation) GetType ¶ added in v0.3.1
func (f *BitAndOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the BitAndOperation.
func (*BitAndOperation) GetTypeDescription ¶ added in v0.3.1
func (f *BitAndOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the BitAndOperation.
func (*BitAndOperation) Parse ¶ added in v0.3.1
func (f *BitAndOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.BitAndOperationContext, ) Node[NodeType]
Parse parses the BitAndOperation node from the parsing context and associates it with other nodes.
func (*BitAndOperation) SetReferenceDescriptor ¶ added in v0.3.1
func (b *BitAndOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BitAndOperation node. This function always returns false for now.
func (*BitAndOperation) ToProto ¶ added in v0.3.1
func (f *BitAndOperation) ToProto() NodeType
ToProto converts the BitAndOperation to its corresponding protocol buffer representation.
func (*BitAndOperation) UnmarshalJSON ¶ added in v0.3.1
func (b *BitAndOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the BitAndOperation object from the serialized JSON.
type BitOrOperation ¶ added in v0.3.1
type BitOrOperation struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` }
BitOrOperation represents an 'bit and' operation in an abstract syntax tree.
func NewBitOrOperationExpression ¶ added in v0.3.1
func NewBitOrOperationExpression(b *ASTBuilder) *BitOrOperation
NewBitOrOperationExpression creates a new BitOrOperation instance.
func (*BitOrOperation) GetExpressions ¶ added in v0.3.1
func (f *BitOrOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the BitOrOperation.
func (*BitOrOperation) GetId ¶ added in v0.3.1
func (f *BitOrOperation) GetId() int64
GetId returns the ID of the BitOrOperation.
func (*BitOrOperation) GetNodes ¶ added in v0.3.1
func (f *BitOrOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the BitOrOperation.
func (*BitOrOperation) GetSrc ¶ added in v0.3.1
func (f *BitOrOperation) GetSrc() SrcNode
GetSrc returns the source information of the BitOrOperation.
func (*BitOrOperation) GetType ¶ added in v0.3.1
func (f *BitOrOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the BitOrOperation.
func (*BitOrOperation) GetTypeDescription ¶ added in v0.3.1
func (f *BitOrOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the BitOrOperation.
func (*BitOrOperation) Parse ¶ added in v0.3.1
func (f *BitOrOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.BitOrOperationContext, ) Node[NodeType]
Parse parses the BitOrOperation node from the parsing context and associates it with other nodes.
func (*BitOrOperation) SetReferenceDescriptor ¶ added in v0.3.1
func (b *BitOrOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BitOrOperation node. This function always returns false for now.
func (*BitOrOperation) ToProto ¶ added in v0.3.1
func (f *BitOrOperation) ToProto() NodeType
ToProto converts the BitOrOperation to its corresponding protocol buffer representation.
func (*BitOrOperation) UnmarshalJSON ¶ added in v0.3.1
func (b *BitOrOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the BitOrOperation object from the serialized JSON.
type BitXorOperation ¶ added in v0.3.1
type BitXorOperation struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` TypeDescription *TypeDescription `json:"typeDescription"` }
BitXorOperation represents an 'bit and' operation in an abstract syntax tree.
func NewBitXorOperationExpression ¶ added in v0.3.1
func NewBitXorOperationExpression(b *ASTBuilder) *BitXorOperation
NewBitXorOperationExpression creates a new BitXorOperation instance.
func (*BitXorOperation) GetExpressions ¶ added in v0.3.1
func (f *BitXorOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the BitXorOperation.
func (*BitXorOperation) GetId ¶ added in v0.3.1
func (f *BitXorOperation) GetId() int64
GetId returns the ID of the BitXorOperation.
func (*BitXorOperation) GetNodes ¶ added in v0.3.1
func (f *BitXorOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the BitXorOperation.
func (*BitXorOperation) GetSrc ¶ added in v0.3.1
func (f *BitXorOperation) GetSrc() SrcNode
GetSrc returns the source information of the BitXorOperation.
func (*BitXorOperation) GetType ¶ added in v0.3.1
func (f *BitXorOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the BitXorOperation.
func (*BitXorOperation) GetTypeDescription ¶ added in v0.3.1
func (f *BitXorOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the BitXorOperation.
func (*BitXorOperation) Parse ¶ added in v0.3.1
func (f *BitXorOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.BitXorOperationContext, ) Node[NodeType]
Parse parses the BitXorOperation node from the parsing context and associates it with other nodes.
func (*BitXorOperation) SetReferenceDescriptor ¶ added in v0.3.1
func (f *BitXorOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BitXorOperation node. This function always returns false for now.
func (*BitXorOperation) ToProto ¶ added in v0.3.1
func (f *BitXorOperation) ToProto() NodeType
ToProto converts the BitXorOperation to its corresponding protocol buffer representation.
func (*BitXorOperation) UnmarshalJSON ¶ added in v0.3.1
func (b *BitXorOperation) UnmarshalJSON(data []byte) error
MarshalJSON marshals the BitXorOperation node into a JSON byte slice.
type BodyNode ¶
type BodyNode struct { *ASTBuilder Id int64 `json:"id"` // Id is the unique identifier of the body node. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType is the type of the AST node. Kind ast_pb.NodeType `json:"kind"` // Kind is the kind of the AST node. Src SrcNode `json:"src"` // Src is the source code location. Implemented bool `json:"implemented"` // Implemented indicates whether the function is implemented. Statements []Node[NodeType] `json:"statements"` // Statements is the list of AST nodes in the body. TypedProto bool `json:"-"` // TypedProto indicates whether the node should use TypedStruct as proto descriptor. }
BodyNode represents a body node in the abstract syntax tree. It includes various attributes like id, node type, kind, source node, implemented status, and statements.
func NewBodyNode ¶
func NewBodyNode(b *ASTBuilder, tp bool) *BodyNode
NewBodyNode creates a new BodyNode with the provided ASTBuilder. It returns a pointer to the created BodyNode.
func (*BodyNode) GetStatements ¶
GetStatements returns the statements associated with the body node.
func (*BodyNode) GetTypeDescription ¶
func (b *BodyNode) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the body node. As BodyNode does not have a type description, it returns nil.
func (*BodyNode) IsImplemented ¶
IsImplemented returns the implemented status of the body node.
func (*BodyNode) ParseBlock ¶
func (b *BodyNode) ParseBlock( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], parentNode Node[NodeType], bodyCtx parser.IBlockContext, ) Node[NodeType]
ParseBlock is a method of the BodyNode struct. It parses a block context. It takes a source unit, a contract node, a function node, and a block context as arguments. It sets the source node of the BodyNode and checks if the function is implemented by checking if there are any children in the block context. It then iterates over all the statements in the block context and parses each one by calling the parseStatements helper function. It finally returns the BodyNode itself.
func (*BodyNode) ParseDefinitions ¶
func (b *BodyNode) ParseDefinitions( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ) Node[NodeType]
ParseDefinitions is a method of the BodyNode struct. It parses the definitions of a contract body element context. It takes a source unit, a contract node, and a contract body element context as arguments. It iterates over the children of the body context, and based on the type of each child, it creates a new node of the corresponding type and parses it. It then returns the newly created and parsed node. If the type of the child context is unknown, it panics and prints an error message. Panic is here so we are forced to implement missing functionality. After parsing all the children, it sets the source node of the BodyNode and returns the BodyNode itself.
func (*BodyNode) ParseUncheckedBlock ¶
func (b *BodyNode) ParseUncheckedBlock( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyCtx parser.IUncheckedBlockContext, ) Node[NodeType]
ParseUncheckedBlock is a method of the BodyNode struct. It parses an unchecked block context. It takes a source unit, a contract node, a function node, and an unchecked block context as arguments. It sets the node type of the BodyNode to UNCHECKED_BLOCK and sets its source node. It then iterates over all the statements in the block context and parses each one by calling the parseStatements helper function. It finally returns the BodyNode itself.
func (*BodyNode) SetReferenceDescriptor ¶
func (b *BodyNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BodyNode node.
func (*BodyNode) UnmarshalJSON ¶ added in v0.3.1
UnmarshalJSON is a method of the BodyNode struct that implements the json.Unmarshaler interface.
type BreakStatement ¶
type BreakStatement struct { *ASTBuilder // Embedding ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for the break statement. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node, which is 'BREAK' for a break statement. Src SrcNode `json:"src"` // Source information about the node, such as its line and column numbers in the source file. }
BreakStatement represents a 'break' statement in Solidity.
func NewBreakStatement ¶
func NewBreakStatement(b *ASTBuilder) *BreakStatement
NewBreakStatement creates a new BreakStatement instance.
func (*BreakStatement) GetId ¶
func (b *BreakStatement) GetId() int64
GetId returns the unique identifier of the break statement.
func (*BreakStatement) GetNodes ¶
func (b *BreakStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the break statement. As the break statement doesn't have any child nodes, it returns nil.
func (*BreakStatement) GetSrc ¶
func (b *BreakStatement) GetSrc() SrcNode
GetSrc returns the source information about the node, such as its line and column numbers in the source file.
func (*BreakStatement) GetType ¶
func (b *BreakStatement) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'BREAK' for a break statement.
func (*BreakStatement) GetTypeDescription ¶
func (b *BreakStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the break statement. As the break statement doesn't have a type description, it returns nil.
func (*BreakStatement) Parse ¶
func (b *BreakStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.BreakStatementContext, ) Node[NodeType]
Parse populates the BreakStatement fields using the provided parser context.
func (*BreakStatement) SetReferenceDescriptor ¶
func (b *BreakStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BreakStatement node.
func (*BreakStatement) ToProto ¶
func (b *BreakStatement) ToProto() NodeType
ToProto returns the protobuf representation of the break statement.
type CatchStatement ¶
type CatchStatement struct { // Embedding the ASTBuilder to provide common functionality *ASTBuilder // The unique identifier for the 'catch' clause Id int64 `json:"id"` // The name of the exception variable in the 'catch' clause, if any Name string `json:"name,omitempty"` // The type of the node, which is 'TRY_CATCH_CLAUSE' for a 'catch' clause NodeType ast_pb.NodeType `json:"nodeType"` // The kind of the node, which is 'CATCH' for a 'catch' clause Kind ast_pb.NodeType `json:"kind"` // The source information about the 'catch' clause, such as its line and column numbers in the source file Src SrcNode `json:"src"` // The body of the 'catch' clause, which is a block of statements Body *BodyNode `json:"body"` // The parameters of the 'catch' clause, if any Parameters *ParameterList `json:"parameters"` }
The CatchStatement struct represents a 'catch' clause in a 'try-catch' statement in Solidity.
func NewCatchClauseStatement ¶
func NewCatchClauseStatement(b *ASTBuilder) *CatchStatement
NewCatchClauseStatement creates a new CatchStatement instance.
func (*CatchStatement) GetBody ¶
func (t *CatchStatement) GetBody() *BodyNode
GetBody returns the body of the 'catch' clause.
func (*CatchStatement) GetId ¶
func (t *CatchStatement) GetId() int64
GetId returns the unique identifier of the 'catch' clause.
func (*CatchStatement) GetKind ¶
func (t *CatchStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the node, which is 'CATCH' for a 'catch' clause.
func (*CatchStatement) GetName ¶
func (t *CatchStatement) GetName() string
GetName returns the name of the exception variable in the 'catch' clause, if any.
func (*CatchStatement) GetNodes ¶
func (t *CatchStatement) GetNodes() []Node[NodeType]
GetNodes returns the statements in the body of the 'catch' clause.
func (*CatchStatement) GetParameters ¶
func (t *CatchStatement) GetParameters() *ParameterList
GetParameters returns the parameters of the 'catch' clause.
func (*CatchStatement) GetSrc ¶
func (t *CatchStatement) GetSrc() SrcNode
GetSrc returns the source information about the 'catch' clause.
func (*CatchStatement) GetType ¶
func (t *CatchStatement) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'TRY_CATCH_CLAUSE' for a 'catch' clause.
func (*CatchStatement) GetTypeDescription ¶
func (t *CatchStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the 'catch' clause, which is nil as 'catch' clauses do not have a type description.
func (*CatchStatement) Parse ¶
func (t *CatchStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, tryNode *TryStatement, ctx *parser.CatchClauseContext, ) Node[NodeType]
Parse parses a 'catch' clause from the provided parser.CatchClauseContext and returns the corresponding CatchStatement.
func (*CatchStatement) SetReferenceDescriptor ¶
func (t *CatchStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the CatchStatement node.
func (*CatchStatement) ToProto ¶
func (t *CatchStatement) ToProto() NodeType
ToProto returns the protobuf representation of the 'catch' clause.
func (*CatchStatement) UnmarshalJSON ¶ added in v0.3.1
func (t *CatchStatement) UnmarshalJSON(data []byte) error
MarshalJSON marshals the CatchStatement node into a JSON byte slice.
type Comment ¶
type Comment struct { Id int64 `json:"id"` Src SrcNode `json:"src"` NodeType ast_pb.NodeType `json:"nodeType"` Text string `json:"text"` }
Comment represents a comment in an abstract syntax tree.
type Conditional ¶
type Conditional struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` TypeDescription *TypeDescription `json:"typeDescription"` }
Conditional represents a conditional expression in an abstract syntax tree.
func NewConditionalExpression ¶
func NewConditionalExpression(b *ASTBuilder) *Conditional
NewConditionalExpression creates a new Conditional instance.
func (*Conditional) GetExpressions ¶
func (f *Conditional) GetExpressions() []Node[NodeType]
GetExpressions returns the right expressions within the Conditional.
func (*Conditional) GetId ¶
func (f *Conditional) GetId() int64
GetId returns the ID of the Conditional.
func (*Conditional) GetNodes ¶
func (f *Conditional) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the Conditional.
func (*Conditional) GetSrc ¶
func (f *Conditional) GetSrc() SrcNode
GetSrc returns the source information of the Conditional.
func (*Conditional) GetType ¶
func (f *Conditional) GetType() ast_pb.NodeType
GetType returns the NodeType of the Conditional.
func (*Conditional) GetTypeDescription ¶
func (f *Conditional) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Conditional. TODO: Perhaps attaching at the end type descriptions to the conditional?
func (*Conditional) Parse ¶
func (f *Conditional) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.ConditionalContext, ) Node[NodeType]
Parse parses the Conditional node from the parsing context and associates it with other nodes.
func (*Conditional) SetReferenceDescriptor ¶
func (b *Conditional) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Conditional node. This function always returns false for now.
func (*Conditional) ToProto ¶
func (f *Conditional) ToProto() NodeType
ToProto converts the Conditional to its corresponding protocol buffer representation.
func (*Conditional) UnmarshalJSON ¶ added in v0.3.1
func (f *Conditional) UnmarshalJSON(data []byte) error
MarshalJSON marshals the Conditional node into a JSON byte slice.
type Constructor ¶
type Constructor struct { // Embedding the ASTBuilder to provide common functionality *ASTBuilder // The unique identifier for the constructor Id int64 `json:"id"` // The type of the node, which is 'FUNCTION_DEFINITION' for a constructor NodeType ast_pb.NodeType `json:"nodeType"` // The source information about the constructor, such as its line and column numbers in the source file Src SrcNode `json:"src"` // The kind of the node, which is 'CONSTRUCTOR' for a constructor Kind ast_pb.NodeType `json:"kind"` // The state mutability of the constructor, which is 'NONPAYABLE' by default StateMutability ast_pb.Mutability `json:"stateMutability"` // The visibility of the constructor Visibility ast_pb.Visibility `json:"visibility"` // Whether the constructor is implemented or not Implemented bool `json:"implemented"` // The modifiers of the constructor Modifiers []*ModifierInvocation `json:"modifiers"` // The parameters of the constructor Parameters *ParameterList `json:"parameters"` // The return parameters of the constructor, which are always empty for a constructor ReturnParameters *ParameterList `json:"returnParameters"` // The scope of the constructor, which is the id of the contract that the constructor belongs to Scope int64 `json:"scope"` // The body of the constructor, which is a block of statements Body *BodyNode `json:"body"` }
The Constructor struct represents a constructor function in a Solidity contract.
func NewConstructor ¶
func NewConstructor(b *ASTBuilder) *Constructor
NewConstructor creates a new Constructor instance.
func (*Constructor) GetBody ¶
func (c *Constructor) GetBody() *BodyNode
GetBody returns the body of the constructor.
func (*Constructor) GetId ¶
func (c *Constructor) GetId() int64
GetId returns the unique identifier of the constructor.
func (*Constructor) GetKind ¶
func (c *Constructor) GetKind() ast_pb.NodeType
GetKind returns the kind of the node, which is 'CONSTRUCTOR' for a constructor.
func (*Constructor) GetModifiers ¶
func (c *Constructor) GetModifiers() []*ModifierInvocation
func (*Constructor) GetNodes ¶
func (c *Constructor) GetNodes() []Node[NodeType]
GetNodes returns the statements in the body of the constructor.
func (*Constructor) GetParameters ¶
func (c *Constructor) GetParameters() *ParameterList
GetParameters returns the parameters of the constructor.
func (*Constructor) GetReturnParameters ¶
func (c *Constructor) GetReturnParameters() *ParameterList
GetReturnParameters returns the return parameters of the constructor, which are always empty for a constructor.
func (*Constructor) GetScope ¶
func (c *Constructor) GetScope() int64
GetScope returns the scope of the constructor, which is the id of the contract that the constructor belongs to.
func (*Constructor) GetSrc ¶
func (c *Constructor) GetSrc() SrcNode
GetSrc returns the source information about the constructor.
func (*Constructor) GetStateMutability ¶
func (c *Constructor) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the constructor.
func (*Constructor) GetType ¶
func (c *Constructor) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'FUNCTION_DEFINITION' for a constructor.
func (*Constructor) GetTypeDescription ¶
func (c *Constructor) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the constructor, which is nil as constructors do not have a type description.
func (*Constructor) GetVisibility ¶
func (c *Constructor) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the constructor.
func (*Constructor) IsImplemented ¶
func (c *Constructor) IsImplemented() bool
IsImplemented returns whether the constructor is implemented or not.
func (*Constructor) Parse ¶
func (c *Constructor) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ctx *parser.ConstructorDefinitionContext, ) Node[NodeType]
Parse parses a constructor from the provided parser.ConstructorDefinitionContext and returns the corresponding Constructor.
func (*Constructor) SetReferenceDescriptor ¶
func (c *Constructor) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Constructor node.
func (*Constructor) ToProto ¶
func (c *Constructor) ToProto() NodeType
ToProto returns the protobuf representation of the constructor.
func (*Constructor) UnmarshalJSON ¶ added in v0.3.1
func (c *Constructor) UnmarshalJSON(data []byte) error
type ContinueStatement ¶
type ContinueStatement struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` }
ContinueStatement represents a 'continue' statement in the abstract syntax tree.
func NewContinueStatement ¶
func NewContinueStatement(b *ASTBuilder) *ContinueStatement
NewContinueStatement creates a new instance of ContinueStatement.
func (*ContinueStatement) GetId ¶
func (b *ContinueStatement) GetId() int64
GetId returns the ID of the ContinueStatement.
func (*ContinueStatement) GetNodes ¶
func (b *ContinueStatement) GetNodes() []Node[NodeType]
GetNodes returns an empty list of child nodes for the ContinueStatement.
func (*ContinueStatement) GetSrc ¶
func (b *ContinueStatement) GetSrc() SrcNode
GetSrc returns the source information of the ContinueStatement.
func (*ContinueStatement) GetType ¶
func (b *ContinueStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ContinueStatement.
func (*ContinueStatement) GetTypeDescription ¶
func (b *ContinueStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the ContinueStatement.
func (*ContinueStatement) Parse ¶
func (b *ContinueStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.ContinueStatementContext, ) Node[NodeType]
Parse parses the ContinueStatement node from the parsing context and associates it with other nodes.
func (*ContinueStatement) SetReferenceDescriptor ¶
func (b *ContinueStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ContinueStatement node. This function always returns false for now.
func (*ContinueStatement) ToProto ¶
func (b *ContinueStatement) ToProto() NodeType
ToProto converts the ContinueStatement to its corresponding protocol buffer representation.
type Contract ¶
type Contract struct { *ASTBuilder Id int64 `json:"id"` Name string `json:"name"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` NameLocation SrcNode `json:"nameLocation"` Abstract bool `json:"abstract"` Kind ast_pb.NodeType `json:"kind"` FullyImplemented bool `json:"fullyImplemented"` Nodes []Node[NodeType] `json:"nodes"` LinearizedBaseContracts []int64 `json:"linearizedBaseContracts"` BaseContracts []*BaseContract `json:"baseContracts"` ContractDependencies []int64 `json:"contractDependencies"` }
Contract represents a Solidity contract in the abstract syntax tree.
func NewContractDefinition ¶
func NewContractDefinition(b *ASTBuilder) *Contract
NewContractDefinition creates a new instance of Contract.
func (*Contract) GetBaseContracts ¶
func (c *Contract) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the Contract.
func (*Contract) GetConstructor ¶
func (s *Contract) GetConstructor() *Constructor
GetConstructor returns the constructor definition of the Contract.
func (*Contract) GetContractDependencies ¶
GetContractDependencies returns the contract dependencies of the Contract.
func (*Contract) GetEnums ¶
func (s *Contract) GetEnums() []*EnumDefinition
GetEnums returns the enum definitions defined in the Contract.
func (*Contract) GetErrors ¶
func (s *Contract) GetErrors() []*ErrorDefinition
GetErrors returns the error definitions defined in the Contract.
func (*Contract) GetEvents ¶
func (s *Contract) GetEvents() []*EventDefinition
GetEvents returns the event definitions defined in the Contract.
func (*Contract) GetFallback ¶
GetFallback returns the fallback definition of the Contract.
func (*Contract) GetFunctions ¶
GetFunctions returns the function definitions defined in the Contract.
func (*Contract) GetLinearizedBaseContracts ¶
GetLinearizedBaseContracts returns the linearized base contracts of the Contract.
func (*Contract) GetNameLocation ¶
GetNameLocation returns the source information of the name of the Contract.
func (*Contract) GetReceive ¶
GetReceive returns the receive definition of the Contract.
func (*Contract) GetStateVariables ¶
func (s *Contract) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns the state variables defined in the Contract.
func (*Contract) GetStructs ¶
func (s *Contract) GetStructs() []*StructDefinition
GetStructs returns the struct definitions defined in the Contract.
func (*Contract) GetTypeDescription ¶
func (c *Contract) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Contract.
func (*Contract) IsAbstract ¶
IsAbstract returns whether the Contract is abstract.
func (*Contract) IsFullyImplemented ¶
IsFullyImplemented returns whether the Contract is fully implemented.
func (*Contract) Parse ¶
func (c *Contract) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.ContractDefinitionContext, rootNode *RootNode, unit *SourceUnit[Node[ast_pb.SourceUnit]])
Parse parses the Contract node from the parsing context and associates it with other nodes.
func (*Contract) SetReferenceDescriptor ¶
func (c *Contract) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Contract node. This function always returns false for now.
func (*Contract) ToProto ¶
ToProto converts the Contract to its corresponding protocol buffer representation.
func (*Contract) UnmarshalJSON ¶ added in v0.3.1
UnmarshalJSON parses the JSON-encoded data and stores the result in the Contract.
type Declaration ¶
type Declaration struct { *ASTBuilder Id int64 `json:"id"` StateMutability ast_pb.Mutability `json:"stateMutability"` Name string `json:"name"` NodeType ast_pb.NodeType `json:"nodeType"` Scope int64 `json:"scope"` Src SrcNode `json:"src"` NameLocation SrcNode `json:"nameLocation"` IsStateVariable bool `json:"isStateVariable"` StorageLocation ast_pb.StorageLocation `json:"storageLocation"` TypeName *TypeName `json:"typeName"` Visibility ast_pb.Visibility `json:"visibility"` }
Declaration is a struct that contains information about a variable declaration in the AST.
func NewDeclaration ¶
func NewDeclaration(b *ASTBuilder) *Declaration
NewDeclaration creates a new Declaration instance.
func (*Declaration) GetId ¶
func (d *Declaration) GetId() int64
GetId returns the ID of the Declaration.
func (*Declaration) GetIsStateVariable ¶
func (d *Declaration) GetIsStateVariable() bool
GetIsStateVariable returns whether or not the Declaration is a state variable.
func (*Declaration) GetName ¶
func (d *Declaration) GetName() string
GetName returns the name of the Declaration.
func (*Declaration) GetNameLocation ¶
func (d *Declaration) GetNameLocation() SrcNode
GetNameLocation returns the name location of the Declaration.
func (*Declaration) GetNodes ¶
func (d *Declaration) GetNodes() []Node[NodeType]
GetNodes returns the nodes associated with the Declaration.
func (*Declaration) GetScope ¶
func (d *Declaration) GetScope() int64
GetScope returns the scope of the Declaration.
func (*Declaration) GetSrc ¶
func (d *Declaration) GetSrc() SrcNode
GetSrc returns the SrcNode of the Declaration.
func (*Declaration) GetStateMutability ¶
func (d *Declaration) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Declaration.
func (*Declaration) GetStorageLocation ¶
func (d *Declaration) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the Declaration.
func (*Declaration) GetType ¶
func (d *Declaration) GetType() ast_pb.NodeType
GetType returns the NodeType of the Declaration.
func (*Declaration) GetTypeDescription ¶
func (d *Declaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the Declaration.
func (*Declaration) GetTypeName ¶
func (d *Declaration) GetTypeName() *TypeName
GetTypeName returns the TypeName of the Declaration.
func (*Declaration) GetVisibility ¶
func (d *Declaration) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Declaration.
func (*Declaration) ParseVariableDeclaration ¶
func (d *Declaration) ParseVariableDeclaration( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, ctx parser.IVariableDeclarationContext, )
ParseVariableDeclaration parses a VariableDeclaration and stores the relevant information in the Declaration.
func (*Declaration) SetReferenceDescriptor ¶
func (v *Declaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the VariableDeclaration node.
func (*Declaration) ToProto ¶
func (d *Declaration) ToProto() NodeType
ToProto converts the Declaration to its corresponding protocol buffer representation.
type DoWhileStatement ¶
type DoWhileStatement struct { *ASTBuilder // Embedded ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for the DoWhileStatement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. Condition Node[NodeType] `json:"condition"` // Condition expression for the do-while loop. Body *BodyNode `json:"body"` // Body of the do-while loop. }
DoWhileStatement represents a do-while loop statement node in the abstract syntax tree (AST). It encapsulates information about the condition and body of the loop.
func NewDoWhileStatement ¶
func NewDoWhileStatement(b *ASTBuilder) *DoWhileStatement
NewDoWhileStatement creates a new DoWhileStatement node with default values and returns it.
func (*DoWhileStatement) GetBody ¶
func (d *DoWhileStatement) GetBody() *BodyNode
GetBody returns the body of the do-while loop.
func (*DoWhileStatement) GetCondition ¶
func (d *DoWhileStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression of the do-while loop.
func (*DoWhileStatement) GetId ¶
func (d *DoWhileStatement) GetId() int64
GetId returns the unique identifier of the DoWhileStatement node.
func (*DoWhileStatement) GetNodes ¶
func (d *DoWhileStatement) GetNodes() []Node[NodeType]
GetNodes returns a slice of child nodes within the do-while loop.
func (*DoWhileStatement) GetSrc ¶
func (d *DoWhileStatement) GetSrc() SrcNode
GetSrc returns the source location information of the DoWhileStatement node.
func (*DoWhileStatement) GetType ¶
func (d *DoWhileStatement) GetType() ast_pb.NodeType
GetType returns the type of the AST node, which is NodeType_DO_WHILE_STATEMENT for a do-while loop.
func (*DoWhileStatement) GetTypeDescription ¶
func (d *DoWhileStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the DoWhileStatement node.
func (*DoWhileStatement) Parse ¶
func (d *DoWhileStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.DoWhileStatementContext, ) Node[NodeType]
Parse is responsible for parsing the do-while loop statement from the context and populating the DoWhileStatement node.
func (*DoWhileStatement) SetReferenceDescriptor ¶
func (d *DoWhileStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the DoWhileStatement node. This function currently returns false, as no reference description updates are performed.
func (*DoWhileStatement) ToProto ¶
func (d *DoWhileStatement) ToProto() NodeType
ToProto converts the DoWhileStatement node to its corresponding protocol buffer representation.
func (*DoWhileStatement) UnmarshalJSON ¶ added in v0.3.1
func (d *DoWhileStatement) UnmarshalJSON(data []byte) error
MarshalJSON marshals the DoWhileStatement node into a JSON-encoded byte slice.
type Emit ¶
type Emit struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the emit statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. Arguments []Node[NodeType] `json:"arguments"` // List of arguments for the emit statement. Expression Node[NodeType] `json:"expression"` // Expression node associated with the emit statement. }
Emit represents an emit statement node in the abstract syntax tree.
func NewEmitStatement ¶
func NewEmitStatement(b *ASTBuilder) *Emit
NewEmitStatement creates a new instance of Emit with the provided ASTBuilder.
func (*Emit) GetArguments ¶
GetArguments returns the list of arguments associated with the emit statement.
func (*Emit) GetExpression ¶
GetExpression returns the expression node associated with the emit statement.
func (*Emit) GetNodes ¶
GetNodes returns a list of nodes associated with the emit statement (arguments and expression).
func (*Emit) GetTypeDescription ¶
func (e *Emit) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the emit statement.
func (*Emit) Parse ¶
func (e *Emit) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.EmitStatementContext, ) Node[NodeType]
Parse parses the emit statement context and populates the Emit fields.
func (*Emit) SetReferenceDescriptor ¶
func (e *Emit) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the Emit node.
func (*Emit) UnmarshalJSON ¶ added in v0.3.1
type EnumDefinition ¶
type EnumDefinition struct { *ASTBuilder // Embedding the ASTBuilder for common functionality SourceUnitName string `json:"-"` Id int64 `json:"id"` // Unique identifier for the enumeration definition NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (ENUM_DEFINITION for enumeration definition) Src SrcNode `json:"src"` // Source information about the enumeration definition NameLocation SrcNode `json:"nameLocation"` // Source information about the name of the enumeration Name string `json:"name"` // Name of the enumeration CanonicalName string `json:"canonicalName"` // Canonical name of the enumeration TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the enumeration Members []Node[NodeType] `json:"members"` // Members of the enumeration }
EnumDefinition represents an enumeration definition in the Solidity abstract syntax tree (AST).
func NewEnumDefinition ¶
func NewEnumDefinition(b *ASTBuilder) *EnumDefinition
NewEnumDefinition creates a new EnumDefinition instance.
func (*EnumDefinition) GetCanonicalName ¶
func (e *EnumDefinition) GetCanonicalName() string
GetCanonicalName returns the canonical name of the enumeration.
func (*EnumDefinition) GetId ¶
func (e *EnumDefinition) GetId() int64
GetId returns the unique identifier of the enumeration definition.
func (*EnumDefinition) GetMembers ¶
func (e *EnumDefinition) GetMembers() []*Parameter
GetMembers returns the members of the enumeration.
func (*EnumDefinition) GetName ¶
func (e *EnumDefinition) GetName() string
GetName returns the name of the enumeration.
func (*EnumDefinition) GetNameLocation ¶
func (e *EnumDefinition) GetNameLocation() SrcNode
GetNameLocation returns the source information about the name of the enumeration.
func (*EnumDefinition) GetNodes ¶
func (e *EnumDefinition) GetNodes() []Node[NodeType]
GetNodes returns the members of the enumeration.
func (*EnumDefinition) GetSourceUnitName ¶
func (e *EnumDefinition) GetSourceUnitName() string
GetSourceUnitName returns the name of the source unit containing the enumeration.
func (*EnumDefinition) GetSrc ¶
func (e *EnumDefinition) GetSrc() SrcNode
GetSrc returns the source information about the enumeration definition.
func (*EnumDefinition) GetType ¶
func (e *EnumDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'ENUM_DEFINITION' for an enumeration definition.
func (*EnumDefinition) GetTypeDescription ¶
func (e *EnumDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the enumeration.
func (*EnumDefinition) Parse ¶
func (e *EnumDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.EnumDefinitionContext, ) Node[NodeType]
Parse parses an enumeration definition from the provided parser.EnumDefinitionContext and updates the current instance.
func (*EnumDefinition) ParseGlobal ¶ added in v0.3.1
func (e *EnumDefinition) ParseGlobal( ctx *parser.EnumDefinitionContext, ) Node[NodeType]
ParseGlobal parses an global enumeration definition from the provided parser.EnumDefinitionContext and updates the current instance.
func (*EnumDefinition) SetReferenceDescriptor ¶
func (e *EnumDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the EnumDefinition node. We don't need to do any reference description updates here, at least for now...
func (*EnumDefinition) ToProto ¶
func (e *EnumDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the enumeration definition.
func (*EnumDefinition) UnmarshalJSON ¶ added in v0.3.1
func (e *EnumDefinition) UnmarshalJSON(data []byte) error
type ErrorDefinition ¶
type ErrorDefinition struct { *ASTBuilder SourceUnitName string `json:"-"` // Source unit name. Id int64 `json:"id"` // Unique identifier of the error definition node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. Name string `json:"name"` // Name of the error definition. NameLocation SrcNode `json:"nameLocation"` // Source location information of the name. Parameters *ParameterList `json:"parameters"` // List of error parameters. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the error definition. }
ErrorDefinition represents an error definition node in the abstract syntax tree.
func NewErrorDefinition ¶
func NewErrorDefinition(b *ASTBuilder) *ErrorDefinition
NewErrorDefinition creates a new instance of ErrorDefinition with the provided ASTBuilder.
func (*ErrorDefinition) GetId ¶
func (e *ErrorDefinition) GetId() int64
GetId returns the unique identifier of the error definition node.
func (*ErrorDefinition) GetName ¶
func (e *ErrorDefinition) GetName() string
GetName returns the name of the error definition.
func (*ErrorDefinition) GetNameLocation ¶
func (e *ErrorDefinition) GetNameLocation() SrcNode
GetNameLocation returns the source location information of the name of the error definition.
func (*ErrorDefinition) GetNodes ¶
func (e *ErrorDefinition) GetNodes() []Node[NodeType]
GetNodes returns an empty slice of nodes associated with the error definition.
func (*ErrorDefinition) GetParameters ¶
func (e *ErrorDefinition) GetParameters() *ParameterList
GetParameters returns the list of error parameters.
func (*ErrorDefinition) GetSourceUnitName ¶
func (e *ErrorDefinition) GetSourceUnitName() string
GetSourceUnitName returns the source unit name associated with the error definition.
func (*ErrorDefinition) GetSrc ¶
func (e *ErrorDefinition) GetSrc() SrcNode
GetSrc returns the source location information of the error definition node.
func (*ErrorDefinition) GetType ¶
func (e *ErrorDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ErrorDefinition) GetTypeDescription ¶
func (e *ErrorDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the error definition.
func (*ErrorDefinition) Parse ¶
func (e *ErrorDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.ErrorDefinitionContext, ) Node[NodeType]
Parse parses the error definition context and populates the ErrorDefinition fields.
func (*ErrorDefinition) ParseGlobal ¶ added in v0.3.1
func (e *ErrorDefinition) ParseGlobal(ctx *parser.ErrorDefinitionContext) Node[NodeType]
ParseGlobal parses the error definition context and populates the ErrorDefinition fields.
func (*ErrorDefinition) SetReferenceDescriptor ¶
func (e *ErrorDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ErrorDefinition node.
func (*ErrorDefinition) ToProto ¶
func (e *ErrorDefinition) ToProto() NodeType
ToProto converts the ErrorDefinition node to its corresponding protobuf representation.
type EventDefinition ¶
type EventDefinition struct { *ASTBuilder // Embedding the ASTBuilder for common functionality SourceUnitName string `json:"-"` Id int64 `json:"id"` // Unique identifier for the event definition NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (EVENT_DEFINITION for event definition) Src SrcNode `json:"src"` // Source information about the event definition Parameters *ParameterList `json:"parameters"` // Parameters of the event Name string `json:"name"` // Name of the event Anonymous bool `json:"anonymous"` // Indicates if the event is anonymous TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the event }
EventDefinition represents an event definition in the Solidity abstract syntax tree (AST).
func NewEventDefinition ¶
func NewEventDefinition(b *ASTBuilder) *EventDefinition
NewEventDefinition creates a new EventDefinition instance.
func (*EventDefinition) GetId ¶
func (e *EventDefinition) GetId() int64
GetId returns the unique identifier of the event definition.
func (*EventDefinition) GetName ¶
func (e *EventDefinition) GetName() string
GetName returns the name of the event.
func (*EventDefinition) GetNodes ¶
func (e *EventDefinition) GetNodes() []Node[NodeType]
GetNodes returns the nodes representing the parameters of the event.
func (*EventDefinition) GetParameters ¶
func (e *EventDefinition) GetParameters() *ParameterList
GetParameters returns the parameters of the event.
func (*EventDefinition) GetSrc ¶
func (e *EventDefinition) GetSrc() SrcNode
GetSrc returns the source information about the event definition.
func (*EventDefinition) GetType ¶
func (e *EventDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'EVENT_DEFINITION' for an event definition.
func (*EventDefinition) GetTypeDescription ¶
func (e *EventDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the event.
func (*EventDefinition) IsAnonymous ¶
func (e *EventDefinition) IsAnonymous() bool
IsAnonymous returns whether the event is anonymous.
func (*EventDefinition) Parse ¶
func (e *EventDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.EventDefinitionContext, ) Node[NodeType]
Parse parses an event definition from the provided parser.EventDefinitionContext and updates the current instance.
func (*EventDefinition) ParseGlobal ¶ added in v0.3.1
func (e *EventDefinition) ParseGlobal( ctx *parser.EventDefinitionContext, ) Node[NodeType]
ParseGlobal parses an event definition from the provided parser.EventDefinitionContext and updates the current instance.
func (*EventDefinition) SetReferenceDescriptor ¶
func (e *EventDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the EventDefinition node. We don't need to do any reference description updates here, at least for now...
func (*EventDefinition) ToProto ¶
func (e *EventDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the event definition.
type ExprOperation ¶
type ExprOperation struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the expression operation NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (EXPRESSION_OPERATION for expression operation) Src SrcNode `json:"src"` // Source information about the expression operation LeftExpression Node[NodeType] `json:"leftExpression"` // Left expression in the operation RightExpression Node[NodeType] `json:"rightExpression"` // Right expression in the operation TypeDescriptions []*TypeDescription `json:"typeDescriptions"` // Type descriptions of the expressions }
ExprOperation represents an expression operation in the Solidity abstract syntax tree (AST).
func NewExprOperationExpression ¶
func NewExprOperationExpression(b *ASTBuilder) *ExprOperation
NewExprOperationExpression creates a new ExprOperation instance.
func (*ExprOperation) GetId ¶
func (f *ExprOperation) GetId() int64
GetId returns the unique identifier of the expression operation.
func (*ExprOperation) GetLeftExpression ¶
func (f *ExprOperation) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression in the operation.
func (*ExprOperation) GetNodes ¶
func (f *ExprOperation) GetNodes() []Node[NodeType]
GetNodes returns the nodes representing the left and right expressions of the operation.
func (*ExprOperation) GetRightExpression ¶
func (f *ExprOperation) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression in the operation.
func (*ExprOperation) GetSrc ¶
func (f *ExprOperation) GetSrc() SrcNode
GetSrc returns the source information about the expression operation.
func (*ExprOperation) GetType ¶
func (f *ExprOperation) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'EXPRESSION_OPERATION' for an expression operation.
func (*ExprOperation) GetTypeDescription ¶
func (f *ExprOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the expression operation.
func (*ExprOperation) Parse ¶
func (f *ExprOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.ExpOperationContext, ) Node[NodeType]
Parse parses an expression operation from the provided parser.ExpOperationContext and updates the current instance.
func (*ExprOperation) SetReferenceDescriptor ¶
func (b *ExprOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ExprOperation node.
func (*ExprOperation) ToProto ¶
func (f *ExprOperation) ToProto() NodeType
ToProto returns the protobuf representation of the expression operation.
func (*ExprOperation) UnmarshalJSON ¶ added in v0.3.1
func (f *ExprOperation) UnmarshalJSON(data []byte) error
type Expression ¶
type Expression struct {
*ASTBuilder
}
Expression represents an AST node for an expression in Solidity.
func NewExpression ¶
func NewExpression(b *ASTBuilder) *Expression
NewExpression creates a new Expression instance with the provided ASTBuilder. The ASTBuilder is used to facilitate the construction of the AST.
func (*Expression) Parse ¶
func (e *Expression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDecar *VariableDeclaration, parentNode Node[NodeType], parentNodeId int64, ctx parser.IExpressionContext, ) Node[NodeType]
Parse analyzes the provided parser.IExpressionContext and constructs the corresponding AST node. It supports various types of expressions in Solidity such as binary operations, assignments, function calls, member accesses, etc. If the expression type is not supported, a warning is logged.
Parameters: - unit: The source unit node. - contractNode: The contract node within the source. - fnNode: The function node within the contract. - bodyNode: The body node of the function. - vDecar: The variable declaration node. - parentNode: The parent expression node. - ctx: The context representing the expression to be parsed.
Returns:
- Node[NodeType]: The constructed AST node for the parsed expression. If the expression type is not supported, it returns nil.
func (*Expression) ParseInterface ¶ added in v0.3.1
func (e *Expression) ParseInterface( unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], parentNodeId int64, ctx any, ) Node[NodeType]
type ExpressionContext ¶ added in v0.3.4
type ExpressionContext struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Value string `json:"value"` TypeDescription *TypeDescription `json:"typeDescription"` }
ExpressionContext represents an AST node for an expression context in Solidity.
func NewExpressionContext ¶ added in v0.3.4
func NewExpressionContext(b *ASTBuilder) *ExpressionContext
NewExpressionContext creates a new ExpressionContext instance with the provided ASTBuilder. The ASTBuilder is used to facilitate the construction of the AST.
func (*ExpressionContext) GetId ¶ added in v0.3.4
func (f *ExpressionContext) GetId() int64
GetId returns the ID of the ExpressionContext.
func (*ExpressionContext) GetNodes ¶ added in v0.3.4
func (f *ExpressionContext) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the ExpressionContext.
func (*ExpressionContext) GetSrc ¶ added in v0.3.4
func (f *ExpressionContext) GetSrc() SrcNode
GetSrc returns the source information of the ExpressionContext.
func (*ExpressionContext) GetType ¶ added in v0.3.4
func (f *ExpressionContext) GetType() ast_pb.NodeType
GetType returns the NodeType of the ExpressionContext.
func (*ExpressionContext) GetTypeDescription ¶ added in v0.3.4
func (f *ExpressionContext) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the ExpressionContext.
func (*ExpressionContext) Parse ¶ added in v0.3.4
func (f *ExpressionContext) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.ExpressionContext, ) Node[NodeType]
Parse parses the ExpressionContext node from the parsing context and associates it with other nodes.
func (*ExpressionContext) SetReferenceDescriptor ¶ added in v0.3.4
func (f *ExpressionContext) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ExpressionContext node. This function always returns false for now.
func (*ExpressionContext) ToProto ¶ added in v0.3.4
func (f *ExpressionContext) ToProto() NodeType
ToProto converts the ExpressionContext to its corresponding protocol buffer representation.
type Fallback ¶
type Fallback struct { *ASTBuilder // Embedded ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for the Fallback node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Kind ast_pb.NodeType `json:"kind"` // Kind of the fallback function. Src SrcNode `json:"src"` // Source location information. Implemented bool `json:"implemented"` // Indicates whether the function is implemented. Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the fallback function. StateMutability ast_pb.Mutability `json:"stateMutability"` // State mutability of the fallback function. Modifiers []*ModifierInvocation `json:"modifiers"` // List of modifier invocations applied to the fallback function. Overrides []*OverrideSpecifier `json:"overrides"` // List of override specifiers for the fallback function. Parameters *ParameterList `json:"parameters"` // List of parameters for the fallback function. ReturnParameters *ParameterList `json:"returnParameters"` // List of return parameters for the fallback function. Body *BodyNode `json:"body"` // Body of the fallback function. Virtual bool `json:"virtual"` // Indicates whether the function is virtual. }
Fallback represents a fallback function definition node in the abstract syntax tree (AST). It encapsulates information about the characteristics and properties of a fallback function within a contract.
func NewFallbackDefinition ¶
func NewFallbackDefinition(b *ASTBuilder) *Fallback
NewFallbackDefinition creates a new Fallback node with default values and returns it.
func (*Fallback) GetKind ¶
GetKind returns the kind of the Fallback node, which is NodeType_FALLBACK.
func (*Fallback) GetModifiers ¶
func (f *Fallback) GetModifiers() []*ModifierInvocation
GetModifiers returns a list of modifier invocations applied to the Fallback node.
func (*Fallback) GetNodes ¶
GetNodes returns a slice of child nodes within the body of the fallback function.
func (*Fallback) GetOverrides ¶
func (f *Fallback) GetOverrides() []*OverrideSpecifier
GetOverrides returns a list of override specifiers for the Fallback node.
func (*Fallback) GetParameters ¶
func (f *Fallback) GetParameters() *ParameterList
GetParameters returns the list of parameters for the Fallback node.
func (*Fallback) GetReturnParameters ¶
func (f *Fallback) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters for the Fallback node.
func (*Fallback) GetStateMutability ¶
func (f *Fallback) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Fallback function.
func (*Fallback) GetType ¶
GetType returns the type of the AST node, which is NodeType_FUNCTION_DEFINITION for a fallback function.
func (*Fallback) GetTypeDescription ¶
func (f *Fallback) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Fallback node.
func (*Fallback) GetVisibility ¶
func (f *Fallback) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Fallback function.
func (*Fallback) IsImplemented ¶
IsImplemented returns true if the Fallback function is implemented, false otherwise.
func (*Fallback) IsVirtual ¶
IsVirtual returns true if the Fallback function is virtual, false otherwise.
func (*Fallback) Parse ¶
func (f *Fallback) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.FallbackFunctionDefinitionContext, ) Node[NodeType]
Parse populates the properties of the Fallback node by parsing the corresponding context and information. It returns the populated Fallback node.
func (*Fallback) SetReferenceDescriptor ¶
func (f *Fallback) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Fallback node. This function currently returns false, as no reference description updates are performed.
type ForStatement ¶
type ForStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the ForStatement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. Initialiser Node[NodeType] `json:"initialiser"` // Initialiser expression. Condition Node[NodeType] `json:"condition"` // Condition expression. Closure Node[NodeType] `json:"closure"` // Closure expression. Body *BodyNode `json:"body"` // Body of the for loop. }
ForStatement represents a for loop statement in the AST.
func NewForStatement ¶
func NewForStatement(b *ASTBuilder) *ForStatement
NewForStatement creates a new ForStatement node with a given ASTBuilder.
func (*ForStatement) GetBody ¶
func (f *ForStatement) GetBody() *BodyNode
GetBody returns the body of the for loop.
func (*ForStatement) GetClosure ¶
func (f *ForStatement) GetClosure() Node[NodeType]
GetClosure returns the closure expression.
func (*ForStatement) GetCondition ¶
func (f *ForStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression.
func (*ForStatement) GetId ¶
func (f *ForStatement) GetId() int64
GetId returns the ID of the ForStatement node.
func (*ForStatement) GetInitialiser ¶
func (f *ForStatement) GetInitialiser() Node[NodeType]
GetInitialiser returns the initialiser expression.
func (*ForStatement) GetNodes ¶
func (f *ForStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the ForStatement node.
func (*ForStatement) GetSrc ¶
func (f *ForStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the ForStatement node.
func (*ForStatement) GetType ¶
func (f *ForStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ForStatement node.
func (*ForStatement) GetTypeDescription ¶
func (f *ForStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the ForStatement node.
func (*ForStatement) Parse ¶
func (f *ForStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.ForStatementContext, ) Node[NodeType]
Parse parses a for loop statement context into the ForStatement node. Documentation: https://docs.soliditylang.org/en/v0.8.19/grammar.html#a4.SolidityParser.forStatement
func (*ForStatement) SetReferenceDescriptor ¶
func (f *ForStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ForStatement node. We don't need to do any reference description updates here, at least for now...
func (*ForStatement) ToProto ¶
func (f *ForStatement) ToProto() NodeType
ToProto returns a protobuf representation of the ForStatement node.
func (*ForStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *ForStatement) UnmarshalJSON(data []byte) error
MarshalJSON marshals the ForStatement node into a JSON byte slice.
type Function ¶
type Function struct { *ASTBuilder // Embedded ASTBuilder for creating the AST. // Core properties of a function node. Id int64 `json:"id"` Name string `json:"name"` NodeType ast_pb.NodeType `json:"nodeType"` Kind ast_pb.NodeType `json:"kind"` Src SrcNode `json:"src"` NameLocation SrcNode `json:"nameLocation"` Body *BodyNode `json:"body"` Implemented bool `json:"implemented"` Visibility ast_pb.Visibility `json:"visibility"` StateMutability ast_pb.Mutability `json:"stateMutability"` Virtual bool `json:"virtual"` Modifiers []*ModifierInvocation `json:"modifiers"` Overrides []*OverrideSpecifier `json:"overrides"` Parameters *ParameterList `json:"parameters"` ReturnParameters *ParameterList `json:"returnParameters"` SignatureRaw string `json:"signatureRaw"` SignatureBytes []byte `json:"-"` Signature string `json:"signature"` Scope int64 `json:"scope"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` TypeDescription *TypeDescription `json:"typeDescription"` Text string `json:"text,omitempty"` }
Function represents a Solidity function definition within an abstract syntax tree.
func NewFunction ¶
func NewFunction(b *ASTBuilder) *Function
NewFunction creates and initializes a new Function node.
func (*Function) ComputeSignature ¶ added in v0.3.1
func (f *Function) ComputeSignature()
ComputeSignature computes the signature of the Function node.
func (*Function) GetModifiers ¶
func (f *Function) GetModifiers() []*ModifierInvocation
GetModifiers returns the list of modifier invocations applied to the Function node.
func (*Function) GetNameLocation ¶
GetNameLocation returns the source location information of the name of the Function node.
func (*Function) GetOverrides ¶
func (f *Function) GetOverrides() []*OverrideSpecifier
GetOverrides returns the list of override specifiers associated with the Function node.
func (*Function) GetParameters ¶
func (f *Function) GetParameters() *ParameterList
GetParameters returns the list of parameters of the Function node.
func (*Function) GetReferencedDeclaration ¶
GetReferencedDeclaration returns the referenced declaration identifier associated with the Function node.
func (*Function) GetReturnParameters ¶
func (f *Function) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters of the Function node.
func (*Function) GetSignature ¶ added in v0.3.1
GetSignature computes the keccak signature of the Function node.
func (*Function) GetSignatureBytes ¶ added in v0.3.1
GetSignatureBytes returns the keccak signature full bytes of the Function node.
func (*Function) GetSignatureRaw ¶ added in v0.3.1
GetSignatureRaw returns the raw signature of the Function node.
func (*Function) GetStateMutability ¶
func (f *Function) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Function node.
func (*Function) GetTypeDescription ¶
func (f *Function) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the Function node.
func (*Function) GetVisibility ¶
func (f *Function) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Function node.
func (*Function) IsImplemented ¶
IsImplemented returns true if the Function node is implemented, false otherwise.
func (*Function) IsVirtual ¶
IsVirtual returns true if the Function node is declared as virtual, false otherwise.
func (*Function) Parse ¶
func (f *Function) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.FunctionDefinitionContext, ) Node[NodeType]
Parse parses the source code and constructs the Function node.
func (*Function) ParseTypeName ¶ added in v0.3.1
func (f *Function) ParseTypeName( unit *SourceUnit[Node[ast_pb.SourceUnit]], parentNodeId int64, ctx *parser.FunctionTypeNameContext, ) Node[NodeType]
ParseTypeName parses the source code and constructs the Function node for TypeName.
func (*Function) SetReferenceDescriptor ¶
func (f *Function) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Function node.
func (*Function) ToProto ¶
ToProto converts the Function node to its corresponding protobuf representation.
func (*Function) UnmarshalJSON ¶ added in v0.3.1
type FunctionCall ¶
type FunctionCall struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Kind ast_pb.NodeType `json:"kind"` // Kind of the node. Src SrcNode `json:"src"` // Source location of the node. ArgumentTypes []*TypeDescription `json:"argumentTypes"` // Types of the arguments. Arguments []Node[NodeType] `json:"arguments"` // Arguments of the function call. Expression Node[NodeType] `json:"expression"` // Expression of the function call. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration of the function call. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the function call. }
FunctionCall represents a function call node in the AST.
func NewFunctionCall ¶
func NewFunctionCall(b *ASTBuilder) *FunctionCall
NewFunctionCall creates a new FunctionCall node with a given ASTBuilder. It initializes the Arguments slice and sets the NodeType and Kind to FUNCTION_CALL.
func (*FunctionCall) GetArgumentTypes ¶
func (f *FunctionCall) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the types of the arguments of the FunctionCall node.
func (*FunctionCall) GetArguments ¶
func (f *FunctionCall) GetArguments() []Node[NodeType]
GetArguments returns the arguments of the FunctionCall node.
func (*FunctionCall) GetExpression ¶
func (f *FunctionCall) GetExpression() Node[NodeType]
GetExpression returns the expression of the FunctionCall node.
func (*FunctionCall) GetId ¶
func (f *FunctionCall) GetId() int64
GetId returns the unique identifier of the FunctionCall node.
func (*FunctionCall) GetKind ¶
func (f *FunctionCall) GetKind() ast_pb.NodeType
GetKind returns the kind of the FunctionCall node.
func (*FunctionCall) GetNodes ¶
func (f *FunctionCall) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the FunctionCall node.
func (*FunctionCall) GetReferenceDeclaration ¶
func (f *FunctionCall) GetReferenceDeclaration() int64
GetReferenceDeclaration returns the referenced declaration of the FunctionCall node.
func (*FunctionCall) GetSrc ¶
func (f *FunctionCall) GetSrc() SrcNode
GetSrc returns the source location of the FunctionCall node.
func (*FunctionCall) GetType ¶
func (f *FunctionCall) GetType() ast_pb.NodeType
GetType returns the type of the FunctionCall node.
func (*FunctionCall) GetTypeDescription ¶
func (f *FunctionCall) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the FunctionCall node. Currently, it returns nil and needs to be implemented.
func (*FunctionCall) Parse ¶
func (f *FunctionCall) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.FunctionCallContext, ) Node[NodeType]
Parse takes a parser.FunctionCallContext and parses it into a FunctionCall node. It sets the Id, Src, Arguments, ArgumentTypes, and Expression of the FunctionCall node. It returns the created FunctionCall node.
func (*FunctionCall) RebuildDescriptions ¶ added in v0.3.1
func (f *FunctionCall) RebuildDescriptions()
RebuildDescriptions rebuilds the type descriptions of the FunctionCall node. It is called after the AST is built.
func (*FunctionCall) SetReferenceDescriptor ¶
func (f *FunctionCall) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the FunctionCall node.
func (*FunctionCall) ToProto ¶
func (f *FunctionCall) ToProto() NodeType
ToProto returns a protobuf representation of the FunctionCall node. Currently, it returns an empty Statement and needs to be implemented.
func (*FunctionCall) UnmarshalJSON ¶ added in v0.3.1
func (f *FunctionCall) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a FunctionCall node.
type FunctionCallOption ¶
type FunctionCallOption struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Kind ast_pb.NodeType `json:"kind"` // Kind of the node. Src SrcNode `json:"src"` // Source location of the node. Expression Node[NodeType] `json:"expression"` // Expression of the function call. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration of the function call. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the function call. }
FunctionCallOption represents a function call node in the AST.
func NewFunctionCallOption ¶
func NewFunctionCallOption(b *ASTBuilder) *FunctionCallOption
NewFunctionCall creates a new FunctionCallOption node with a given ASTBuilder. It initializes the Arguments slice and sets the NodeType and Kind to FUNCTION_CALL.
func (*FunctionCallOption) GetExpression ¶
func (f *FunctionCallOption) GetExpression() Node[NodeType]
GetExpression returns the expression of the FunctionCallOption node.
func (*FunctionCallOption) GetId ¶
func (f *FunctionCallOption) GetId() int64
GetId returns the unique identifier of the FunctionCallOption node.
func (*FunctionCallOption) GetKind ¶
func (f *FunctionCallOption) GetKind() ast_pb.NodeType
GetKind returns the kind of the FunctionCallOption node.
func (*FunctionCallOption) GetNodes ¶
func (f *FunctionCallOption) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the FunctionCallOption node.
func (*FunctionCallOption) GetReferenceDeclaration ¶
func (f *FunctionCallOption) GetReferenceDeclaration() int64
GetReferenceDeclaration returns the referenced declaration of the FunctionCallOption node.
func (*FunctionCallOption) GetSrc ¶
func (f *FunctionCallOption) GetSrc() SrcNode
GetSrc returns the source location of the FunctionCallOption node.
func (*FunctionCallOption) GetType ¶
func (f *FunctionCallOption) GetType() ast_pb.NodeType
GetType returns the type of the FunctionCallOption node.
func (*FunctionCallOption) GetTypeDescription ¶
func (f *FunctionCallOption) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the FunctionCallOption node. Currently, it returns nil and needs to be implemented.
func (*FunctionCallOption) Parse ¶
func (f *FunctionCallOption) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.FunctionCallOptionsContext, ) Node[NodeType]
Parse takes a parser.FunctionCallOptionsContext and parses it into a FunctionCallOption node. It sets the Id, Src, Expression, and TypeDescription of the FunctionCallOption node. It returns the created FunctionCallOption node.
func (*FunctionCallOption) SetReferenceDescriptor ¶
func (f *FunctionCallOption) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the FunctionCallOption node.
func (*FunctionCallOption) ToProto ¶
func (f *FunctionCallOption) ToProto() NodeType
ToProto returns a protobuf representation of the FunctionCallOption node. Currently, it returns an empty Statement and needs to be implemented.
func (*FunctionCallOption) UnmarshalJSON ¶ added in v0.3.1
func (f *FunctionCallOption) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a FunctionCallOption node.
type IfStatement ¶
type IfStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the if statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. Condition Node[NodeType] `json:"condition"` // Condition node. Body Node[NodeType] `json:"body"` // Body node. }
IfStatement represents an if statement node in the abstract syntax tree.
func NewIfStatement ¶
func NewIfStatement(b *ASTBuilder) *IfStatement
NewIfStatement creates a new instance of IfStatement with the provided ASTBuilder.
func (*IfStatement) GetBody ¶
func (i *IfStatement) GetBody() Node[NodeType]
GetBody returns the body node of the if statement.
func (*IfStatement) GetCondition ¶
func (i *IfStatement) GetCondition() Node[NodeType]
GetCondition returns the condition node of the if statement.
func (*IfStatement) GetId ¶
func (i *IfStatement) GetId() int64
GetId returns the unique identifier of the if statement node.
func (*IfStatement) GetNodes ¶
func (i *IfStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the if statement (condition and body).
func (*IfStatement) GetSrc ¶
func (i *IfStatement) GetSrc() SrcNode
GetSrc returns the source location information of the if statement node.
func (*IfStatement) GetType ¶
func (i *IfStatement) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*IfStatement) GetTypeDescription ¶
func (i *IfStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the if statement.
func (*IfStatement) Parse ¶
func (i *IfStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.IfStatementContext, ) Node[NodeType]
Parse parses the if statement context and populates the IfStatement fields.
func (*IfStatement) SetReferenceDescriptor ¶
func (i *IfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the IfStatement node.
func (*IfStatement) ToProto ¶
func (i *IfStatement) ToProto() NodeType
ToProto converts the IfStatement node to its corresponding protobuf representation.
func (*IfStatement) UnmarshalJSON ¶ added in v0.3.1
func (i *IfStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data into a IfStatement.
type Import ¶
type Import struct { Id int64 `json:"id"` // Unique identifier of the import node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. NameLocation *SrcNode `json:"nameLocation,omitempty"` // Source location information of the name. AbsolutePath string `json:"absolutePath"` // Absolute path of the imported file. File string `json:"file"` // Filepath of the import statement. Scope int64 `json:"scope"` // Scope of the import. UnitAlias string `json:"unitAlias"` // Alias of the imported unit. As string `json:"as"` // Alias of the imported unit. UnitAliases []string `json:"unitAliases"` // Alias of the imported unit. SourceUnit int64 `json:"sourceUnit"` // Source unit identifier. }
Import represents an import node in the abstract syntax tree.
func (*Import) GetAbsolutePath ¶
GetAbsolutePath returns the absolute path of the imported file.
func (*Import) GetNameLocation ¶
GetNameLocation returns the source location information of the name of the import node.
func (*Import) GetSourceUnit ¶
GetSourceUnit returns the source unit identifier of the import.
func (*Import) GetTypeDescription ¶
func (i *Import) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the import node.
func (*Import) GetUnitAlias ¶
GetUnitAlias returns the alias of the imported unit.
func (*Import) GetUnitAliases ¶ added in v0.3.1
GetUnitAliases returns the aliases of the imported unit.
func (*Import) SetReferenceDescriptor ¶
func (i *Import) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Import node.
type IndexAccess ¶
type IndexAccess struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the IndexAccess node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. IndexExpression Node[NodeType] `json:"indexExpression"` // Index expression. BaseExpression Node[NodeType] `json:"baseExpression"` // Base expression. TypeDescriptions []*TypeDescription `json:"typeDescriptions"` // Type descriptions. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration. TypeDescription *TypeDescription `json:"typeDescription"` // Type description. }
IndexAccess represents an index access expression in the AST.
func NewIndexAccess ¶
func NewIndexAccess(b *ASTBuilder) *IndexAccess
NewIndexAccess creates a new IndexAccess node with a given ASTBuilder.
func (*IndexAccess) GetBaseExpression ¶
func (i *IndexAccess) GetBaseExpression() Node[NodeType]
GetBaseExpression returns the base expression.
func (*IndexAccess) GetId ¶
func (i *IndexAccess) GetId() int64
GetId returns the ID of the IndexAccess node.
func (*IndexAccess) GetIndexExpression ¶
func (i *IndexAccess) GetIndexExpression() Node[NodeType]
GetIndexExpression returns the index expression.
func (*IndexAccess) GetName ¶
func (i *IndexAccess) GetName() string
GetName returns the name of the IndexAccess node.
func (*IndexAccess) GetNodes ¶
func (i *IndexAccess) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the IndexAccess node.
func (*IndexAccess) GetReferencedDeclaration ¶
func (i *IndexAccess) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration.
func (*IndexAccess) GetSrc ¶
func (i *IndexAccess) GetSrc() SrcNode
GetSrc returns the SrcNode of the IndexAccess node.
func (*IndexAccess) GetType ¶
func (i *IndexAccess) GetType() ast_pb.NodeType
GetType returns the NodeType of the IndexAccess node.
func (*IndexAccess) GetTypeDescription ¶
func (i *IndexAccess) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description.
func (*IndexAccess) GetTypeDescriptions ¶
func (i *IndexAccess) GetTypeDescriptions() []*TypeDescription
GetTypeDescriptions returns the list of type descriptions.
func (*IndexAccess) Parse ¶
func (i *IndexAccess) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.IndexAccessContext, ) Node[NodeType]
Parse parses an index access context into the IndexAccess node.
func (*IndexAccess) SetReferenceDescriptor ¶
func (i *IndexAccess) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the IndexAccess node. Here we are going to just do some magic stuff in order to figure out descriptions across the board...
func (*IndexAccess) ToProto ¶
func (i *IndexAccess) ToProto() NodeType
ToProto returns a protobuf representation of the IndexAccess node.
func (*IndexAccess) UnmarshalJSON ¶ added in v0.3.1
func (i *IndexAccess) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the IndexAccess node data from its JSON representation.
type IndexRange ¶
type IndexRange struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` LeftExpression Node[NodeType] `json:"leftExpression"` RightExpression Node[NodeType] `json:"rightExpression"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` }
IndexRange represents an Index Range expression in the AST.
func NewIndexRangeAccessExpression ¶
func NewIndexRangeAccessExpression(b *ASTBuilder) *IndexRange
NewIndexRange creates a new instance of IndexRange with initialized values.
func (*IndexRange) GetId ¶
func (f *IndexRange) GetId() int64
GetId returns the unique identifier of the IndexRange node.
func (*IndexRange) GetLeftExpression ¶
func (f *IndexRange) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression of the IndexRange.
func (*IndexRange) GetNodes ¶
func (f *IndexRange) GetNodes() []Node[NodeType]
GetNodes returns the list of nodes within the IndexRange.
func (*IndexRange) GetRightExpression ¶
func (f *IndexRange) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression of the IndexRange.
func (*IndexRange) GetSrc ¶
func (f *IndexRange) GetSrc() SrcNode
GetSrc returns the source information of the IndexRange node.
func (*IndexRange) GetType ¶
func (f *IndexRange) GetType() ast_pb.NodeType
GetType returns the node type of the IndexRange.
func (*IndexRange) GetTypeDescription ¶
func (f *IndexRange) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the IndexRange.
func (*IndexRange) Parse ¶
func (f *IndexRange) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.IndexRangeAccessContext, ) Node[NodeType]
Parse parses the IndexRange expression from the provided context and constructs the IndexRange node.
func (*IndexRange) SetReferenceDescriptor ¶
func (b *IndexRange) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor is used to set reference descriptions for the IndexRange node. However, this function always returns false.
func (*IndexRange) ToProto ¶
func (f *IndexRange) ToProto() NodeType
ToProto converts the IndexRange node to its Protocol Buffers representation.
func (*IndexRange) UnmarshalJSON ¶ added in v0.3.1
func (f *IndexRange) UnmarshalJSON(data []byte) error
type InlineArray ¶ added in v0.3.1
type InlineArray struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the InlineArray node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. TypeDescriptions []*TypeDescription `json:"typeDescriptions"` // Type descriptions of the InlineArray node. Expressions []Node[NodeType] `json:"expressions"` // List of expressions in the InlineArray node. Empty bool `json:"empty"` // Indicates whether the InlineArray node is empty. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the InlineArray node. }
InlineArray represents a for loop statement in the AST.
func NewInlineArrayExpression ¶ added in v0.3.1
func NewInlineArrayExpression(b *ASTBuilder) *InlineArray
NewInlineArrayExpression creates a new InlineArray node with a given ASTBuilder.
func (*InlineArray) GetExpressions ¶ added in v0.3.1
func (f *InlineArray) GetExpressions() []Node[NodeType]
GetExpressions returns the list of associated expressions.
func (*InlineArray) GetId ¶ added in v0.3.1
func (f *InlineArray) GetId() int64
GetId returns the ID of the InlineArray node.
func (*InlineArray) GetNodes ¶ added in v0.3.1
func (f *InlineArray) GetNodes() []Node[NodeType]
func (*InlineArray) GetSrc ¶ added in v0.3.1
func (f *InlineArray) GetSrc() SrcNode
GetSrc returns the SrcNode of the InlineArray node.
func (*InlineArray) GetType ¶ added in v0.3.1
func (f *InlineArray) GetType() ast_pb.NodeType
GetType returns the NodeType of the InlineArray node.
func (*InlineArray) GetTypeDescription ¶ added in v0.3.1
func (f *InlineArray) GetTypeDescription() *TypeDescription
func (*InlineArray) GetTypeDescriptions ¶ added in v0.3.1
func (f *InlineArray) GetTypeDescriptions() []*TypeDescription
func (*InlineArray) IsEmpty ¶ added in v0.3.1
func (f *InlineArray) IsEmpty() bool
IsEmpty returns true if the InlineArray node is empty.
func (*InlineArray) Parse ¶ added in v0.3.1
func (f *InlineArray) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.InlineArrayContext, ) Node[NodeType]
func (*InlineArray) SetReferenceDescriptor ¶ added in v0.3.1
func (f *InlineArray) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the InlineArray node. We don't need to do any reference description updates here, at least for now...
func (*InlineArray) ToProto ¶ added in v0.3.1
func (f *InlineArray) ToProto() NodeType
func (*InlineArray) UnmarshalJSON ¶ added in v0.3.1
func (f *InlineArray) UnmarshalJSON(data []byte) error
type Interface ¶
type Interface struct { *ASTBuilder // Embedded ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for the Interface node. Name string `json:"name"` // Name of the interface. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. NameLocation SrcNode `json:"nameLocation"` // Location of the interface name. Abstract bool `json:"abstract"` // Indicates whether the interface is abstract. Kind ast_pb.NodeType `json:"kind"` // Kind of the interface. FullyImplemented bool `json:"fullyImplemented"` // Indicates whether the interface is fully implemented. Nodes []Node[NodeType] `json:"nodes"` // List of child nodes within the interface. LinearizedBaseContracts []int64 `json:"linearizedBaseContracts"` // List of linearized base contract identifiers. BaseContracts []*BaseContract `json:"baseContracts"` // List of base contracts. ContractDependencies []int64 `json:"contractDependencies"` // List of contract dependency identifiers. }
Interface represents an interface definition node in the abstract syntax tree (AST). It encapsulates information about the characteristics and properties of an interface within the contract.
func NewInterfaceDefinition ¶
func NewInterfaceDefinition(b *ASTBuilder) *Interface
NewInterfaceDefinition creates a new Interface node with default values and returns it.
func (*Interface) GetBaseContracts ¶
func (l *Interface) GetBaseContracts() []*BaseContract
GetBaseContracts returns a list of base contracts associated with the Interface.
func (*Interface) GetConstructor ¶
func (l *Interface) GetConstructor() *Constructor
GetConstructor returns the constructor node within the Interface, if present.
func (*Interface) GetContractDependencies ¶
GetContractDependencies returns a list of contract dependency identifiers for the Interface.
func (*Interface) GetEnums ¶
func (l *Interface) GetEnums() []*EnumDefinition
GetEnums returns a list of enum definitions within the Interface.
func (*Interface) GetErrors ¶
func (l *Interface) GetErrors() []*ErrorDefinition
GetErrors returns a list of error definitions within the Interface.
func (*Interface) GetEvents ¶
func (l *Interface) GetEvents() []*EventDefinition
GetEvents returns a list of event definitions within the Interface.
func (*Interface) GetFallback ¶
GetFallback returns the fallback function node within the Interface, if present.
func (*Interface) GetFunctions ¶
GetFunctions returns a list of function definitions within the Interface.
func (*Interface) GetLinearizedBaseContracts ¶
GetLinearizedBaseContracts returns a list of linearized base contract identifiers for the Interface.
func (*Interface) GetNameLocation ¶
GetNameLocation returns the location of the interface name.
func (*Interface) GetReceive ¶
GetReceive returns the receive function node within the Interface, if present.
func (*Interface) GetStateVariables ¶
func (l *Interface) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns a list of state variable declarations within the Interface.
func (*Interface) GetStructs ¶
func (l *Interface) GetStructs() []*StructDefinition
GetStructs returns a list of struct definitions within the Interface.
func (*Interface) GetType ¶
GetType returns the type of the AST node, which is NodeType_CONTRACT_DEFINITION for an interface.
func (*Interface) GetTypeDescription ¶
func (l *Interface) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Interface node.
func (*Interface) IsAbstract ¶
IsAbstract returns true if the Interface is abstract, false otherwise.
func (*Interface) IsFullyImplemented ¶
IsFullyImplemented returns true if the Interface is fully implemented, false otherwise.
func (*Interface) Parse ¶
func (l *Interface) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.InterfaceDefinitionContext, rootNode *RootNode, unit *SourceUnit[Node[ast_pb.SourceUnit]])
Parse is responsible for parsing the interface definition from the source unit context and populating the Interface node.
func (*Interface) SetReferenceDescriptor ¶
func (l *Interface) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Interface node. This function currently returns false, as no reference description updates are performed.
func (*Interface) ToProto ¶
ToProto converts the Interface node to its corresponding protocol buffer representation.
func (*Interface) UnmarshalJSON ¶ added in v0.3.1
type Library ¶
type Library struct { *ASTBuilder Id int64 `json:"id"` // Id is the unique identifier of the library node. Name string `json:"name"` // Name is the name of the library. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType is the type of the node. Src SrcNode `json:"src"` // Src is the source node associated with the library node. NameLocation SrcNode `json:"nameLocation"` // NameLocation is the source node associated with the name of the library node. Abstract bool `json:"abstract"` // Abstract indicates if the library is abstract. Kind ast_pb.NodeType `json:"kind"` // Kind is the kind of the node. FullyImplemented bool `json:"fullyImplemented"` // FullyImplemented indicates if the library is fully implemented. Nodes []Node[NodeType] `json:"nodes"` // Nodes are the nodes associated with the library. LinearizedBaseContracts []int64 `json:"linearizedBaseContracts"` // LinearizedBaseContracts are the linearized base contracts of the library. BaseContracts []*BaseContract `json:"baseContracts"` // BaseContracts are the base contracts of the library. ContractDependencies []int64 `json:"contractDependencies"` // ContractDependencies are the contract dependencies of the library. }
Library represents a library node in the abstract syntax tree. It includes various attributes like id, name, type, source node, abstract status, kind, implementation status, nodes, base contracts, contract dependencies and scope.
func NewLibraryDefinition ¶
func NewLibraryDefinition(b *ASTBuilder) *Library
NewLibraryDefinition creates a new Library with the provided ASTBuilder. It returns a pointer to the created Library.
func (*Library) GetBaseContracts ¶
func (l *Library) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the library.
func (*Library) GetConstructor ¶
func (l *Library) GetConstructor() *Constructor
GetConstructor returns the constructor definition in the library.
func (*Library) GetContractDependencies ¶
GetContractDependencies returns the contract dependencies of the library.
func (*Library) GetEnums ¶
func (l *Library) GetEnums() []*EnumDefinition
GetEnums returns an array of enum definitions in the library.
func (*Library) GetErrors ¶
func (l *Library) GetErrors() []*ErrorDefinition
GetErrors returns an array of error definitions in the library.
func (*Library) GetEvents ¶
func (l *Library) GetEvents() []*EventDefinition
GetEvents returns an array of event definitions in the library.
func (*Library) GetFallback ¶
GetFallback returns the fallback function definition in the library.
func (*Library) GetFunctions ¶
GetFunctions returns an array of function definitions in the library.
func (*Library) GetLinearizedBaseContracts ¶
GetLinearizedBaseContracts returns the linearized base contracts of the library.
func (*Library) GetNameLocation ¶
GetNameLocation returns the source node associated with the name of the library node.
func (*Library) GetReceive ¶
GetReceive returns the receive function definition in the library.
func (*Library) GetStateVariables ¶
func (l *Library) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns an array of state variable declarations in the library.
func (*Library) GetStructs ¶
func (l *Library) GetStructs() []*StructDefinition
GetStructs returns an array of struct definitions in the library.
func (*Library) GetTypeDescription ¶
func (l *Library) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the library node. Currently, it returns nil and needs to be implemented.
func (*Library) IsAbstract ¶
IsAbstract returns a boolean indicating whether the library is abstract.
func (*Library) IsFullyImplemented ¶
IsFullyImplemented returns a boolean indicating whether the library is fully implemented.
func (*Library) Parse ¶
func (l *Library) Parse(unitCtx *parser.SourceUnitContext, ctx *parser.LibraryDefinitionContext, rootNode *RootNode, unit *SourceUnit[Node[ast_pb.SourceUnit]])
Parse parses the source unit context and library definition context to populate the library node. It takes a SourceUnitContext, a LibraryDefinitionContext, a RootNode and a SourceUnit as arguments. It does not return anything.
func (*Library) SetReferenceDescriptor ¶
func (l *Library) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Library node.
func (*Library) ToProto ¶
ToProto converts the Library to a protocol buffer representation. Currently, it returns an empty Contract and needs to be implemented.
func (*Library) UnmarshalJSON ¶ added in v0.3.1
type LibraryName ¶
type LibraryName struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Name string `json:"name"` ReferencedDeclaration int64 `json:"referencedDeclaration"` }
LibraryName represents the name of an external library referenced in a using directive.
func (*LibraryName) ToProto ¶
func (ln *LibraryName) ToProto() *ast_pb.LibraryName
ToProto converts the LibraryName instance to its corresponding protocol buffer representation.
type MemberAccessExpression ¶
type MemberAccessExpression struct { *ASTBuilder Id int64 `json:"id"` Constant bool `json:"isConstant"` LValue bool `json:"isLValue"` Pure bool `json:"isPure"` LValueRequested bool `json:"lValueRequested"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` MemberLocation SrcNode `json:"memberLocation"` Expression Node[NodeType] `json:"expression"` MemberName string `json:"memberName"` ArgumentTypes []*TypeDescription `json:"argumentTypes"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` TypeDescription *TypeDescription `json:"typeDescription"` Text string `json:"text"` }
MemberAccessExpression represents a member access expression node in the AST. It contains information about the accessed member, expression, type description, and related metadata.
func NewMemberAccessExpression ¶
func NewMemberAccessExpression(b *ASTBuilder) *MemberAccessExpression
NewMemberAccessExpression creates a new MemberAccessExpression instance with initial values.
func (*MemberAccessExpression) GetArgumentTypes ¶
func (m *MemberAccessExpression) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the type descriptions of arguments in case of function call member access.
func (*MemberAccessExpression) GetExpression ¶
func (m *MemberAccessExpression) GetExpression() Node[NodeType]
GetExpression returns the expression being accessed in the member access.
func (*MemberAccessExpression) GetId ¶
func (m *MemberAccessExpression) GetId() int64
GetId returns the ID of the MemberAccessExpression node.
func (*MemberAccessExpression) GetMemberLocation ¶
func (m *MemberAccessExpression) GetMemberLocation() SrcNode
GetMemberLocation returns the source information of the accessed member.
func (*MemberAccessExpression) GetMemberName ¶
func (m *MemberAccessExpression) GetMemberName() string
GetMemberName returns the name of the accessed member.
func (*MemberAccessExpression) GetNodes ¶
func (m *MemberAccessExpression) GetNodes() []Node[NodeType]
GetNodes returns the list of child nodes of the MemberAccessExpression node.
func (*MemberAccessExpression) GetReferencedDeclaration ¶
func (m *MemberAccessExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the ID of the referenced declaration in the context of member access.
func (*MemberAccessExpression) GetSrc ¶
func (m *MemberAccessExpression) GetSrc() SrcNode
GetSrc returns the source information of the MemberAccessExpression node.
func (*MemberAccessExpression) GetType ¶
func (m *MemberAccessExpression) GetType() ast_pb.NodeType
GetType returns the NodeType of the MemberAccessExpression node.
func (*MemberAccessExpression) GetTypeDescription ¶
func (m *MemberAccessExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the member access.
func (*MemberAccessExpression) IsConstant ¶
func (m *MemberAccessExpression) IsConstant() bool
IsConstant returns whether the member access is constant.
func (*MemberAccessExpression) IsLValue ¶
func (m *MemberAccessExpression) IsLValue() bool
IsLValue returns whether the member access is an l-value.
func (*MemberAccessExpression) IsLValueRequested ¶
func (m *MemberAccessExpression) IsLValueRequested() bool
IsLValueRequested returns whether an l-value is requested in the context of member access.
func (*MemberAccessExpression) IsPure ¶
func (m *MemberAccessExpression) IsPure() bool
IsPure returns whether the member access is pure.
func (*MemberAccessExpression) Parse ¶
func (m *MemberAccessExpression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.MemberAccessContext, ) Node[NodeType]
Parse populates the MemberAccessExpression node based on the provided context and other information.
func (*MemberAccessExpression) SetReferenceDescriptor ¶
func (m *MemberAccessExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the MemberAccessExpression node.
func (*MemberAccessExpression) ToProto ¶
func (m *MemberAccessExpression) ToProto() NodeType
ToProto converts the MemberAccessExpression node to its corresponding protobuf representation.
func (*MemberAccessExpression) ToText ¶ added in v0.3.2
func (m *MemberAccessExpression) ToText() string
func (*MemberAccessExpression) UnmarshalJSON ¶ added in v0.3.1
func (m *MemberAccessExpression) UnmarshalJSON(data []byte) error
type MetaType ¶
type MetaType struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the meta-type node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Name string `json:"name"` // Name of the meta-type. Src SrcNode `json:"src"` // Source location information. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration identifier. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the meta-type. }
MetaType represents a meta-type node in the abstract syntax tree.
func NewMetaTypeExpression ¶
func NewMetaTypeExpression(b *ASTBuilder) *MetaType
NewMetaTypeExpression creates a new instance of MetaType with the provided ASTBuilder.
func (*MetaType) GetReferencedDeclaration ¶
GetReferencedDeclaration returns the referenced declaration identifier of the meta-type.
func (*MetaType) GetTypeDescription ¶
func (m *MetaType) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the meta-type.
func (*MetaType) Parse ¶
func (m *MetaType) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, exprNode Node[NodeType], ctx *parser.MetaTypeContext, ) Node[NodeType]
Parse parses the meta-type context and populates the MetaType fields.
func (*MetaType) SetReferenceDescriptor ¶
func (m *MetaType) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the MetaType node.
type ModifierDefinition ¶
type ModifierDefinition struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the modifier definition node. Name string `json:"name"` // Name of the modifier. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. NameLocation SrcNode `json:"nameLocation"` // Source location information of the name. Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the modifier. Virtual bool `json:"virtual"` // Indicates if the modifier is virtual. Parameters *ParameterList `json:"parameters"` // List of parameters for the modifier. Body *BodyNode `json:"body"` // Body node of the modifier. }
ModifierDefinition represents a modifier definition node in the abstract syntax tree.
func NewModifierDefinition ¶
func NewModifierDefinition(b *ASTBuilder) *ModifierDefinition
NewModifierDefinition creates a new instance of ModifierDefinition with the provided ASTBuilder.
func (*ModifierDefinition) GetBody ¶
func (m *ModifierDefinition) GetBody() *BodyNode
GetBody returns the body node of the modifier.
func (*ModifierDefinition) GetId ¶
func (m *ModifierDefinition) GetId() int64
GetId returns the unique identifier of the modifier definition node.
func (*ModifierDefinition) GetName ¶
func (m *ModifierDefinition) GetName() string
GetName returns the name of the modifier.
func (*ModifierDefinition) GetNameLocation ¶
func (m *ModifierDefinition) GetNameLocation() SrcNode
GetNameLocation returns the source location information of the name of the modifier definition.
func (*ModifierDefinition) GetNodes ¶
func (m *ModifierDefinition) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the modifier definition (body statements).
func (*ModifierDefinition) GetParameters ¶
func (m *ModifierDefinition) GetParameters() *ParameterList
GetParameters returns the parameter list of the modifier.
func (*ModifierDefinition) GetSrc ¶
func (m *ModifierDefinition) GetSrc() SrcNode
GetSrc returns the source location information of the modifier definition node.
func (*ModifierDefinition) GetType ¶
func (m *ModifierDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ModifierDefinition) GetTypeDescription ¶
func (m *ModifierDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the modifier definition.
func (*ModifierDefinition) GetVisibility ¶
func (m *ModifierDefinition) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the modifier.
func (*ModifierDefinition) IsVirtual ¶
func (m *ModifierDefinition) IsVirtual() bool
IsVirtual returns true if the modifier is virtual.
func (*ModifierDefinition) ParseDefinition ¶
func (m *ModifierDefinition) ParseDefinition( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.ModifierDefinitionContext, ) Node[NodeType]
ParseDefinition parses the modifier definition context and populates the ModifierDefinition fields.
func (*ModifierDefinition) SetReferenceDescriptor ¶
func (m *ModifierDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ModifierDefinition node.
func (*ModifierDefinition) ToProto ¶
func (m *ModifierDefinition) ToProto() NodeType
ToProto converts the ModifierDefinition node to its corresponding protobuf representation.
func (*ModifierDefinition) UnmarshalJSON ¶ added in v0.3.1
func (m *ModifierDefinition) UnmarshalJSON(data []byte) error
type ModifierInvocation ¶
type ModifierInvocation struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the modifier invocation node. Name string `json:"name"` // Name of the modifier invocation. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Kind ast_pb.NodeType `json:"kind"` // Kind of the modifier invocation. Src SrcNode `json:"src"` // Source location information. ArgumentTypes []*TypeDescription `json:"argumentTypes"` // Types of the arguments. Arguments []Node[NodeType] `json:"arguments"` // Argument nodes. ModifierName *ModifierName `json:"modifierName,omitempty"` // Modifier name node. }
ModifierInvocation represents a modifier invocation node in the abstract syntax tree.
func NewModifierInvocation ¶
func NewModifierInvocation(b *ASTBuilder) *ModifierInvocation
NewModifierInvocation creates a new instance of ModifierInvocation with the provided ASTBuilder.
func (*ModifierInvocation) GetArgumentTypes ¶
func (m *ModifierInvocation) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns a slice of argument types of the modifier invocation.
func (*ModifierInvocation) GetArguments ¶
func (m *ModifierInvocation) GetArguments() []Node[NodeType]
GetArguments returns a slice of argument nodes of the modifier invocation.
func (*ModifierInvocation) GetId ¶
func (m *ModifierInvocation) GetId() int64
GetId returns the unique identifier of the modifier invocation node.
func (*ModifierInvocation) GetKind ¶
func (m *ModifierInvocation) GetKind() ast_pb.NodeType
GetKind returns the kind of the modifier invocation.
func (*ModifierInvocation) GetName ¶
func (m *ModifierInvocation) GetName() string
GetName returns the name of the modifier invocation.
func (*ModifierInvocation) GetNodes ¶
func (m *ModifierInvocation) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes associated with the modifier invocation (arguments).
func (*ModifierInvocation) GetSrc ¶
func (m *ModifierInvocation) GetSrc() SrcNode
GetSrc returns the source location information of the modifier invocation node.
func (*ModifierInvocation) GetType ¶
func (m *ModifierInvocation) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ModifierInvocation) GetTypeDescription ¶
func (m *ModifierInvocation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the modifier invocation (returns nil).
func (*ModifierInvocation) Parse ¶
func (m *ModifierInvocation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx parser.IModifierInvocationContext, )
Parse parses the modifier invocation context and populates the ModifierInvocation fields.
func (*ModifierInvocation) SetReferenceDescriptor ¶
func (m *ModifierInvocation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ModifierInvocation node.
func (*ModifierInvocation) ToProto ¶
func (m *ModifierInvocation) ToProto() NodeType
ToProto converts the ModifierInvocation node to its corresponding protobuf representation.
func (*ModifierInvocation) UnmarshalJSON ¶ added in v0.3.1
func (m *ModifierInvocation) UnmarshalJSON(data []byte) error
type ModifierName ¶
type ModifierName struct { Id int64 `json:"id"` // Unique identifier of the modifier name node. Name string `json:"name"` // Name of the modifier. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. }
ModifierName represents the name of a modifier in the abstract syntax tree.
func (*ModifierName) ToProto ¶
func (m *ModifierName) ToProto() *ast_pb.ModifierName
ToProto converts the ModifierName node to its corresponding protobuf representation.
type NewExpr ¶
type NewExpr struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` ArgumentTypes []*TypeDescription `json:"argumentTypes"` TypeName *TypeName `json:"typeName"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` TypeDescription *TypeDescription `json:"typeDescription"` }
NewExpr represents a new expression node in the AST. It contains information about the type being instantiated, type description, and related metadata.
func NewExprExpression ¶
func NewExprExpression(b *ASTBuilder) *NewExpr
NewExprExpression creates a new NewExpr instance with initial values.
func (*NewExpr) GetArgumentTypes ¶
func (n *NewExpr) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the type descriptions of arguments in the new expression.
func (*NewExpr) GetReferencedDeclaration ¶
GetReferencedDeclaration returns the ID of the referenced declaration in the context of new expression.
func (*NewExpr) GetTypeDescription ¶
func (n *NewExpr) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the new expression.
func (*NewExpr) GetTypeName ¶
GetTypeName returns the type name associated with the new expression.
func (*NewExpr) Parse ¶
func (n *NewExpr) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, exprNode Node[NodeType], ctx *parser.NewExprContext, ) Node[NodeType]
Parse populates the NewExpr node based on the provided context and other information.
func (*NewExpr) SetReferenceDescriptor ¶
func (n *NewExpr) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the NewExpr node.
type Node ¶
type Node[T NodeType] interface { GetId() int64 GetType() ast_pb.NodeType GetSrc() SrcNode GetTypeDescription() *TypeDescription GetNodes() []Node[NodeType] ToProto() T SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool }
Node is an interface that defines methods common to all AST nodes.
func ParseYulExpression ¶ added in v0.3.1
func ParseYulExpression( b *ASTBuilder, unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, assignmentNode *parser.YulAssignmentContext, variableNode *parser.YulVariableDeclarationContext, parentNode Node[NodeType], ctx parser.IYulExpressionContext, ) Node[NodeType]
ParseYulExpression parses a YUL expression statement.
type NodeType ¶
type NodeType interface { // List of supported AST node types. ast_pb.Pragma | ast_pb.Import | ast_pb.Modifier | ast_pb.SourceUnit | ast_pb.Function | ast_pb.Contract | ast_pb.Statement | ast_pb.Body | ast_pb.Variable | ast_pb.PrimaryExpression | ast_pb.Expression | ast_pb.Using | ast_pb.Declaration | ast_pb.TypeName | ast_pb.BaseContract | ast_pb.TypeDescription | ast_pb.BinaryOperation | ast_pb.Return | ast_pb.ParameterList | ast_pb.Parameter | ast_pb.StateVariable | ast_pb.Event | ast_pb.If | ast_pb.Catch | ast_pb.FunctionCall | ast_pb.Assignment | ast_pb.Enum | ast_pb.Error | ast_pb.Revert | ast_pb.MemberAccess | ast_pb.Emit | ast_pb.Tuple | ast_pb.IndexAccess | ast_pb.For | any }
NodeType is an alias type that represents the union of various AST node types.
type NodeVisitor ¶ added in v0.3.2
type NodeVisitor struct { // Visit defines a generic function to visit nodes of any type. // It should return true to continue traversal, false to stop. Visit func(node Node[NodeType]) bool // TypeVisit maps node types to slices of functions that visit nodes of that specific type. // Each function should return a boolean indicating whether to continue traversal, and an error if one occurred. TypeVisit map[ast_pb.NodeType][]func(node Node[NodeType]) (bool, error) }
NodeVisitor defines a structure for visiting nodes within an AST. It supports both a generic visit function and type-specific visit functions.
func (*NodeVisitor) RegisterTypeVisit ¶ added in v0.3.2
func (nv *NodeVisitor) RegisterTypeVisit(nodeType ast_pb.NodeType, visitFunc func(node Node[NodeType]) (bool, error))
RegisterTypeVisit allows registering one or more visitation functions for a specific node type. These functions are called when a node of the specified type is encountered during traversal.
type OverridePath ¶ added in v0.3.1
type OverridePath struct { Id int64 `json:"id"` // Unique identifier of the modifier name node. Name string `json:"name"` // Name of the modifier. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. ReferencedDeclaration int64 `json:"referencedDeclaration"` // Referenced declaration identifier. TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the override specifier. }
OverridePath represents an override path node in the abstract syntax tree.
func (*OverridePath) GetId ¶ added in v0.3.1
func (m *OverridePath) GetId() int64
GetId returns the unique identifier of the override path node.
func (*OverridePath) GetName ¶ added in v0.3.1
func (m *OverridePath) GetName() string
GetName returns the name of the override path node.
func (*OverridePath) GetNodes ¶ added in v0.3.1
func (m *OverridePath) GetNodes() []Node[NodeType]
GetNodes returns an empty slice of nodes associated with the override path.
func (*OverridePath) GetReferencedDeclaration ¶ added in v0.3.1
func (m *OverridePath) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration identifier of the override path.
func (*OverridePath) GetSrc ¶ added in v0.3.1
func (m *OverridePath) GetSrc() SrcNode
GetSrc returns the source location information of the override path node.
func (*OverridePath) GetType ¶ added in v0.3.1
func (m *OverridePath) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*OverridePath) GetTypeDescription ¶ added in v0.3.1
func (m *OverridePath) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the override path.
func (*OverridePath) SetReferenceDescriptor ¶ added in v0.3.1
func (op *OverridePath) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptor of the OverridePath.
func (*OverridePath) ToProto ¶ added in v0.3.1
func (m *OverridePath) ToProto() *ast_pb.OverridePath
ToProto converts the OverridePath node to its corresponding protobuf representation.
type OverrideSpecifier ¶
type OverrideSpecifier struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the override specifier node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. Overrides []*OverridePath `json:"overrides"` // List of override paths. ReferencedDeclaration int64 `json:"referencedDeclaration"` // Referenced declaration identifier. TypeDescription *TypeDescription `json:"typeDescriptions"` // Type description of the override specifier. }
OverrideSpecifier represents an override specifier node in the abstract syntax tree.
func NewOverrideSpecifier ¶
func NewOverrideSpecifier(b *ASTBuilder) *OverrideSpecifier
NewOverrideSpecifier creates a new instance of OverrideSpecifier with the provided ASTBuilder.
func (*OverrideSpecifier) GetId ¶
func (o *OverrideSpecifier) GetId() int64
GetId returns the unique identifier of the override specifier node.
func (*OverrideSpecifier) GetNodes ¶
func (o *OverrideSpecifier) GetNodes() []Node[NodeType]
GetNodes returns an empty slice of nodes associated with the override specifier.
func (*OverrideSpecifier) GetOverrides ¶ added in v0.3.1
func (o *OverrideSpecifier) GetOverrides() []*OverridePath
GetOverrides returns the list of override paths.
func (*OverrideSpecifier) GetReferencedDeclaration ¶
func (o *OverrideSpecifier) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration identifier of the override specifier.
func (*OverrideSpecifier) GetSrc ¶
func (o *OverrideSpecifier) GetSrc() SrcNode
GetSrc returns the source location information of the override specifier node.
func (*OverrideSpecifier) GetType ¶
func (o *OverrideSpecifier) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*OverrideSpecifier) GetTypeDescription ¶
func (o *OverrideSpecifier) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the override specifier.
func (*OverrideSpecifier) Parse ¶
func (o *OverrideSpecifier) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], ctx parser.IOverrideSpecifierContext)
Parse parses the override specifier context and populates the OverrideSpecifier fields.
func (*OverrideSpecifier) SetReferenceDescriptor ¶
func (o *OverrideSpecifier) SetReferenceDescriptor(refId int64, refType *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptor of the OverrideSpecifier.
func (*OverrideSpecifier) ToProto ¶
func (o *OverrideSpecifier) ToProto() NodeType
ToProto converts the OverrideSpecifier node to its corresponding protobuf representation.
type Parameter ¶
type Parameter struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the parameter node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. NameLocation *SrcNode `json:"nameLocation,omitempty"` // Source location information of the name. Scope int64 `json:"scope,omitempty"` // Scope of the parameter. Name string `json:"name"` // Name of the parameter. TypeName *TypeName `json:"typeName,omitempty"` // Type name of the parameter. StorageLocation ast_pb.StorageLocation `json:"storageLocation,omitempty"` // Storage location of the parameter. Visibility ast_pb.Visibility `json:"visibility,omitempty"` // Visibility of the parameter. StateMutability ast_pb.Mutability `json:"stateMutability,omitempty"` // State mutability of the parameter. Constant bool `json:"constant,omitempty"` // Whether the parameter is constant. StateVariable bool `json:"stateVariable,omitempty"` // Whether the parameter is a state variable. TypeDescription *TypeDescription `json:"typeDescription,omitempty"` // Type description of the parameter. Indexed bool `json:"indexed,omitempty"` // Whether the parameter is indexed. }
Parameter represents a parameter node in the abstract syntax tree.
func NewParameter ¶
func NewParameter(b *ASTBuilder) *Parameter
NewParameter creates a new instance of Parameter with the provided ASTBuilder.
func (*Parameter) GetNameLocation ¶
GetNameLocation returns the source location information of the name of the parameter.
func (*Parameter) GetStateMutability ¶
func (p *Parameter) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the parameter.
func (*Parameter) GetStorageLocation ¶
func (p *Parameter) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the parameter.
func (*Parameter) GetTypeDescription ¶
func (p *Parameter) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the parameter.
func (*Parameter) GetTypeName ¶
GetTypeName returns the type name of the parameter.
func (*Parameter) GetVisibility ¶
func (p *Parameter) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the parameter.
func (*Parameter) IsConstant ¶
IsConstant returns whether the parameter is constant.
func (*Parameter) IsStateVariable ¶
IsStateVariable returns whether the parameter is a state variable.
func (*Parameter) Parse ¶
func (p *Parameter) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], plNode Node[*ast_pb.ParameterList], ctx *parser.ParameterDeclarationContext)
Parse parses the parameter declaration context and populates the Parameter fields.
func (*Parameter) ParseErrorParameter ¶
func (p *Parameter) ParseErrorParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], plNode Node[*ast_pb.ParameterList], ctx parser.IErrorParameterContext)
ParseErrorParameter parses the error parameter context and populates the Parameter fields for error definitions.
func (*Parameter) ParseEventParameter ¶
func (p *Parameter) ParseEventParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], plNode Node[*ast_pb.ParameterList], ctx parser.IEventParameterContext)
ParseEventParameter parses the event parameter context and populates the Parameter fields for event parameters.
func (*Parameter) ParseStructParameter ¶
func (p *Parameter) ParseStructParameter(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], structNode *StructDefinition, ctx parser.IStructMemberContext)
ParseStructParameter parses the struct parameter context and populates the Parameter fields for struct members.
func (*Parameter) SetReferenceDescriptor ¶
func (p *Parameter) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the Parameter node.
func (*Parameter) ToProto ¶
ToProto converts the Parameter node to its corresponding protobuf representation.
func (*Parameter) UnmarshalJSON ¶ added in v0.3.1
type ParameterList ¶
type ParameterList struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Parameters []*Parameter `json:"parameters"` ParameterTypes []*TypeDescription `json:"parameterTypes"` }
ParameterList represents a list of function or event parameters in the AST.
func NewParameterList ¶
func NewParameterList(b *ASTBuilder) *ParameterList
NewParameterList creates a new instance of ParameterList using the provided ASTBuilder.
func (*ParameterList) GetId ¶
func (p *ParameterList) GetId() int64
GetId returns the ID of the ParameterList node.
func (*ParameterList) GetNodes ¶
func (p *ParameterList) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the ParameterList.
func (*ParameterList) GetParameterTypes ¶
func (p *ParameterList) GetParameterTypes() []*TypeDescription
GetParameterTypes returns the list of parameter types in the ParameterList.
func (*ParameterList) GetParameters ¶
func (p *ParameterList) GetParameters() []*Parameter
GetParameters returns the list of parameters in the ParameterList.
func (*ParameterList) GetSrc ¶
func (p *ParameterList) GetSrc() SrcNode
GetSrc returns the source information of the ParameterList node.
func (*ParameterList) GetType ¶
func (p *ParameterList) GetType() ast_pb.NodeType
GetType returns the NodeType of the ParameterList node.
func (*ParameterList) GetTypeDescription ¶
func (p *ParameterList) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the ParameterList node.
func (*ParameterList) Parse ¶
func (p *ParameterList) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fNode Node[NodeType], ctx parser.IParameterListContext)
Parse parses the ParameterList node from the provided context.
func (*ParameterList) ParseErrorParameters ¶
func (p *ParameterList) ParseErrorParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ctx []parser.IErrorParameterContext)
ParseErrorParameters parses error parameters from the provided context.
func (*ParameterList) ParseEventParameters ¶
func (p *ParameterList) ParseEventParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ctx []parser.IEventParameterContext)
ParseEventParameters parses event parameters from the provided context.
func (*ParameterList) SetReferenceDescriptor ¶
func (p *ParameterList) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ParameterList node.
func (*ParameterList) ToProto ¶
func (p *ParameterList) ToProto() *ast_pb.ParameterList
ToProto converts the ParameterList into its corresponding Protocol Buffers representation. TODO: Proto ParameterTypes...
func (*ParameterList) UnmarshalJSON ¶ added in v0.3.1
func (p *ParameterList) UnmarshalJSON(data []byte) error
type PathNode ¶
type PathNode struct { Id int64 `json:"id"` Name string `json:"name"` NodeType ast_pb.NodeType `json:"nodeType"` ReferencedDeclaration int64 `json:"referencedDeclaration"` Src SrcNode `json:"src"` NameLocation *SrcNode `json:"nameLocation,omitempty"` TypeDescription *TypeDescription `json:"typeDescription,omitempty"` }
PathNode represents a path node within a TypeName.
func (*PathNode) GetNameLocation ¶ added in v0.3.1
GetNameLocation returns the name location of the PathNode.
func (*PathNode) GetNodes ¶ added in v0.3.1
GetNodes returns a list of child nodes for traversal within the PathNode.
func (*PathNode) GetReferencedDeclaration ¶ added in v0.3.1
GetReferencedDeclaration returns the referenced declaration of the PathNode.
func (*PathNode) GetSrc ¶ added in v0.3.1
GetSrc returns the source location information of the PathNode.
func (*PathNode) GetTypeDescription ¶ added in v0.3.1
func (pn *PathNode) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the PathNode.
func (*PathNode) SetReferenceDescriptor ¶ added in v0.3.1
func (pn *PathNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the PathNode node.
type PayableConversion ¶
type PayableConversion struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Arguments []Node[NodeType] `json:"arguments"` ArgumentTypes []*TypeDescription `json:"argumentTypes"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` TypeDescription *TypeDescription `json:"typeDescription"` Payable bool `json:"payable"` }
PayableConversion represents a payable conversion expression in the AST.
func NewPayableConversionExpression ¶
func NewPayableConversionExpression(b *ASTBuilder) *PayableConversion
NewPayableConversionExpression creates a new instance of PayableConversion using the provided ASTBuilder.
func (*PayableConversion) GetArgumentTypes ¶
func (p *PayableConversion) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the list of argument types in the PayableConversion node.
func (*PayableConversion) GetArguments ¶
func (p *PayableConversion) GetArguments() []Node[NodeType]
GetArguments returns the list of arguments in the PayableConversion node.
func (*PayableConversion) GetId ¶
func (p *PayableConversion) GetId() int64
GetId returns the ID of the PayableConversion node.
func (*PayableConversion) GetNodes ¶
func (p *PayableConversion) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the PayableConversion.
func (*PayableConversion) GetReferencedDeclaration ¶
func (p *PayableConversion) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the ID of the referenced declaration.
func (*PayableConversion) GetSrc ¶
func (p *PayableConversion) GetSrc() SrcNode
GetSrc returns the source information of the PayableConversion node.
func (*PayableConversion) GetType ¶
func (p *PayableConversion) GetType() ast_pb.NodeType
GetType returns the NodeType of the PayableConversion node.
func (*PayableConversion) GetTypeDescription ¶
func (p *PayableConversion) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the PayableConversion node.
func (*PayableConversion) IsPayable ¶
func (p *PayableConversion) IsPayable() bool
IsPayable returns whether the PayableConversion is marked as payable.
func (*PayableConversion) Parse ¶
func (p *PayableConversion) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, exprNode Node[NodeType], ctx *parser.PayableConversionContext, ) Node[NodeType]
Parse parses the PayableConversion node from the provided context.
func (*PayableConversion) RebuildDescriptions ¶ added in v0.3.2
func (p *PayableConversion) RebuildDescriptions()
RebuildDescriptions rebuilds the type descriptions of the FunctionCall node. It is called after the AST is built.
func (*PayableConversion) SetReferenceDescriptor ¶
func (p *PayableConversion) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the PayableConversion node.
func (*PayableConversion) ToProto ¶
func (p *PayableConversion) ToProto() NodeType
ToProto converts the PayableConversion into its corresponding Protocol Buffers representation.
func (*PayableConversion) UnmarshalJSON ¶ added in v0.3.1
func (p *PayableConversion) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a PayableConversion node.
type Pragma ¶
type Pragma struct { // Id is the unique identifier of the pragma directive. Id int64 `json:"id"` // NodeType is the type of the node. // For a Pragma, this is always NodeType_PRAGMA_DIRECTIVE. NodeType ast_pb.NodeType `json:"nodeType"` // SrcNode contains source information about the node, such as its line and column numbers in the source file. Src SrcNode `json:"src"` // Literals is a slice of strings that represent the literals of the pragma directive. // For example, for the pragma directive "pragma solidity ^0.5.0;", the literals would // be ["solidity", "^", "0", ".", "5", ".", "0"]. Literals []string `json:"literals"` // Text is the text of the pragma directive. Text string `json:"text"` }
Pragma represents a pragma directive in a Solidity source file. A pragma directive provides instructions to the compiler about how to treat the source code (e.g., compiler version).
func CreatePragmaFromCtx ¶
func CreatePragmaFromCtx(b *ASTBuilder, unit *SourceUnit[Node[ast_pb.SourceUnit]], pragmaCtx *parser.PragmaDirectiveContext) *Pragma
CreatePragmaFromCtx creates a new Pragma from the provided pragma context. It sets the ID of the new node to the next available ID from the provided ASTBuilder, and sets the source information of the node based on the provided pragma context. The NodeType of the new node is set to NodeType_PRAGMA_DIRECTIVE, and the literals of the node are set to the literals of the pragma context.
The function takes the following parameters:
- b: The ASTBuilder from which to get the next available ID.
- unit: The SourceUnit to which the new node will belong. The ID of the unit is set as the ParentIndex of the new node.
- pragmaCtx: The pragma context from which to create the new node. The source information and literals of the new node are set based on this context.
The function returns a pointer to the newly created Pragma.
func (*Pragma) GetLiterals ¶
GetLiterals returns a slice of strings that represent the literals of the pragma directive.
func (*Pragma) GetNodes ¶
GetNodes returns the child nodes of the node. For a Pragma, this is always nil.
func (*Pragma) GetSrc ¶
GetSrc returns the source information about the node, such as its line and column numbers in the source file.
func (*Pragma) GetType ¶
GetType returns the type of the node. For a Pragma, this is always NodeType_PRAGMA_DIRECTIVE.
func (*Pragma) GetTypeDescription ¶
func (p *Pragma) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the node. For a Pragma, this is always nil.
func (*Pragma) SetReferenceDescriptor ¶
func (p *Pragma) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Pragma node.
type PrimaryExpression ¶
type PrimaryExpression struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Kind ast_pb.NodeType `json:"kind,omitempty"` // Kind of the node. Value string `json:"value,omitempty"` // Value of the node. HexValue string `json:"hexValue,omitempty"` // Hexadecimal value of the node. Src SrcNode `json:"src"` // Source location of the node. Name string `json:"name,omitempty"` // Name of the node. TypeName *TypeName `json:"typeName,omitempty"` // Type name of the node. TypeDescription *TypeDescription `json:"typeDescription,omitempty"` // Type description of the node. OverloadedDeclarations []int64 `json:"overloadedDeclarations"` // Overloaded declarations of the node. ReferencedDeclaration int64 `json:"referencedDeclaration"` // Referenced declaration of the node. Pure bool `json:"isPure"` // Indicates if the node is pure. ArgumentTypes []*TypeDescription `json:"argumentTypes,omitempty"` // Argument types of the node. Text string `json:"text,omitempty"` // Text of the node. }
PrimaryExpression represents a primary expression node in the AST.
func NewPrimaryExpression ¶
func NewPrimaryExpression(b *ASTBuilder) *PrimaryExpression
NewPrimaryExpression creates a new PrimaryExpression node with a given ASTBuilder. It initializes the OverloadedDeclarations slice and sets the NodeType to IDENTIFIER.
func (*PrimaryExpression) GetArgumentTypes ¶
func (p *PrimaryExpression) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the argument types of the PrimaryExpression node.
func (*PrimaryExpression) GetHexValue ¶
func (p *PrimaryExpression) GetHexValue() string
GetHexValue returns the hexadecimal value of the PrimaryExpression node.
func (*PrimaryExpression) GetId ¶
func (p *PrimaryExpression) GetId() int64
GetId returns the unique identifier of the PrimaryExpression node.
func (*PrimaryExpression) GetKind ¶
func (p *PrimaryExpression) GetKind() ast_pb.NodeType
GetKind returns the kind of the PrimaryExpression node.
func (*PrimaryExpression) GetName ¶
func (p *PrimaryExpression) GetName() string
GetName returns the name of the PrimaryExpression node.
func (*PrimaryExpression) GetNodes ¶
func (p *PrimaryExpression) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the PrimaryExpression node.
func (*PrimaryExpression) GetOverloadedDeclarations ¶
func (p *PrimaryExpression) GetOverloadedDeclarations() []int64
GetOverloadedDeclarations returns the overloaded declarations of the PrimaryExpression node.
func (*PrimaryExpression) GetReferencedDeclaration ¶
func (p *PrimaryExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the PrimaryExpression node.
func (*PrimaryExpression) GetSrc ¶
func (p *PrimaryExpression) GetSrc() SrcNode
GetSrc returns the source location of the PrimaryExpression node.
func (*PrimaryExpression) GetType ¶
func (p *PrimaryExpression) GetType() ast_pb.NodeType
GetType returns the type of the PrimaryExpression node.
func (*PrimaryExpression) GetTypeDescription ¶
func (p *PrimaryExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the PrimaryExpression node.
func (*PrimaryExpression) GetTypeName ¶
func (p *PrimaryExpression) GetTypeName() *TypeName
GetTypeName returns the type name of the PrimaryExpression node.
func (*PrimaryExpression) GetValue ¶
func (p *PrimaryExpression) GetValue() string
GetValue returns the value of the PrimaryExpression node.
func (*PrimaryExpression) IsPure ¶
func (p *PrimaryExpression) IsPure() bool
IsPure returns true if the PrimaryExpression node is pure.
func (*PrimaryExpression) Parse ¶
func (p *PrimaryExpression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.PrimaryExpressionContext, ) Node[NodeType]
Parse takes a parser.PrimaryExpressionContext and parses it into a PrimaryExpression node. It sets the Src, Name, NodeType, Kind, Value, HexValue, TypeDescription, and other properties of the PrimaryExpression node. It returns the created PrimaryExpression node.
func (*PrimaryExpression) Rebuild ¶ added in v0.3.1
func (p *PrimaryExpression) Rebuild()
Rebuild rebuilds the PrimaryExpression node after referenced declaration is set.
func (*PrimaryExpression) SetReferenceDescriptor ¶
func (p *PrimaryExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the PrimaryExpression node.
func (*PrimaryExpression) ToProto ¶
func (p *PrimaryExpression) ToProto() NodeType
ToProto returns a protobuf representation of the PrimaryExpression node. Currently, it returns an empty PrimaryExpression and needs to be implemented.
type Receive ¶
type Receive struct { *ASTBuilder // Embedded ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for the Receive node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Kind ast_pb.NodeType `json:"kind"` // Kind of the receive function. Src SrcNode `json:"src"` // Source location information. Implemented bool `json:"implemented"` // Indicates whether the function is implemented. Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the receive function. StateMutability ast_pb.Mutability `json:"stateMutability"` // State mutability of the receive function. Modifiers []*ModifierInvocation `json:"modifiers"` // List of modifier invocations applied to the receive function. Overrides []*OverrideSpecifier `json:"overrides"` // List of override specifiers for the receive function. Parameters *ParameterList `json:"parameters"` // List of parameters for the receive function. ReturnParameters *ParameterList `json:"returnParameters"` // List of return parameters for the receive function. Body *BodyNode `json:"body"` // Body of the receive function. Virtual bool `json:"virtual"` // Indicates whether the function is virtual. Payable bool `json:"payable"` // Indicates whether the function is payable. }
Receive represents a receive function definition node in the abstract syntax tree (AST). It encapsulates information about the characteristics and properties of a receive function within a contract.
func NewReceiveDefinition ¶
func NewReceiveDefinition(b *ASTBuilder) *Receive
NewReceiveDefinition creates a new Receive node with default values and returns it.
func (*Receive) GetModifiers ¶
func (f *Receive) GetModifiers() []*ModifierInvocation
GetModifiers returns a list of modifier invocations applied to the Receive node.
func (*Receive) GetNodes ¶
GetNodes returns a slice of child nodes within the body of the receive function.
func (*Receive) GetOverrides ¶
func (f *Receive) GetOverrides() []*OverrideSpecifier
GetOverrides returns a list of override specifiers for the Receive node.
func (*Receive) GetParameters ¶
func (f *Receive) GetParameters() *ParameterList
GetParameters returns the list of parameters for the Receive node.
func (*Receive) GetReturnParameters ¶
func (f *Receive) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters for the Receive node.
func (*Receive) GetStateMutability ¶
func (f *Receive) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Receive function.
func (*Receive) GetType ¶
GetType returns the type of the AST node, which is NodeType_FUNCTION_DEFINITION for a receive function.
func (*Receive) GetTypeDescription ¶
func (f *Receive) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Receive node (currently returns nil).
func (*Receive) GetVisibility ¶
func (f *Receive) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Receive function.
func (*Receive) IsImplemented ¶
IsImplemented returns true if the Receive function is implemented, false otherwise.
func (*Receive) IsVirtual ¶
IsVirtual returns true if the Receive function is virtual, false otherwise.
func (*Receive) Parse ¶
func (f *Receive) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.ReceiveFunctionDefinitionContext, ) Node[NodeType]
Parse populates the properties of the Receive node by parsing the corresponding context and information. It returns the populated Receive node.
func (*Receive) SetReferenceDescriptor ¶
func (f *Receive) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Receive node. This function is not yet implemented and returns false.
func (*Receive) ToProto ¶
ToProto converts the Receive node to its corresponding protocol buffer representation.
func (*Receive) UnmarshalJSON ¶ added in v0.3.1
type Resolver ¶
type Resolver struct { *ASTBuilder // Nodes that could not be processed while parsing AST. // This will resolve issues with forward referencing... UnprocessedNodes map[int64]UnprocessedNode // contains filtered or unexported fields }
Resolver is a structure that helps in resolving the nodes of an Abstract Syntax Tree (AST). It contains a reference to an ASTBuilder and a map of UnprocessedNodes.
func NewResolver ¶
func NewResolver(builder *ASTBuilder) *Resolver
NewResolver creates a new Resolver with the provided ASTBuilder and initializes the UnprocessedNodes map.
func (*Resolver) GetUnprocessedCount ¶
GetUnprocessedCount returns the number of UnprocessedNodes in the Resolver.
func (*Resolver) GetUnprocessedNodes ¶
func (r *Resolver) GetUnprocessedNodes() map[int64]UnprocessedNode
GetUnprocessedNodes returns the map of UnprocessedNodes in the Resolver.
func (*Resolver) Resolve ¶
Resolve attempts to resolve all UnprocessedNodes in the Resolver and sets the entry source unit for the AST. It updates the node references in the AST and removes the nodes from the UnprocessedNodes map once they are resolved. If a node cannot be resolved, it is left in the UnprocessedNodes map for future resolution.
func (*Resolver) ResolveByNode ¶
ResolveByNode attempts to resolve a node by its name and returns the resolved Node and its TypeDescription. If the node cannot be found, it is added to the UnprocessedNodes map for future resolution.
type ReturnStatement ¶
type ReturnStatement struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` FunctionReturnParameters int64 `json:"functionReturnParameters"` Expression Node[NodeType] `json:"expression"` }
ReturnStatement represents a return statement in the AST.
func NewReturnStatement ¶
func NewReturnStatement(b *ASTBuilder) *ReturnStatement
NewReturnStatement creates a new instance of ReturnStatement using the provided ASTBuilder.
func (*ReturnStatement) GetExpression ¶
func (r *ReturnStatement) GetExpression() Node[NodeType]
GetExpression returns the expression associated with the ReturnStatement node.
func (*ReturnStatement) GetFunctionReturnParameters ¶
func (r *ReturnStatement) GetFunctionReturnParameters() int64
GetFunctionReturnParameters returns the ID of the function's return parameters.
func (*ReturnStatement) GetId ¶
func (r *ReturnStatement) GetId() int64
GetId returns the ID of the ReturnStatement node.
func (*ReturnStatement) GetNodes ¶
func (r *ReturnStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the ReturnStatement.
func (*ReturnStatement) GetSrc ¶
func (r *ReturnStatement) GetSrc() SrcNode
GetSrc returns the source information of the ReturnStatement node.
func (*ReturnStatement) GetType ¶
func (r *ReturnStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ReturnStatement node.
func (*ReturnStatement) GetTypeDescription ¶
func (r *ReturnStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the ReturnStatement's expression.
func (*ReturnStatement) Parse ¶
func (r *ReturnStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.ReturnStatementContext, ) Node[NodeType]
Parse parses the ReturnStatement node from the provided context.
func (*ReturnStatement) SetReferenceDescriptor ¶
func (r *ReturnStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ReturnStatement node.
func (*ReturnStatement) ToProto ¶
func (r *ReturnStatement) ToProto() NodeType
ToProto converts the ReturnStatement into its corresponding Protocol Buffers representation.
func (*ReturnStatement) UnmarshalJSON ¶ added in v0.3.1
func (r *ReturnStatement) UnmarshalJSON(data []byte) error
type RevertStatement ¶
type RevertStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the RevertStatement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. Arguments []Node[NodeType] `json:"arguments"` // List of argument expressions. Expression Node[NodeType] `json:"expression"` // Expression within the revert statement. }
RevertStatement represents a revert statement in the AST.
func NewRevertStatement ¶
func NewRevertStatement(b *ASTBuilder) *RevertStatement
NewRevertStatement creates a new RevertStatement node with a given ASTBuilder.
func (*RevertStatement) GetArguments ¶
func (r *RevertStatement) GetArguments() []Node[NodeType]
GetArguments returns the list of argument expressions.
func (*RevertStatement) GetExpression ¶
func (r *RevertStatement) GetExpression() Node[NodeType]
GetExpression returns the expression within the revert statement.
func (*RevertStatement) GetId ¶
func (r *RevertStatement) GetId() int64
GetId returns the ID of the RevertStatement node.
func (*RevertStatement) GetNodes ¶
func (r *RevertStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the RevertStatement node.
func (*RevertStatement) GetSrc ¶
func (r *RevertStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the RevertStatement node.
func (*RevertStatement) GetType ¶
func (r *RevertStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the RevertStatement node.
func (*RevertStatement) GetTypeDescription ¶
func (r *RevertStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the RevertStatement node.
func (*RevertStatement) Parse ¶
func (r *RevertStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.RevertStatementContext, ) Node[NodeType]
Parse parses a revert statement context into the RevertStatement node.
func (*RevertStatement) SetReferenceDescriptor ¶
func (r *RevertStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the RevertStatement node.
func (*RevertStatement) ToProto ¶
func (r *RevertStatement) ToProto() NodeType
ToProto returns a protobuf representation of the RevertStatement node.
func (*RevertStatement) UnmarshalJSON ¶ added in v0.3.1
func (r *RevertStatement) UnmarshalJSON(data []byte) error
MarshalJSON marshals the RevertStatement node into a JSON byte slice.
type RootNode ¶
type RootNode struct { // Id is the unique identifier of the root node. Id int64 `json:"id"` // NodeType is the type of the AST node. NodeType ast_pb.NodeType `json:"nodeType"` // EntrySourceUnit is the entry source unit of the root node. EntrySourceUnit int64 `json:"entrySourceUnit"` // Globals is the list of global nodes. Globals []Node[NodeType] `json:"globals"` // SourceUnits is the list of source units. SourceUnits []*SourceUnit[Node[ast_pb.SourceUnit]] `json:"root"` // Comments is the list of comments. Comments []*Comment `json:"comments"` }
RootNode is the root node of the AST.
func NewRootNode ¶
func NewRootNode(builder *ASTBuilder, entrySourceUnit int64, sourceUnits []*SourceUnit[Node[ast_pb.SourceUnit]], comments []*Comment) *RootNode
NewRootNode creates a new RootNode with the provided ASTBuilder, entry source unit, source units, and comments.
func (*RootNode) GetComments ¶
GetComments returns the comments of the root node.
func (*RootNode) GetEntrySourceUnit ¶
GetEntrySourceUnit returns the entry source unit of the root node.
func (*RootNode) GetGlobalNodes ¶ added in v0.3.1
GetGlobalNodes returns the global nodes of the root node.
func (*RootNode) GetSourceUnitById ¶
func (r *RootNode) GetSourceUnitById(id int64) *SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnitById returns the source unit with the provided id.
func (*RootNode) GetSourceUnitByName ¶
func (r *RootNode) GetSourceUnitByName(name string) *SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnitByName returns the source unit with the provided name.
func (*RootNode) GetSourceUnitCount ¶
GetSourceUnitCount returns the number of source units of the root node.
func (*RootNode) GetSourceUnits ¶
func (r *RootNode) GetSourceUnits() []*SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnits returns the source units of the root node.
func (*RootNode) GetTypeDescription ¶
func (r *RootNode) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the RootNode node. RootNode nodes do not have type descriptions.
func (*RootNode) HasSourceUnits ¶
HasSourceUnits returns true if the root node has source units.
func (*RootNode) SetEntrySourceUnit ¶
SetEntrySourceUnit sets the entry source unit of the root node.
func (*RootNode) SetReferenceDescriptor ¶
func (r *RootNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the RootNode node.
func (*RootNode) ToProto ¶
func (r *RootNode) ToProto() *ast_pb.RootSourceUnit
ToProto returns the protobuf representation of the root node.
func (*RootNode) UnmarshalJSON ¶ added in v0.3.1
type ShiftOperation ¶ added in v0.3.1
type ShiftOperation struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Operator ast_pb.NodeType `json:"operator"` Expressions []Node[NodeType] `json:"expressions"` TypeDescriptions []*TypeDescription `json:"typeDescriptions"` TypeDescription *TypeDescription `json:"typeDescription"` }
ShiftOperation represents an 'bit and' operation in an abstract syntax tree.
func NewShiftOperationExpression ¶ added in v0.3.1
func NewShiftOperationExpression(b *ASTBuilder) *ShiftOperation
NewShiftOperationExpression creates a new ShiftOperation instance.
func (*ShiftOperation) GetExpressions ¶ added in v0.3.1
func (f *ShiftOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the ShiftOperation.
func (*ShiftOperation) GetId ¶ added in v0.3.1
func (f *ShiftOperation) GetId() int64
GetId returns the ID of the ShiftOperation.
func (*ShiftOperation) GetNodes ¶ added in v0.3.1
func (f *ShiftOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the ShiftOperation.
func (*ShiftOperation) GetSrc ¶ added in v0.3.1
func (f *ShiftOperation) GetSrc() SrcNode
GetSrc returns the source information of the ShiftOperation.
func (*ShiftOperation) GetType ¶ added in v0.3.1
func (f *ShiftOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the ShiftOperation.
func (*ShiftOperation) GetTypeDescription ¶ added in v0.3.1
func (f *ShiftOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the ShiftOperation.
func (*ShiftOperation) Parse ¶ added in v0.3.1
func (f *ShiftOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], parentNodeId int64, ctx *parser.ShiftOperationContext, ) Node[NodeType]
Parse parses the ShiftOperation node from the parsing context and associates it with other nodes.
func (*ShiftOperation) SetReferenceDescriptor ¶ added in v0.3.1
func (f *ShiftOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ShiftOperation node. This function always returns false for now.
func (*ShiftOperation) ToProto ¶ added in v0.3.1
func (f *ShiftOperation) ToProto() NodeType
ToProto converts the ShiftOperation to its corresponding protocol buffer representation.
func (*ShiftOperation) UnmarshalJSON ¶ added in v0.3.1
func (f *ShiftOperation) UnmarshalJSON(data []byte) error
type SimpleStatement ¶
type SimpleStatement struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` }
SimpleStatement represents a simple statement in the AST.
func NewSimpleStatement ¶
func NewSimpleStatement(b *ASTBuilder) *SimpleStatement
NewSimpleStatement creates a new instance of SimpleStatement using the provided ASTBuilder. This instance is more like a placeholder for the actual statements that are returned from Parse()
func (*SimpleStatement) Parse ¶
func (s *SimpleStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, parentNode Node[NodeType], parentNodeId int64, ctx *parser.SimpleStatementContext, ) Node[NodeType]
Parse parses the SimpleStatement node from the provided context.
type SourceUnit ¶
type SourceUnit[T NodeType] struct { Id int64 `json:"id"` // Id is the unique identifier of the source unit. Contract Node[NodeType] `json:"-"` // Contract is the contract associated with the source unit. BaseContracts []*BaseContract `json:"baseContracts"` // BaseContracts are the base contracts of the source unit. License string `json:"license"` // License is the license of the source unit. ExportedSymbols []Symbol `json:"exportedSymbols"` // ExportedSymbols is the list of source units, including its names and node tree ids used by current source unit. AbsolutePath string `json:"absolutePath"` // AbsolutePath is the absolute path of the source unit. Name string `json:"name"` // Name is the name of the source unit. This is going to be one of the following: contract, interface or library name. It's here for convenience. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType is the type of the AST node. Kind ast_pb.NodeType `json:"kind"` // Kind is the type of the AST node (contract, library, interface). Nodes []Node[NodeType] `json:"nodes"` // Nodes is the list of AST nodes. Src SrcNode `json:"src"` // Src is the source code location. }
SourceUnit represents a source unit in the abstract syntax tree. It includes various attributes like id, license, exported symbols, absolute path, name, node type, nodes, and source node.
func NewSourceUnit ¶
func NewSourceUnit[T any](builder *ASTBuilder, name string, license string) *SourceUnit[T]
NewSourceUnit creates a new SourceUnit with the provided ASTBuilder, name, and license. It returns a pointer to the created SourceUnit.
func (*SourceUnit[T]) GetAbsolutePath ¶
func (s *SourceUnit[T]) GetAbsolutePath() string
GetAbsolutePath returns the absolute path of the source unit.
func (*SourceUnit[T]) GetBaseContracts ¶
func (s *SourceUnit[T]) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the source unit.
func (*SourceUnit[T]) GetContract ¶
func (s *SourceUnit[T]) GetContract() Node[NodeType]
GetContract returns the contract associated with the source unit.
func (*SourceUnit[T]) GetExportedSymbols ¶
func (s *SourceUnit[T]) GetExportedSymbols() []Symbol
GetExportedSymbols returns the exported symbols of the source unit.
func (*SourceUnit[T]) GetId ¶
func (s *SourceUnit[T]) GetId() int64
GetId returns the unique identifier of the source unit.
func (*SourceUnit[T]) GetImports ¶
func (s *SourceUnit[T]) GetImports() []*Import
func (*SourceUnit[T]) GetKind ¶ added in v0.3.5
func (s *SourceUnit[T]) GetKind() ast_pb.NodeType
GetKind returns the type of the source unit.
func (*SourceUnit[T]) GetLicense ¶
func (s *SourceUnit[T]) GetLicense() string
GetLicense returns the license of the source unit.
func (*SourceUnit[T]) GetName ¶
func (s *SourceUnit[T]) GetName() string
GetName returns the name of the source unit.
func (*SourceUnit[T]) GetNodes ¶
func (s *SourceUnit[T]) GetNodes() []Node[NodeType]
GetNodes returns the nodes associated with the source unit.
func (*SourceUnit[T]) GetPragmas ¶
func (s *SourceUnit[T]) GetPragmas() []*Pragma
func (*SourceUnit[T]) GetSrc ¶
func (s *SourceUnit[T]) GetSrc() SrcNode
GetSrc returns the source code location of the source unit.
func (*SourceUnit[T]) GetType ¶
func (s *SourceUnit[T]) GetType() ast_pb.NodeType
GetType returns the type of the source unit.
func (*SourceUnit[T]) GetTypeDescription ¶
func (s *SourceUnit[T]) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the source unit.
func (*SourceUnit[T]) SetAbsolutePathFromSources ¶
func (s *SourceUnit[T]) SetAbsolutePathFromSources(sources *solgo.Sources)
SetAbsolutePathFromSources sets the absolute path of the source unit from the provided sources.
func (*SourceUnit[T]) SetContract ¶ added in v0.3.2
func (s *SourceUnit[T]) SetContract(contract Node[NodeType])
SetContract sets the contract associated with the source unit.
func (*SourceUnit[T]) SetReferenceDescriptor ¶
func (s *SourceUnit[T]) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the SourceUnit node.
func (*SourceUnit[T]) ToProto ¶
func (s *SourceUnit[T]) ToProto() NodeType
ToProto converts the SourceUnit to a protocol buffer representation.
func (*SourceUnit[T]) UnmarshalJSON ¶ added in v0.3.1
func (s *SourceUnit[T]) UnmarshalJSON(data []byte) error
type SrcNode ¶
type SrcNode struct { Line int64 `json:"line"` // Line number of the source node in the source code. Column int64 `json:"column"` // Column number of the source node in the source code. Start int64 `json:"start"` // Start position of the source node in the source code. End int64 `json:"end"` // End position of the source node in the source code. Length int64 `json:"length"` // Length of the source node in the source code. ParentIndex int64 `json:"parentIndex,omitempty"` // Index of the parent node in the source code. }
SrcNode represents a node in the source code.
func (SrcNode) GetColumn ¶
GetColumn returns the column number of the source node in the source code.
func (SrcNode) GetParentIndex ¶
GetParentIndex returns the index of the parent node in the source code.
type StateVariableDeclaration ¶
type StateVariableDeclaration struct { *ASTBuilder // Embedding the ASTBuilder for common functionality Id int64 `json:"id"` // Unique identifier for the state variable declaration Name string `json:"name"` // Name of the state variable Constant bool `json:"isConstant"` // Indicates if the state variable is constant StateVariable bool `json:"isStateVariable"` // Indicates if the declaration is a state variable NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (VARIABLE_DECLARATION for state variable declaration) Src SrcNode `json:"src"` // Source information about the state variable declaration Scope int64 `json:"scope"` // Scope of the state variable declaration TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the state variable declaration Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the state variable declaration StorageLocation ast_pb.StorageLocation `json:"storageLocation"` // Storage location of the state variable declaration StateMutability ast_pb.Mutability `json:"mutability"` // State mutability of the state variable declaration TypeName *TypeName `json:"typeName"` // Type name of the state variable InitialValue Node[NodeType] `json:"initialValue"` // Initial value of the state variable }
StateVariableDeclaration represents a state variable declaration in the Solidity abstract syntax tree (AST).
func NewStateVariableDeclaration ¶
func NewStateVariableDeclaration(b *ASTBuilder) *StateVariableDeclaration
NewStateVariableDeclaration creates a new StateVariableDeclaration instance.
func (*StateVariableDeclaration) GetId ¶
func (v *StateVariableDeclaration) GetId() int64
GetId returns the unique identifier of the state variable declaration.
func (*StateVariableDeclaration) GetInitialValue ¶ added in v0.3.1
func (v *StateVariableDeclaration) GetInitialValue() Node[NodeType]
GetInitialValue returns the initial value of the state variable declaration.
func (*StateVariableDeclaration) GetName ¶
func (v *StateVariableDeclaration) GetName() string
GetName returns the name of the state variable.
func (*StateVariableDeclaration) GetNodes ¶
func (v *StateVariableDeclaration) GetNodes() []Node[NodeType]
GetNodes returns the type name node in the state variable declaration.
func (*StateVariableDeclaration) GetReferencedDeclaration ¶
func (v *StateVariableDeclaration) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the type name in the state variable declaration.
func (*StateVariableDeclaration) GetScope ¶
func (v *StateVariableDeclaration) GetScope() int64
GetScope returns the scope of the state variable declaration.
func (*StateVariableDeclaration) GetSrc ¶
func (v *StateVariableDeclaration) GetSrc() SrcNode
GetSrc returns the source information about the state variable declaration.
func (*StateVariableDeclaration) GetStateMutability ¶
func (v *StateVariableDeclaration) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the state variable declaration.
func (*StateVariableDeclaration) GetStorageLocation ¶
func (v *StateVariableDeclaration) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the state variable declaration.
func (*StateVariableDeclaration) GetType ¶
func (v *StateVariableDeclaration) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'VARIABLE_DECLARATION' for a state variable declaration.
func (*StateVariableDeclaration) GetTypeDescription ¶
func (v *StateVariableDeclaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the state variable declaration.
func (*StateVariableDeclaration) GetTypeName ¶
func (v *StateVariableDeclaration) GetTypeName() *TypeName
GetTypeName returns the type name of the state variable declaration.
func (*StateVariableDeclaration) GetVisibility ¶
func (v *StateVariableDeclaration) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the state variable declaration.
func (*StateVariableDeclaration) IsConstant ¶
func (v *StateVariableDeclaration) IsConstant() bool
IsConstant returns whether the state variable declaration is constant.
func (*StateVariableDeclaration) IsStateVariable ¶
func (v *StateVariableDeclaration) IsStateVariable() bool
IsStateVariable returns whether the declaration is a state variable.
func (*StateVariableDeclaration) Parse ¶
func (v *StateVariableDeclaration) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.StateVariableDeclarationContext, )
Parse parses a state variable declaration from the provided parser.StateVariableDeclarationContext and updates the current instance.
func (*StateVariableDeclaration) ParseGlobal ¶ added in v0.3.1
func (v *StateVariableDeclaration) ParseGlobal( ctx *parser.StateVariableDeclarationContext, )
ParseGlobal parses a state variable declaration from the provided parser.StateVariableDeclarationContext and updates the current instance.
func (*StateVariableDeclaration) ParseGlobalConstant ¶ added in v0.3.1
func (v *StateVariableDeclaration) ParseGlobalConstant( ctx *parser.ConstantVariableDeclarationContext, )
ParseGlobalConstant parses a global constant state variable declaration from the provided parser.ConstantVariableDeclarationContext and updates the current instance.
func (*StateVariableDeclaration) ParseGlobalVariable ¶ added in v0.3.1
func (v *StateVariableDeclaration) ParseGlobalVariable( ctx *parser.VariableDeclarationContext, )
ParseGlobalVariable parses a global variable declaration from the provided parser.VariableDeclarationContext and updates the current instance.
func (*StateVariableDeclaration) SetReferenceDescriptor ¶
func (v *StateVariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the StateVariableDeclaration node.
func (*StateVariableDeclaration) ToProto ¶
func (v *StateVariableDeclaration) ToProto() NodeType
ToProto returns the protobuf representation of the state variable declaration.
func (*StateVariableDeclaration) UnmarshalJSON ¶ added in v0.3.5
func (v *StateVariableDeclaration) UnmarshalJSON(data []byte) error
UnmarshalJSON customizes the JSON unmarshaling for StateVariableDeclaration.
type StructDefinition ¶
type StructDefinition struct { *ASTBuilder // Embedding the ASTBuilder for common functionality SourceUnitName string `json:"-"` // Name of the source unit Id int64 `json:"id"` // Unique identifier for the struct definition NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (STRUCT_DEFINITION for struct definition) Src SrcNode `json:"src"` // Source information about the struct definition Name string `json:"name"` // Name of the struct NameLocation SrcNode `json:"nameLocation"` // Source information about the name of the struct CanonicalName string `json:"canonicalName"` // Canonical name of the struct ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration of the struct definition TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the struct definition Members []Node[NodeType] `json:"members"` // Members of the struct definition Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the struct definition StorageLocation ast_pb.StorageLocation `json:"storageLocation"` // Storage location of the struct definition }
StructDefinition represents a struct definition in the Solidity abstract syntax tree (AST).
func NewStructDefinition ¶
func NewStructDefinition(b *ASTBuilder) *StructDefinition
NewStructDefinition creates a new StructDefinition instance.
func (*StructDefinition) GetCanonicalName ¶
func (s *StructDefinition) GetCanonicalName() string
GetCanonicalName returns the canonical name of the struct definition.
func (*StructDefinition) GetId ¶
func (s *StructDefinition) GetId() int64
GetId returns the unique identifier of the struct definition.
func (*StructDefinition) GetMembers ¶
func (s *StructDefinition) GetMembers() []*Parameter
GetMembers returns the members of the struct definition.
func (*StructDefinition) GetName ¶
func (s *StructDefinition) GetName() string
GetName returns the name of the struct definition.
func (*StructDefinition) GetNameLocation ¶
func (s *StructDefinition) GetNameLocation() SrcNode
GetNameLocation returns the source information about the name of the struct definition.
func (*StructDefinition) GetNodes ¶
func (s *StructDefinition) GetNodes() []Node[NodeType]
GetNodes returns the members of the struct definition.
func (*StructDefinition) GetReferencedDeclaration ¶
func (s *StructDefinition) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the struct definition.
func (*StructDefinition) GetSourceUnitName ¶
func (s *StructDefinition) GetSourceUnitName() string
GetSourceUnitName returns the name of the source unit.
func (*StructDefinition) GetSrc ¶
func (s *StructDefinition) GetSrc() SrcNode
GetSrc returns the source information about the struct definition.
func (*StructDefinition) GetStorageLocation ¶
func (s *StructDefinition) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the struct definition.
func (*StructDefinition) GetType ¶
func (s *StructDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'STRUCT_DEFINITION' for a struct definition.
func (*StructDefinition) GetTypeDescription ¶
func (s *StructDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the struct definition.
func (*StructDefinition) GetVisibility ¶
func (s *StructDefinition) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the struct definition.
func (*StructDefinition) Parse ¶
func (s *StructDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.StructDefinitionContext, ) Node[NodeType]
Parse parses a struct definition from the provided parser.StructDefinitionContext and returns the corresponding StructDefinition.
func (*StructDefinition) ParseGlobal ¶ added in v0.3.1
func (s *StructDefinition) ParseGlobal( ctx *parser.StructDefinitionContext, ) Node[NodeType]
ParseGlobal parses a struct definition from the provided parser.StructDefinitionContext and returns the corresponding StructDefinition.
func (*StructDefinition) SetReferenceDescriptor ¶
func (s *StructDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the StructDefinition node.
func (*StructDefinition) ToProto ¶
func (s *StructDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the struct definition.
func (*StructDefinition) UnmarshalJSON ¶ added in v0.3.1
func (s *StructDefinition) UnmarshalJSON(data []byte) error
type Symbol ¶
type Symbol struct { Id int64 `json:"id"` // Unique identifier for the symbol Name string `json:"name"` // Name of the symbol AbsolutePath string `json:"absolute_path"` // Absolute path to the symbol }
Symbol represents a symbol in the Solidity abstract syntax tree (AST).
func (Symbol) GetAbsolutePath ¶
GetAbsolutePath returns the absolute path to the symbol.
type Tree ¶
type Tree struct { *ASTBuilder // contains filtered or unexported fields }
Tree is a structure that represents an Abstract Syntax Tree (AST). It contains a reference to an ASTBuilder and the root node of the AST.
func NewTree ¶
func NewTree(b *ASTBuilder) *Tree
NewTree creates a new Tree with the provided ASTBuilder.
func (*Tree) AppendGlobalNodes ¶ added in v0.3.1
func (*Tree) AppendRootNodes ¶
func (t *Tree) AppendRootNodes(roots ...*SourceUnit[Node[ast_pb.SourceUnit]])
AppendRootNodes appends the provided SourceUnit nodes to the root node of the AST.
func (*Tree) ExecuteCustomTypeVisit ¶ added in v0.3.2
func (t *Tree) ExecuteCustomTypeVisit(nodes []Node[NodeType], nodeType ast_pb.NodeType, visitFunc func(node Node[NodeType]) (bool, error)) (bool, error)
ExecuteCustomTypeVisit executes a visitation function on all nodes of a specific type in a provided slice of nodes.
func (*Tree) ExecuteTypeVisit ¶ added in v0.3.2
func (t *Tree) ExecuteTypeVisit(nodeType ast_pb.NodeType, visitFunc func(node Node[NodeType]) (bool, error)) (bool, error)
ExecuteTypeVisit executes a visitation function on all nodes of a specific type in the AST, starting from the root.
func (*Tree) GetById ¶
GetById attempts to find a node in the AST by its ID. It performs a recursive search through all nodes in the AST. Returns the found Node or nil if the node cannot be found.
func (*Tree) UpdateNodeReferenceById ¶
func (t *Tree) UpdateNodeReferenceById(nodeId int64, nodeRefId int64, typeRef *TypeDescription) bool
UpdateNodeReferenceById attempts to update the reference descriptor of a node in the AST by its ID. It performs a recursive search through all nodes in the AST. Returns true if the node was found and updated, false otherwise.
func (*Tree) Walk ¶ added in v0.3.2
func (t *Tree) Walk(visitor *NodeVisitor) error
Walk initiates the traversal of the AST from its root, using the provided NodeVisitor. It processes the AST nodes based on the visitation functions defined in the visitor.
type TryStatement ¶
type TryStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the TryStatement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Src SrcNode `json:"src"` // Source location information. Body *BodyNode `json:"body"` // Body of the try block. Kind ast_pb.NodeType `json:"kind"` // Kind of try statement. Returns bool `json:"returns"` // True if the try statement returns. ReturnParameters *ParameterList `json:"returnParameters"` // Return parameters of the try statement. Expression Node[NodeType] `json:"expression"` // Expression within the try block. Clauses []Node[NodeType] `json:"clauses"` // List of catch clauses. Implemented bool `json:"implemented"` // True if the try statement is implemented. }
TryStatement represents a try-catch statement in the AST.
func NewTryStatement ¶
func NewTryStatement(b *ASTBuilder) *TryStatement
NewTryStatement creates a new TryStatement node with a given ASTBuilder.
func (*TryStatement) GetBody ¶
func (t *TryStatement) GetBody() *BodyNode
GetBody returns the body of the TryStatement node.
func (*TryStatement) GetClauses ¶
func (t *TryStatement) GetClauses() []Node[NodeType]
GetClauses returns the list of catch clauses.
func (*TryStatement) GetExpression ¶
func (t *TryStatement) GetExpression() Node[NodeType]
GetExpression returns the expression within the try block.
func (*TryStatement) GetId ¶
func (t *TryStatement) GetId() int64
GetId returns the ID of the TryStatement node.
func (*TryStatement) GetKind ¶
func (t *TryStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the try statement.
func (*TryStatement) GetNodes ¶
func (t *TryStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the TryStatement node.
func (*TryStatement) GetReturnParameters ¶ added in v0.3.1
func (t *TryStatement) GetReturnParameters() *ParameterList
GetReturnParameters returns the return parameters of the try statement.
func (*TryStatement) GetReturns ¶ added in v0.3.1
func (t *TryStatement) GetReturns() bool
GetReturns returns true if the try statement returns.
func (*TryStatement) GetSrc ¶
func (t *TryStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the TryStatement node.
func (*TryStatement) GetType ¶
func (t *TryStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the TryStatement node.
func (*TryStatement) GetTypeDescription ¶
func (t *TryStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the TryStatement node.
func (*TryStatement) IsImplemented ¶ added in v0.3.1
func (t *TryStatement) IsImplemented() bool
GetImplemented returns true if the try statement is implemented.
func (*TryStatement) Parse ¶
func (t *TryStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.TryStatementContext, ) Node[NodeType]
Parse parses a try-catch statement context into the TryStatement node.
func (*TryStatement) SetReferenceDescriptor ¶
func (t *TryStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TryStatement node.
func (*TryStatement) ToProto ¶
func (t *TryStatement) ToProto() NodeType
ToProto returns a protobuf representation of the TryStatement node.
func (*TryStatement) UnmarshalJSON ¶ added in v0.3.1
func (t *TryStatement) UnmarshalJSON(data []byte) error
MarshalJSON marshals the TryStatement node into a JSON byte slice.
type TupleExpression ¶
type TupleExpression struct { *ASTBuilder // Embedding the ASTBuilder to provide common functionality Id int64 `json:"id"` // Unique identifier for the tuple expression NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node (TUPLE_EXPRESSION for a tuple expression) Src SrcNode `json:"src"` // Source information about the tuple expression Constant bool `json:"isConstant"` // Whether the tuple expression is constant Pure bool `json:"isPure"` // Whether the tuple expression is pure Components []Node[NodeType] `json:"components"` // Components of the tuple expression ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration of the tuple expression TypeDescription *TypeDescription `json:"typeDescription"` // Type description of the tuple expression }
TupleExpression represents a tuple expression in Solidity.
func NewTupleExpression ¶
func NewTupleExpression(b *ASTBuilder) *TupleExpression
NewTupleExpression creates a new TupleExpression instance.
func (*TupleExpression) GetComponents ¶
func (t *TupleExpression) GetComponents() []Node[NodeType]
GetComponents returns the components of the tuple expression.
func (*TupleExpression) GetId ¶
func (t *TupleExpression) GetId() int64
GetId returns the unique identifier of the tuple expression.
func (*TupleExpression) GetNodes ¶
func (t *TupleExpression) GetNodes() []Node[NodeType]
GetNodes returns the components of the tuple expression.
func (*TupleExpression) GetReferencedDeclaration ¶
func (t *TupleExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the tuple expression.
func (*TupleExpression) GetSrc ¶
func (t *TupleExpression) GetSrc() SrcNode
GetSrc returns the source information about the tuple expression.
func (*TupleExpression) GetType ¶
func (t *TupleExpression) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'TUPLE_EXPRESSION' for a tuple expression.
func (*TupleExpression) GetTypeDescription ¶
func (t *TupleExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the tuple expression.
func (*TupleExpression) IsConstant ¶
func (t *TupleExpression) IsConstant() bool
IsConstant returns whether the tuple expression is constant.
func (*TupleExpression) IsPure ¶
func (t *TupleExpression) IsPure() bool
IsPure returns whether the tuple expression is pure.
func (*TupleExpression) Parse ¶
func (t *TupleExpression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, exprNode Node[NodeType], ctx *parser.TupleContext, ) Node[NodeType]
Parse parses a tuple expression from the provided parser.TupleContext and returns the corresponding TupleExpression.
func (*TupleExpression) SetReferenceDescriptor ¶
func (t *TupleExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TupleExpression node.
func (*TupleExpression) ToProto ¶
func (t *TupleExpression) ToProto() NodeType
ToProto returns the protobuf representation of the tuple expression.
func (*TupleExpression) UnmarshalJSON ¶ added in v0.3.1
func (t *TupleExpression) UnmarshalJSON(data []byte) error
MarshalJSON marshals the TupleExpression node into a JSON byte slice.
type TypeDescription ¶
type TypeDescription struct { TypeIdentifier string `json:"typeIdentifier"` TypeString string `json:"typeString"` }
TypeDescription represents a description of a type.
func (*TypeDescription) GetIdentifier ¶
func (td *TypeDescription) GetIdentifier() string
GetIdentifier returns the type identifier of the TypeDescription.
func (*TypeDescription) GetString ¶
func (td *TypeDescription) GetString() string
GetString returns the type string of the TypeDescription.
func (TypeDescription) ToProto ¶
func (td TypeDescription) ToProto() *ast_pb.TypeDescription
ToProto converts the TypeDescription instance to its corresponding protocol buffer representation.
type TypeName ¶
type TypeName struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` Name string `json:"name,omitempty"` KeyType *TypeName `json:"keyType,omitempty"` KeyNameLocation *SrcNode `json:"keyNameLocation,omitempty"` ValueType *TypeName `json:"valueType,omitempty"` ValueNameLocation *SrcNode `json:"valueNameLocation,omitempty"` PathNode *PathNode `json:"pathNode,omitempty"` StateMutability ast_pb.Mutability `json:"stateMutability,omitempty"` ReferencedDeclaration int64 `json:"referencedDeclaration"` Expression Node[NodeType] `json:"expression,omitempty"` TypeDescription *TypeDescription `json:"typeDescription,omitempty"` // Helper parents so we can efficiently extract references if needed without // having to traverse whole AST. ParentNode []Node[NodeType] `json:"-"` ParentBody *BodyNode `json:"-"` ParentParameterList Node[*ast_pb.ParameterList] `json:"-"` }
TypeName represents a type name used in Solidity code.
func NewTypeName ¶
func NewTypeName(b *ASTBuilder) *TypeName
NewTypeName creates a new TypeName instance with the given ASTBuilder.
func (*TypeName) GetExpression ¶ added in v0.3.1
GetExpression returns the expression associated with the TypeName.
func (*TypeName) GetKeyNameLocation ¶
GetKeyNameLocation returns the key name location of the KeyTypeName.
func (*TypeName) GetKeyType ¶
GetKeyType returns the key type for mapping types.
func (*TypeName) GetNodes ¶
GetNodes returns a list of child nodes for traversal within the TypeName.
func (*TypeName) GetPathNode ¶
GetPathNode returns the path node associated with the TypeName.
func (*TypeName) GetReferencedDeclaration ¶
GetReferencedDeclaration returns the referenced declaration of the TypeName.
func (*TypeName) GetStateMutability ¶
func (t *TypeName) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the TypeName.
func (*TypeName) GetTypeDescription ¶
func (t *TypeName) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the TypeName.
func (*TypeName) GetValueNameLocation ¶
GetValueNameLocation returns the value name location of the ValueTypeName.
func (*TypeName) GetValueType ¶
GetValueType returns the value type for mapping types.
func (*TypeName) Parse ¶
func (t *TypeName) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], parentNodeId int64, ctx parser.ITypeNameContext)
Parse parses the TypeName from the given TypeNameContext.
func (*TypeName) ParseElementaryType ¶
func (t *TypeName) ParseElementaryType(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], parentNodeId int64, ctx parser.IElementaryTypeNameContext)
ParseElementaryType parses the ElementaryTypeName from the given ElementaryTypeNameContext.
func (*TypeName) ParseMul ¶ added in v0.3.1
func (t *TypeName) ParseMul(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], parentNodeId int64, ctx antlr.TerminalNode)
ParseMul parses the TypeName from the given TermalNode.
func (*TypeName) SetReferenceDescriptor ¶
func (t *TypeName) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TypeName node.
func (*TypeName) StorageSize ¶ added in v0.3.2
StorageSize calculates and returns the storage size requirement of the type represented by the TypeName instance, in bits. It also returns a boolean indicating whether the size calculation is exact or an approximation. The function covers elementary types, mappings, function types, user-defined types, and identifiers, with special handling for each category.
func (*TypeName) ToProto ¶
ToProto converts the TypeName instance to its corresponding protocol buffer representation.
func (*TypeName) UnmarshalJSON ¶ added in v0.3.1
func (*TypeName) WithBodyNode ¶ added in v0.3.1
WithBodyNode sets the body node associated with TypeName.
func (*TypeName) WithParameterList ¶ added in v0.3.1
func (t *TypeName) WithParameterList(p Node[*ast_pb.ParameterList])
WithParameterList sets the parameter list associated with TypeName.
func (*TypeName) WithParentNode ¶ added in v0.3.1
WithParentNode sets the parent node associated with TypeName.
type UnaryPrefix ¶
type UnaryPrefix struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Kind ast_pb.NodeType `json:"kind"` Src SrcNode `json:"src"` Operator ast_pb.Operator `json:"operator"` Prefix bool `json:"prefix"` Constant bool `json:"isConstant"` LValue bool `json:"isLValue"` Pure bool `json:"isPure"` LValueRequested bool `json:"lValueRequested"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` Expression Node[NodeType] `json:"expression"` TypeDescription *TypeDescription `json:"typeDescription"` }
UnaryPrefix represents a unary operation applied as a prefix to an expression.
func NewUnaryPrefixExpression ¶
func NewUnaryPrefixExpression(b *ASTBuilder) *UnaryPrefix
NewUnaryPrefixExpression creates a new UnaryPrefix instance with the given ASTBuilder.
func (*UnaryPrefix) GetExpression ¶
func (u *UnaryPrefix) GetExpression() Node[NodeType]
GetExpression returns the expression to which the unary operation is applied.
func (*UnaryPrefix) GetId ¶
func (u *UnaryPrefix) GetId() int64
GetId returns the unique identifier of the UnaryPrefix.
func (*UnaryPrefix) GetKind ¶ added in v0.3.1
func (u *UnaryPrefix) GetKind() ast_pb.NodeType
GetKind returns the node type of the UnaryPrefix.
func (*UnaryPrefix) GetNodes ¶
func (u *UnaryPrefix) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UnaryPrefix.
func (*UnaryPrefix) GetOperator ¶
func (u *UnaryPrefix) GetOperator() ast_pb.Operator
GetOperator returns the unary operator applied to the expression.
func (*UnaryPrefix) GetPrefix ¶
func (u *UnaryPrefix) GetPrefix() bool
GetPrefix returns true if the unary operation is a prefix operation.
func (*UnaryPrefix) GetReferencedDeclaration ¶
func (u *UnaryPrefix) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UnaryPrefix.
func (*UnaryPrefix) GetSrc ¶
func (u *UnaryPrefix) GetSrc() SrcNode
GetSrc returns the source location information of the UnaryPrefix.
func (*UnaryPrefix) GetType ¶
func (u *UnaryPrefix) GetType() ast_pb.NodeType
GetType returns the node type of the UnaryPrefix.
func (*UnaryPrefix) GetTypeDescription ¶
func (u *UnaryPrefix) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UnaryPrefix.
func (*UnaryPrefix) IsConstant ¶
func (u *UnaryPrefix) IsConstant() bool
IsConstant returns true if the operation's result is a constant.
func (*UnaryPrefix) IsLValue ¶
func (u *UnaryPrefix) IsLValue() bool
IsLValue returns true if the expression is an l-value.
func (*UnaryPrefix) IsLValueRequested ¶
func (u *UnaryPrefix) IsLValueRequested() bool
IsLValueRequested returns true if an l-value is requested from the operation.
func (*UnaryPrefix) IsPure ¶
func (u *UnaryPrefix) IsPure() bool
IsPure returns true if the operation is pure, i.e., it doesn't modify state.
func (*UnaryPrefix) Parse ¶
func (u *UnaryPrefix) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.UnaryPrefixOperationContext, ) Node[NodeType]
Parse populates the UnaryPrefix instance with information parsed from the provided contexts.
func (*UnaryPrefix) SetReferenceDescriptor ¶
func (u *UnaryPrefix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UnaryPrefix node.
func (*UnaryPrefix) ToProto ¶
func (u *UnaryPrefix) ToProto() NodeType
ToProto converts the UnaryPrefix instance to its corresponding protocol buffer representation.
func (*UnaryPrefix) UnmarshalJSON ¶ added in v0.3.1
func (u *UnaryPrefix) UnmarshalJSON(data []byte) error
type UnarySuffix ¶
type UnarySuffix struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Kind ast_pb.NodeType `json:"kind"` Src SrcNode `json:"src"` Operator ast_pb.Operator `json:"operator"` Expression Node[NodeType] `json:"expression"` ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` TypeDescription *TypeDescription `json:"typeDescription"` Prefix bool `json:"prefix"` Constant bool `json:"isConstant"` LValue bool `json:"isLValue"` Pure bool `json:"isPure"` LValueRequested bool `json:"lValueRequested"` }
UnarySuffix represents a unary operation applied as a suffix to an expression.
func NewUnarySuffixExpression ¶
func NewUnarySuffixExpression(b *ASTBuilder) *UnarySuffix
NewUnarySuffixExpression creates a new UnarySuffix instance with the given ASTBuilder.
func (*UnarySuffix) GetExpression ¶
func (u *UnarySuffix) GetExpression() Node[NodeType]
GetExpression returns the expression to which the unary operation is applied.
func (*UnarySuffix) GetId ¶
func (u *UnarySuffix) GetId() int64
GetId returns the unique identifier of the UnarySuffix.
func (*UnarySuffix) GetKind ¶ added in v0.3.1
func (u *UnarySuffix) GetKind() ast_pb.NodeType
GetKind returns the kind of the UnarySuffix.
func (*UnarySuffix) GetNodes ¶
func (u *UnarySuffix) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UnarySuffix.
func (*UnarySuffix) GetOperator ¶
func (u *UnarySuffix) GetOperator() ast_pb.Operator
GetOperator returns the unary operator applied to the expression.
func (*UnarySuffix) GetPrefix ¶
func (u *UnarySuffix) GetPrefix() bool
GetPrefix returns true if the unary operation is a prefix operation.
func (*UnarySuffix) GetReferencedDeclaration ¶
func (u *UnarySuffix) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UnarySuffix.
func (*UnarySuffix) GetSrc ¶
func (u *UnarySuffix) GetSrc() SrcNode
GetSrc returns the source location information of the UnarySuffix.
func (*UnarySuffix) GetType ¶
func (u *UnarySuffix) GetType() ast_pb.NodeType
GetType returns the node type of the UnarySuffix.
func (*UnarySuffix) GetTypeDescription ¶
func (u *UnarySuffix) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UnarySuffix.
func (*UnarySuffix) IsConstant ¶
func (u *UnarySuffix) IsConstant() bool
IsConstant returns true if the operation's result is a constant.
func (*UnarySuffix) IsLValue ¶
func (u *UnarySuffix) IsLValue() bool
IsLValue returns true if the expression is an l-value.
func (*UnarySuffix) IsLValueRequested ¶
func (u *UnarySuffix) IsLValueRequested() bool
IsLValueRequested returns true if an l-value is requested from the operation.
func (*UnarySuffix) IsPure ¶
func (u *UnarySuffix) IsPure() bool
IsPure returns true if the operation is pure, i.e., it doesn't modify state.
func (*UnarySuffix) Parse ¶
func (u *UnarySuffix) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.UnarySuffixOperationContext, ) Node[NodeType]
Parse populates the UnarySuffix instance with information parsed from the provided contexts.
func (*UnarySuffix) SetReferenceDescriptor ¶
func (u *UnarySuffix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UnarySuffix node.
func (*UnarySuffix) ToProto ¶
func (u *UnarySuffix) ToProto() NodeType
ToProto converts the UnarySuffix instance to its corresponding protocol buffer representation.
func (*UnarySuffix) UnmarshalJSON ¶ added in v0.3.1
func (u *UnarySuffix) UnmarshalJSON(data []byte) error
type UnprocessedNode ¶
type UnprocessedNode struct { Id int64 `json:"id"` Name string `json:"name"` Node Node[NodeType] `json:"ref"` ErrFindRef bool `json:"error_find_ref"` ErrUpdateRef bool `json:"error_update_ref"` }
UnprocessedNode is a structure that represents a node that could not be processed during the parsing of the AST.
type UserDefinedValueTypeDefinition ¶ added in v0.3.1
type UserDefinedValueTypeDefinition struct { *ASTBuilder // Embedding ASTBuilder for building the AST. Id int64 `json:"id"` // Unique identifier for this node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node, representing a user-defined value type. Src SrcNode `json:"src"` // Source information about the node. Is bool `json:"is"` // Additional flag (needs more contextual detail). Type string `json:"type"` // Type name for the user-defined value type. TypeLocation SrcNode `json:"typeLocation"` // Source location for the type. Name string `json:"name"` // Name of the user-defined value type. NameLocation SrcNode `json:"nameLocation"` // Source location for the name. TypeName *TypeName `json:"typeName"` // AST node representing the type's name. ReferencedDeclaration int64 `json:"referencedDeclaration,omitempty"` // Referenced declaration (if any). TypeDescription *TypeDescription `json:"typeDescription"` // Description of the type. }
UserDefinedValueTypeDefinition represents a user-defined value type in Solidity.
func NewUserDefinedValueTypeDefinition ¶ added in v0.3.1
func NewUserDefinedValueTypeDefinition(b *ASTBuilder) *UserDefinedValueTypeDefinition
NewUserDefinedValueTypeDefinition creates a new UserDefinedValueTypeDefinition instance.
func (*UserDefinedValueTypeDefinition) GetId ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetId() int64
GetId returns the unique identifier of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetIs ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetIs() bool
GetIs returns the additional flag of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetName ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetName() string
GetName returns the name of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetNameLocation ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetNameLocation() SrcNode
GetNameLocation returns the source location of the name of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetNodes ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetReferencedDeclaration ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the type name in the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetSrc ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetSrc() SrcNode
GetSrc returns the source information about the node, such as its line and column numbers in the source file.
func (*UserDefinedValueTypeDefinition) GetType ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'USER_DEFINED_VALUE_TYPE' for a UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetTypeDescription ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetTypeLocation ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetTypeLocation() SrcNode
GetTypeLocation returns the source location of the type name of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetTypeName ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetTypeName() *TypeName
GetTypeName returns the type name of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) GetUserType ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) GetUserType() string
GetUserType returns the type name of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) Parse ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.UserDefinedValueTypeDefinitionContext, ) Node[NodeType]
Parse populates the UserDefinedValueTypeDefinition fields using the provided parser context.
func (*UserDefinedValueTypeDefinition) ParseGlobal ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) ParseGlobal( ctx *parser.UserDefinedValueTypeDefinitionContext, ) Node[NodeType]
ParseGlobal populates the UserDefinedValueTypeDefinition fields using the provided parser context.
func (*UserDefinedValueTypeDefinition) SetReferenceDescriptor ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UserDefinedValueTypeDefinition node.
func (*UserDefinedValueTypeDefinition) ToProto ¶ added in v0.3.1
func (b *UserDefinedValueTypeDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the UserDefinedValueTypeDefinition node.
type UsingDirective ¶
type UsingDirective struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` TypeDescription *TypeDescription `json:"typeDescription"` TypeName *TypeName `json:"typeName"` LibraryName *LibraryName `json:"libraryName"` }
UsingDirective represents a Solidity using directive, which is used to import and use symbols from external libraries.
func NewUsingDirective ¶
func NewUsingDirective(b *ASTBuilder) *UsingDirective
NewUsingDirective creates a new UsingDirective instance with the given ASTBuilder.
func (*UsingDirective) GetId ¶
func (u *UsingDirective) GetId() int64
GetId returns the unique identifier of the UsingDirective.
func (*UsingDirective) GetLibraryName ¶
func (u *UsingDirective) GetLibraryName() *LibraryName
GetLibraryName returns the library name associated with the UsingDirective.
func (*UsingDirective) GetNodes ¶
func (u *UsingDirective) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UsingDirective.
func (*UsingDirective) GetPathNode ¶
func (u *UsingDirective) GetPathNode() *PathNode
GetPathNode returns the path node associated with the UsingDirective.
func (*UsingDirective) GetReferencedDeclaration ¶
func (u *UsingDirective) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UsingDirective.
func (*UsingDirective) GetSrc ¶
func (u *UsingDirective) GetSrc() SrcNode
GetSrc returns the source location information of the UsingDirective.
func (*UsingDirective) GetType ¶
func (u *UsingDirective) GetType() ast_pb.NodeType
GetType returns the node type of the UsingDirective.
func (*UsingDirective) GetTypeDescription ¶
func (u *UsingDirective) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UsingDirective.
func (*UsingDirective) GetTypeName ¶
func (u *UsingDirective) GetTypeName() *TypeName
GetTypeName returns the type name associated with the UsingDirective.
func (*UsingDirective) Parse ¶
func (u *UsingDirective) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], bodyCtx parser.IContractBodyElementContext, ctx *parser.UsingDirectiveContext, )
Parse populates the UsingDirective instance with information parsed from the provided contexts.
func (*UsingDirective) SetReferenceDescriptor ¶
func (u *UsingDirective) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UsingDirective node.
func (*UsingDirective) ToProto ¶
func (u *UsingDirective) ToProto() NodeType
ToProto converts the UsingDirective instance to its corresponding protocol buffer representation.
type VariableDeclaration ¶
type VariableDeclaration struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier of the variable declaration node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node. Src SrcNode `json:"src"` // Source location information. Assignments []int64 `json:"assignments"` // List of assignment identifiers. Declarations []*Declaration `json:"declarations"` // List of declaration nodes. InitialValue Node[NodeType] `json:"initialValue,omitempty"` // Initial value node. }
VariableDeclaration represents a variable declaration node in the abstract syntax tree.
func NewVariableDeclarationStatement ¶
func NewVariableDeclarationStatement(b *ASTBuilder) *VariableDeclaration
NewVariableDeclarationStatement creates a new instance of VariableDeclaration with the provided ASTBuilder.
func (*VariableDeclaration) GetAssignments ¶
func (v *VariableDeclaration) GetAssignments() []int64
GetAssignments returns a list of assignment identifiers associated with the variable declaration.
func (*VariableDeclaration) GetDeclarations ¶
func (v *VariableDeclaration) GetDeclarations() []*Declaration
GetDeclarations returns a list of declaration nodes associated with the variable declaration.
func (*VariableDeclaration) GetId ¶
func (v *VariableDeclaration) GetId() int64
GetId returns the unique identifier of the variable declaration node.
func (*VariableDeclaration) GetInitialValue ¶
func (v *VariableDeclaration) GetInitialValue() Node[NodeType]
GetInitialValue returns the initial value node associated with the variable declaration.
func (*VariableDeclaration) GetNodes ¶
func (v *VariableDeclaration) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the variable declaration (initial value and declarations).
func (*VariableDeclaration) GetSrc ¶
func (v *VariableDeclaration) GetSrc() SrcNode
GetSrc returns the source location information of the variable declaration node.
func (*VariableDeclaration) GetType ¶
func (v *VariableDeclaration) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*VariableDeclaration) GetTypeDescription ¶
func (v *VariableDeclaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the variable declaration.
func (*VariableDeclaration) Parse ¶
func (v *VariableDeclaration) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.VariableDeclarationStatementContext, )
Parse parses the variable declaration statement context and populates the VariableDeclaration fields.
func (*VariableDeclaration) SetReferenceDescriptor ¶
func (v *VariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the VariableDeclaration node.
func (*VariableDeclaration) ToProto ¶
func (v *VariableDeclaration) ToProto() NodeType
ToProto converts the VariableDeclaration node to its corresponding protobuf representation.
func (*VariableDeclaration) UnmarshalJSON ¶ added in v0.3.1
func (v *VariableDeclaration) UnmarshalJSON(data []byte) error
type WhileStatement ¶
type WhileStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the WhileStatement node. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the AST node. Kind ast_pb.NodeType `json:"kind"` // Kind of while loop. Src SrcNode `json:"src"` // Source location information. Condition Node[NodeType] `json:"condition"` // Condition expression of the while loop. Body *BodyNode `json:"body"` // Body of the while loop. }
WhileStatement represents a while loop statement in the AST.
func NewWhileStatement ¶
func NewWhileStatement(b *ASTBuilder) *WhileStatement
NewWhileStatement creates a new WhileStatement node with a given ASTBuilder.
func (*WhileStatement) GetBody ¶
func (w *WhileStatement) GetBody() *BodyNode
GetBody returns the body of the WhileStatement node.
func (*WhileStatement) GetCondition ¶
func (w *WhileStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression of the WhileStatement node.
func (*WhileStatement) GetId ¶
func (w *WhileStatement) GetId() int64
GetId returns the ID of the WhileStatement node.
func (*WhileStatement) GetKind ¶
func (w *WhileStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the while loop.
func (*WhileStatement) GetNodes ¶
func (w *WhileStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the WhileStatement node.
func (*WhileStatement) GetSrc ¶
func (w *WhileStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the WhileStatement node.
func (*WhileStatement) GetType ¶
func (w *WhileStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the WhileStatement node.
func (*WhileStatement) GetTypeDescription ¶
func (w *WhileStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the WhileStatement node.
func (*WhileStatement) Parse ¶
func (w *WhileStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.WhileStatementContext, ) Node[NodeType]
Parse parses a while loop statement context into the WhileStatement node.
func (*WhileStatement) SetReferenceDescriptor ¶
func (w *WhileStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the WhileStatement node.
func (*WhileStatement) ToProto ¶
func (w *WhileStatement) ToProto() NodeType
ToProto returns a protobuf representation of the WhileStatement node.
func (*WhileStatement) UnmarshalJSON ¶ added in v0.3.1
func (w *WhileStatement) UnmarshalJSON(data []byte) error
type Yul ¶ added in v0.3.1
type Yul struct { *ASTBuilder // Embedded ASTBuilder provides building functionalities for AST nodes. Id int64 `json:"id"` // Id uniquely identifies the assembly statement. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType specifies the type of the node. Src SrcNode `json:"src"` // Src contains source location details of the node. Body *BodyNode `json:"body"` // Body represents the content of the assembly statement. }
Yul represents an assembly statement in a Solidity source file.
func NewYul ¶ added in v0.3.1
func NewYul(b *ASTBuilder) *Yul
NewYul creates a new Yul and initializes its fields.
func (*Yul) GetNodes ¶ added in v0.3.1
GetNodes retrieves the list of statements present in the assembly statement's body.
func (*Yul) GetType ¶ added in v0.3.1
GetType returns the type of the node. For Yul, this is always NodeType_ASSEMBLY_STATEMENT.
func (*Yul) GetTypeDescription ¶ added in v0.3.1
func (a *Yul) GetTypeDescription() *TypeDescription
GetTypeDescription provides a description of the assembly statement's type. For Yul, this always returns an empty TypeDescription.
func (*Yul) Parse ¶ added in v0.3.1
func (a *Yul) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.AssemblyStatementContext, ) Node[NodeType]
Parse populates the Yul fields by parsing the provided AssemblyStatementContext. It processes the context to generate the body of the assembly statement and its constituent statements.
func (*Yul) SetReferenceDescriptor ¶ added in v0.3.1
func (a *Yul) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor is a placeholder method which currently always returns false. Future implementations might set a reference descriptor based on provided arguments.
type YulAssignment ¶ added in v0.3.1
type YulAssignment struct { *ASTBuilder Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Src SrcNode `json:"src"` VariableNames []*YulIdentifier `json:"variableNames"` Value Node[NodeType] `json:"value"` }
YulAssignment represents a Yul assignment structure in the AST.
func NewYulAssignment ¶ added in v0.3.1
func NewYulAssignment(b *ASTBuilder) *YulAssignment
NewYulAssignment initializes a new instance of the YulAssignment structure.
func (*YulAssignment) GetId ¶ added in v0.3.1
func (y *YulAssignment) GetId() int64
GetId retrieves the ID of the YulAssignment node.
func (*YulAssignment) GetNodes ¶ added in v0.3.1
func (y *YulAssignment) GetNodes() []Node[NodeType]
GetNodes retrieves the child nodes of the YulAssignment node.
func (*YulAssignment) GetSrc ¶ added in v0.3.1
func (y *YulAssignment) GetSrc() SrcNode
GetSrc retrieves the source of the YulAssignment node.
func (*YulAssignment) GetType ¶ added in v0.3.1
func (y *YulAssignment) GetType() ast_pb.NodeType
GetType retrieves the NodeType of the YulAssignment node.
func (*YulAssignment) GetTypeDescription ¶ added in v0.3.1
func (y *YulAssignment) GetTypeDescription() *TypeDescription
GetTypeDescription retrieves the type description of the YulAssignment node. It currently returns an empty TypeDescription, and is a placeholder for future extensions.
func (*YulAssignment) GetValue ¶ added in v0.3.1
func (y *YulAssignment) GetValue() Node[NodeType]
GetValue retrieves the value assigned in the YulAssignment node.
func (*YulAssignment) GetVariableNames ¶ added in v0.3.1
func (y *YulAssignment) GetVariableNames() []*YulIdentifier
GetVariableNames retrieves the variable names associated with the YulAssignment node.
func (*YulAssignment) Parse ¶ added in v0.3.1
func (y *YulAssignment) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulAssignmentContext, ) Node[NodeType]
Parse parses a given YulAssignmentContext into the YulAssignment node.
func (*YulAssignment) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulAssignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulAssignment node. It currently always returns false, and is a placeholder for future extensions.
func (*YulAssignment) ToProto ¶ added in v0.3.1
func (y *YulAssignment) ToProto() NodeType
ToProto converts the YulAssignment node to its corresponding protocol buffer representation.
func (*YulAssignment) UnmarshalJSON ¶ added in v0.3.1
func (f *YulAssignment) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulAssignment node.
type YulBlockStatement ¶ added in v0.3.1
type YulBlockStatement struct { *ASTBuilder // Id is the unique identifier of the YUL block statement. Id int64 `json:"id"` // NodeType is the type of the YUL block statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL block statement. Src SrcNode `json:"src"` // Statements is a list of child nodes representing statements within the YUL block. Statements []Node[NodeType] `json:"statements"` }
YulBlockStatement represents a YUL block statement in the abstract syntax tree.
func NewYulBlockStatement ¶ added in v0.3.1
func NewYulBlockStatement(b *ASTBuilder) *YulBlockStatement
NewYulBlockStatement creates a new YulBlockStatement instance.
func (*YulBlockStatement) GetId ¶ added in v0.3.1
func (y *YulBlockStatement) GetId() int64
GetId returns the ID of the YulBlockStatement.
func (*YulBlockStatement) GetNodes ¶ added in v0.3.1
func (y *YulBlockStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the YulBlockStatement.
func (*YulBlockStatement) GetSrc ¶ added in v0.3.1
func (y *YulBlockStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulBlockStatement.
func (*YulBlockStatement) GetStatements ¶ added in v0.3.1
func (y *YulBlockStatement) GetStatements() []Node[NodeType]
GetStatements returns the list of statements within the YulBlockStatement.
func (*YulBlockStatement) GetType ¶ added in v0.3.1
func (y *YulBlockStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulBlockStatement.
func (*YulBlockStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulBlockStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulBlockStatement.
func (*YulBlockStatement) Parse ¶ added in v0.3.1
func (y *YulBlockStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ifStatement *parser.YulIfStatementContext, parentNode Node[NodeType], ctx *parser.YulBlockContext, ) Node[NodeType]
Parse parses a YulBlockStatement node.
func (*YulBlockStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulBlockStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulBlockStatement node.
func (*YulBlockStatement) ToProto ¶ added in v0.3.1
func (y *YulBlockStatement) ToProto() NodeType
ToProto converts the YulBlockStatement to its protocol buffer representation.
func (*YulBlockStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulBlockStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulBlockStatement node.
type YulBreakStatement ¶ added in v0.3.1
type YulBreakStatement struct { *ASTBuilder // Id is the unique identifier of the YUL break statement. Id int64 `json:"id"` // NodeType is the type of the YUL break statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL break statement. Src SrcNode `json:"src"` }
YulBreakStatement represents a YUL break statement in the abstract syntax tree.
func NewYulBreakStatement ¶ added in v0.3.1
func NewYulBreakStatement(b *ASTBuilder) *YulBreakStatement
NewYulBreakStatement creates a new YulBreakStatement instance.
func (*YulBreakStatement) GetId ¶ added in v0.3.1
func (y *YulBreakStatement) GetId() int64
GetId returns the ID of the YulBreakStatement.
func (*YulBreakStatement) GetNodes ¶ added in v0.3.1
func (y *YulBreakStatement) GetNodes() []Node[NodeType]
GetNodes returns an empty list of child nodes for the YulBreakStatement.
func (*YulBreakStatement) GetSrc ¶ added in v0.3.1
func (y *YulBreakStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulBreakStatement.
func (*YulBreakStatement) GetType ¶ added in v0.3.1
func (y *YulBreakStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulBreakStatement.
func (*YulBreakStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulBreakStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulBreakStatement.
func (*YulBreakStatement) Parse ¶ added in v0.3.1
func (y *YulBreakStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *antlr.TerminalNodeImpl, ) Node[NodeType]
Parse parses a YulBreakStatement node.
func (*YulBreakStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulBreakStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulBreakStatement node.
func (*YulBreakStatement) ToProto ¶ added in v0.3.1
func (y *YulBreakStatement) ToProto() NodeType
ToProto converts the YulBreakStatement to its protocol buffer representation.
type YulContinueStatement ¶ added in v0.3.1
type YulContinueStatement struct { *ASTBuilder // Id is the unique identifier of the YUL continue statement. Id int64 `json:"id"` // NodeType is the type of the YUL continue statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL continue statement. Src SrcNode `json:"src"` }
YulContinueStatement represents a YUL continue statement in the abstract syntax tree.
func NewYulContinueStatement ¶ added in v0.3.1
func NewYulContinueStatement(b *ASTBuilder) *YulContinueStatement
NewYulContinueStatement creates a new YulContinueStatement instance.
func (*YulContinueStatement) GetId ¶ added in v0.3.1
func (y *YulContinueStatement) GetId() int64
GetId returns the ID of the YulContinueStatement.
func (*YulContinueStatement) GetNodes ¶ added in v0.3.1
func (y *YulContinueStatement) GetNodes() []Node[NodeType]
GetNodes returns an empty list of child nodes for the YulContinueStatement.
func (*YulContinueStatement) GetSrc ¶ added in v0.3.1
func (y *YulContinueStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulContinueStatement.
func (*YulContinueStatement) GetType ¶ added in v0.3.1
func (y *YulContinueStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulContinueStatement.
func (*YulContinueStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulContinueStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulContinueStatement.
func (*YulContinueStatement) Parse ¶ added in v0.3.1
func (y *YulContinueStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *antlr.TerminalNodeImpl, ) Node[NodeType]
Parse parses a YulContinueStatement node.
func (*YulContinueStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulContinueStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulContinueStatement node.
func (*YulContinueStatement) ToProto ¶ added in v0.3.1
func (y *YulContinueStatement) ToProto() NodeType
ToProto converts the YulContinueStatement to its protocol buffer representation.
type YulExpressionStatement ¶ added in v0.3.1
type YulExpressionStatement struct { *ASTBuilder // Id is the unique identifier of the YUL expression statement. Id int64 `json:"id"` // NodeType is the type of the YUL expression statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL expression statement. Src SrcNode `json:"src"` // Expression is the expression node within the statement. Expression Node[NodeType] `json:"expression"` }
YulExpressionStatement represents a YUL expression statement in the abstract syntax tree.
func NewYulExpressionStatement ¶ added in v0.3.1
func NewYulExpressionStatement(b *ASTBuilder) *YulExpressionStatement
NewYulExpressionStatement creates a new YulExpressionStatement instance.
func (*YulExpressionStatement) GetExpression ¶ added in v0.3.1
func (y *YulExpressionStatement) GetExpression() Node[NodeType]
GetExpression returns the expression node within the statement.
func (*YulExpressionStatement) GetId ¶ added in v0.3.1
func (y *YulExpressionStatement) GetId() int64
GetId returns the ID of the YulExpressionStatement.
func (*YulExpressionStatement) GetNodes ¶ added in v0.3.1
func (y *YulExpressionStatement) GetNodes() []Node[NodeType]
GetNodes returns a list containing the expression node.
func (*YulExpressionStatement) GetSrc ¶ added in v0.3.1
func (y *YulExpressionStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulExpressionStatement.
func (*YulExpressionStatement) GetType ¶ added in v0.3.1
func (y *YulExpressionStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulExpressionStatement.
func (*YulExpressionStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulExpressionStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulExpressionStatement.
func (*YulExpressionStatement) Parse ¶ added in v0.3.1
func (y *YulExpressionStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, parentNode Node[NodeType], ctx *parser.YulExpressionContext, ) Node[NodeType]
Parse parses a YulExpressionStatement node.
func (*YulExpressionStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulExpressionStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulExpressionStatement node.
func (*YulExpressionStatement) ToProto ¶ added in v0.3.1
func (y *YulExpressionStatement) ToProto() NodeType
ToProto converts the YulExpressionStatement to its protocol buffer representation.
func (*YulExpressionStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulExpressionStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulExpressionStatement node.
type YulForStatement ¶ added in v0.3.1
type YulForStatement struct { *ASTBuilder // Id is the unique identifier of the YUL for statement. Id int64 `json:"id"` // NodeType is the type of the YUL for statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL for statement. Src SrcNode `json:"src"` // Pre is the initialization node before the loop. Pre Node[NodeType] `json:"pre"` // Post is the post-execution node after each iteration of the loop. Post Node[NodeType] `json:"post"` // Condition is the condition node of the loop. Condition Node[NodeType] `json:"condition"` // Body is the body of the loop. Body Node[NodeType] `json:"body"` }
YulForStatement represents a YUL for statement in the abstract syntax tree.
func NewYulForStatement ¶ added in v0.3.1
func NewYulForStatement(b *ASTBuilder) *YulForStatement
NewYulForStatement creates a new YulForStatement instance.
func (*YulForStatement) GetBody ¶ added in v0.3.1
func (y *YulForStatement) GetBody() Node[NodeType]
GetBody returns the body of the loop.
func (*YulForStatement) GetCondition ¶ added in v0.3.1
func (y *YulForStatement) GetCondition() Node[NodeType]
GetCondition returns the condition node of the loop.
func (*YulForStatement) GetId ¶ added in v0.3.1
func (y *YulForStatement) GetId() int64
GetId returns the ID of the YulForStatement.
func (*YulForStatement) GetNodes ¶ added in v0.3.1
func (y *YulForStatement) GetNodes() []Node[NodeType]
GetNodes returns a list containing the condition and body nodes.
func (*YulForStatement) GetPost ¶ added in v0.3.1
func (y *YulForStatement) GetPost() Node[NodeType]
GetPost returns the post-execution node after each iteration of the loop.
func (*YulForStatement) GetPre ¶ added in v0.3.1
func (y *YulForStatement) GetPre() Node[NodeType]
GetPre returns the initialization node before the loop.
func (*YulForStatement) GetSrc ¶ added in v0.3.1
func (y *YulForStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulForStatement.
func (*YulForStatement) GetType ¶ added in v0.3.1
func (y *YulForStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulForStatement.
func (*YulForStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulForStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulForStatement.
func (*YulForStatement) Parse ¶ added in v0.3.1
func (y *YulForStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulForStatementContext, ) Node[NodeType]
Parse parses a YUL for statement.
func (*YulForStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulForStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulForStatement node.
func (*YulForStatement) ToProto ¶ added in v0.3.1
func (y *YulForStatement) ToProto() NodeType
ToProto converts the YulForStatement to its protocol buffer representation.
func (*YulForStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulForStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulForStatement node.
type YulFunctionCallStatement ¶ added in v0.3.1
type YulFunctionCallStatement struct { *ASTBuilder // Id is the unique identifier of the YUL function call statement. Id int64 `json:"id"` // NodeType is the type of the YUL function call statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL function call statement. Src SrcNode `json:"src"` // FunctionName is the name of the function being called. FunctionName *YulIdentifier `json:"functionName"` // Arguments is a list of argument nodes for the function call. Arguments []Node[NodeType] `json:"arguments"` }
YulFunctionCallStatement represents a YUL function call statement in the abstract syntax tree.
func NewYulFunctionCallStatement ¶ added in v0.3.1
func NewYulFunctionCallStatement(b *ASTBuilder) *YulFunctionCallStatement
NewYulFunctionCallStatement creates a new YulFunctionCallStatement instance.
func (*YulFunctionCallStatement) GetArguments ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetArguments() []Node[NodeType]
GetArguments returns the list of argument nodes for the function call.
func (*YulFunctionCallStatement) GetFunctionName ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetFunctionName() *YulIdentifier
GetFunctionName returns the name of the function being called.
func (*YulFunctionCallStatement) GetId ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetId() int64
GetId returns the ID of the YulFunctionCallStatement.
func (*YulFunctionCallStatement) GetNodes ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetNodes() []Node[NodeType]
GetNodes returns a list containing the argument nodes.
func (*YulFunctionCallStatement) GetSrc ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulFunctionCallStatement.
func (*YulFunctionCallStatement) GetType ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulFunctionCallStatement.
func (*YulFunctionCallStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulFunctionCallStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulFunctionCallStatement.
func (*YulFunctionCallStatement) Parse ¶ added in v0.3.1
func (y *YulFunctionCallStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, parentNode Node[NodeType], ctx *parser.YulFunctionCallContext, ) Node[NodeType]
Parse parses a YUL function call statement.
func (*YulFunctionCallStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulFunctionCallStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulFunctionCallStatement node.
func (*YulFunctionCallStatement) ToProto ¶ added in v0.3.1
func (y *YulFunctionCallStatement) ToProto() NodeType
ToProto converts the YulFunctionCallStatement to its protocol buffer representation.
func (*YulFunctionCallStatement) UnmarshalJSON ¶ added in v0.3.1
func (y *YulFunctionCallStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulFunctionCallStatement node.
type YulFunctionDefinition ¶ added in v0.3.1
type YulFunctionDefinition struct { *ASTBuilder // Id is the unique identifier of the YUL function definition. Id int64 `json:"id"` // NodeType is the type of the YUL function definition node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL function definition. Src SrcNode `json:"src"` // Arguments is a list of YUL identifiers representing function arguments. Arguments []*YulIdentifier `json:"arguments"` // Body is the body of the YUL function definition. Body Node[NodeType] `json:"body"` // ReturnParameters is a list of YUL identifiers representing return parameters. ReturnParameters []*YulIdentifier `json:"returnParameters"` }
YulFunctionDefinition represents a YUL function definition in the abstract syntax tree.
func NewYulFunctionDefinition ¶ added in v0.3.1
func NewYulFunctionDefinition(b *ASTBuilder) *YulFunctionDefinition
NewYulFunctionDefinition creates a new YulFunctionDefinition instance.
func (*YulFunctionDefinition) GetArguments ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetArguments() []*YulIdentifier
GetArguments returns the list of YUL identifiers representing function arguments.
func (*YulFunctionDefinition) GetBody ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetBody() Node[NodeType]
GetBody returns the body of the YUL function definition.
func (*YulFunctionDefinition) GetId ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetId() int64
GetId returns the ID of the YulFunctionDefinition.
func (*YulFunctionDefinition) GetNodes ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetNodes() []Node[NodeType]
GetNodes returns a list containing the body node.
func (*YulFunctionDefinition) GetReturnParameters ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetReturnParameters() []*YulIdentifier
GetReturnParameters returns the list of YUL identifiers representing return parameters.
func (*YulFunctionDefinition) GetSrc ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetSrc() SrcNode
GetSrc returns the source information of the YulFunctionDefinition.
func (*YulFunctionDefinition) GetType ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulFunctionDefinition.
func (*YulFunctionDefinition) GetTypeDescription ¶ added in v0.3.1
func (y *YulFunctionDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulFunctionDefinition.
func (*YulFunctionDefinition) Parse ¶ added in v0.3.1
func (y *YulFunctionDefinition) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulFunctionDefinitionContext, ) Node[NodeType]
Parse parses a YUL function definition.
func (*YulFunctionDefinition) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulFunctionDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulFunctionDefinition node.
func (*YulFunctionDefinition) ToProto ¶ added in v0.3.1
func (y *YulFunctionDefinition) ToProto() NodeType
ToProto converts the YulFunctionDefinition to its protocol buffer representation.
func (*YulFunctionDefinition) UnmarshalJSON ¶ added in v0.3.1
func (f *YulFunctionDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulFunctionDefinition node.
type YulIdentifier ¶ added in v0.3.1
type YulIdentifier struct { *ASTBuilder // Id is the unique identifier of the YUL identifier. Id int64 `json:"id"` // NodeType is the type of the YUL identifier node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL identifier. Src SrcNode `json:"src"` // Name is the name of the YUL identifier. Name string `json:"name"` }
YulIdentifier represents a YUL identifier in the abstract syntax tree.
func (*YulIdentifier) GetId ¶ added in v0.3.1
func (y *YulIdentifier) GetId() int64
GetId returns the ID of the YulIdentifier.
func (*YulIdentifier) GetName ¶ added in v0.3.1
func (y *YulIdentifier) GetName() string
GetName returns the name of the YulIdentifier.
func (*YulIdentifier) GetNodes ¶ added in v0.3.1
func (y *YulIdentifier) GetNodes() []Node[NodeType]
GetNodes returns an empty list of nodes.
func (*YulIdentifier) GetSrc ¶ added in v0.3.1
func (y *YulIdentifier) GetSrc() SrcNode
GetSrc returns the source information of the YulIdentifier.
func (*YulIdentifier) GetType ¶ added in v0.3.1
func (y *YulIdentifier) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulIdentifier.
func (*YulIdentifier) GetTypeDescription ¶ added in v0.3.1
func (y *YulIdentifier) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulIdentifier.
func (*YulIdentifier) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulIdentifier) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulIdentifier node.
func (*YulIdentifier) ToProto ¶ added in v0.3.1
func (y *YulIdentifier) ToProto() NodeType
ToProto converts the YulIdentifier to its protocol buffer representation.
type YulIfStatement ¶ added in v0.3.1
type YulIfStatement struct { *ASTBuilder // Id is the unique identifier of the YUL if statement. Id int64 `json:"id"` // NodeType is the type of the YUL if statement node. NodeType ast_pb.NodeType `json:"nodeType"` // Src is the source location information of the YUL if statement. Src SrcNode `json:"src"` // Condition is the condition expression of the if statement. Condition Node[NodeType] `json:"condition"` // Body is the body of the if statement. Body Node[NodeType] `json:"body"` }
YulIfStatement represents an if statement in the abstract syntax tree.
func NewYulIfStatement ¶ added in v0.3.1
func NewYulIfStatement(b *ASTBuilder) *YulIfStatement
NewYulIfStatement creates a new YulIfStatement with the provided AST builder.
func (*YulIfStatement) GetBody ¶ added in v0.3.1
func (y *YulIfStatement) GetBody() Node[NodeType]
GetBody returns the body of the if statement.
func (*YulIfStatement) GetCondition ¶ added in v0.3.1
func (y *YulIfStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression of the if statement.
func (*YulIfStatement) GetId ¶ added in v0.3.1
func (y *YulIfStatement) GetId() int64
GetId returns the ID of the YulIfStatement.
func (*YulIfStatement) GetNodes ¶ added in v0.3.1
func (y *YulIfStatement) GetNodes() []Node[NodeType]
GetNodes returns a list containing the Condition and Body nodes.
func (*YulIfStatement) GetSrc ¶ added in v0.3.1
func (y *YulIfStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulIfStatement.
func (*YulIfStatement) GetType ¶ added in v0.3.1
func (y *YulIfStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulIfStatement.
func (*YulIfStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulIfStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the YulIfStatement.
func (*YulIfStatement) Parse ¶ added in v0.3.1
func (y *YulIfStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulIfStatementContext, ) Node[NodeType]
Parse converts a YulIfStatementContext to a YulIfStatement node.
func (*YulIfStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulIfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulIfStatement node.
func (*YulIfStatement) ToProto ¶ added in v0.3.1
func (y *YulIfStatement) ToProto() NodeType
ToProto converts the YulIfStatement to its protocol buffer representation.
func (*YulIfStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulIfStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulIfStatement node.
type YulLeaveStatement ¶ added in v0.3.1
type YulLeaveStatement struct { *ASTBuilder // Embedded ASTBuilder for utility functions. Id int64 `json:"id"` // Unique identifier for the statement. NodeType ast_pb.NodeType `json:"nodeType"` // Type of the node in the AST. Src SrcNode `json:"src"` // Source code location information. }
YulLeaveStatement represents a YUL Leave statement in the AST.
func NewYulLeaveStatement ¶ added in v0.3.1
func NewYulLeaveStatement(b *ASTBuilder) *YulLeaveStatement
NewYulLeaveStatement creates and initializes a new YulLeaveStatement.
func (*YulLeaveStatement) GetId ¶ added in v0.3.1
func (y *YulLeaveStatement) GetId() int64
GetId retrieves the unique identifier of the YulLeaveStatement.
func (*YulLeaveStatement) GetNodes ¶ added in v0.3.1
func (y *YulLeaveStatement) GetNodes() []Node[NodeType]
GetNodes retrieves child nodes of the YulLeaveStatement. For YulLeaveStatement, it always returns an empty slice as it doesn't have child nodes.
func (*YulLeaveStatement) GetSrc ¶ added in v0.3.1
func (y *YulLeaveStatement) GetSrc() SrcNode
GetSrc retrieves the source code location information for the YulLeaveStatement.
func (*YulLeaveStatement) GetType ¶ added in v0.3.1
func (y *YulLeaveStatement) GetType() ast_pb.NodeType
GetType retrieves the node type of the YulLeaveStatement.
func (*YulLeaveStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulLeaveStatement) GetTypeDescription() *TypeDescription
GetTypeDescription retrieves the type description of the YulLeaveStatement. This currently returns an empty TypeDescription.
func (*YulLeaveStatement) Parse ¶ added in v0.3.1
func (y *YulLeaveStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *antlr.TerminalNodeImpl, ) Node[NodeType]
Parse populates the YulLeaveStatement fields based on the provided context. This method is typically used during the AST construction phase.
func (*YulLeaveStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulLeaveStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulLeaveStatement node. Currently, it always returns false as there are no reference descriptions for YulLeaveStatement.
func (*YulLeaveStatement) ToProto ¶ added in v0.3.1
func (y *YulLeaveStatement) ToProto() NodeType
ToProto converts the YulLeaveStatement to its Protocol Buffer representation.
type YulLiteralStatement ¶ added in v0.3.1
type YulLiteralStatement struct { *ASTBuilder // Embedded ASTBuilder for utility functions. Id int64 `json:"id"` NodeType ast_pb.NodeType `json:"nodeType"` Kind ast_pb.NodeType `json:"kind"` Src SrcNode `json:"src"` Value string `json:"value"` HexValue string `json:"hexValue"` }
YulLiteralStatement represents a Yul literal in the AST.
func NewYulLiteralStatement ¶ added in v0.3.1
func NewYulLiteralStatement(b *ASTBuilder) *YulLiteralStatement
NewYulLiteralStatement initializes a new YulLiteralStatement node.
func (*YulLiteralStatement) GetHexValue ¶ added in v0.3.1
func (y *YulLiteralStatement) GetHexValue() string
GetHexValue returns back hexadecimal value of the literal
func (*YulLiteralStatement) GetId ¶ added in v0.3.1
func (y *YulLiteralStatement) GetId() int64
GetId retrieves the ID of the YulLiteralStatement.
func (*YulLiteralStatement) GetKind ¶ added in v0.3.1
func (y *YulLiteralStatement) GetKind() ast_pb.NodeType
func (*YulLiteralStatement) GetNodes ¶ added in v0.3.1
func (y *YulLiteralStatement) GetNodes() []Node[NodeType]
GetNodes retrieves child nodes of the YulLiteralStatement. This returns an empty slice as YulLiteralStatement doesn't have child nodes.
func (*YulLiteralStatement) GetSrc ¶ added in v0.3.1
func (y *YulLiteralStatement) GetSrc() SrcNode
GetSrc retrieves the source node information of the YulLiteralStatement.
func (*YulLiteralStatement) GetType ¶ added in v0.3.1
func (y *YulLiteralStatement) GetType() ast_pb.NodeType
GetType retrieves the node type of the YulLiteralStatement.
func (*YulLiteralStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulLiteralStatement) GetTypeDescription() *TypeDescription
GetTypeDescription retrieves the type description of the YulLiteralStatement. This currently returns an empty TypeDescription.
func (*YulLiteralStatement) GetValue ¶ added in v0.3.1
func (y *YulLiteralStatement) GetValue() string
GetValue returns back value of the literal
func (*YulLiteralStatement) Parse ¶ added in v0.3.1
func (y *YulLiteralStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, parentNode Node[NodeType], ctx *parser.YulLiteralContext, ) Node[NodeType]
Parse processes the given YulLiteralContext to populate the fields of the YulLiteralStatement.
func (*YulLiteralStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulLiteralStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulLiteralStatement node. Currently, this method always returns false and does not set any reference descriptor.
func (*YulLiteralStatement) ToProto ¶ added in v0.3.1
func (y *YulLiteralStatement) ToProto() NodeType
ToProto converts the YulLiteralStatement to its Protocol Buffer representation.
type YulStatement ¶
type YulStatement struct { *ASTBuilder Id int64 `json:"id"` // Unique identifier for the statement node. NodeType ast_pb.NodeType `json:"nodeType"` // The type of the node. Src SrcNode `json:"src"` // Source information about the node. Statements []Node[NodeType] `json:"statements"` // Statements within this Yul statement. }
YulStatement represents a statement in the Yul language.
func NewYulStatement ¶
func NewYulStatement(b *ASTBuilder) *YulStatement
NewYulStatement creates a new YulStatement node and initializes its fields.
func (*YulStatement) GetId ¶
func (y *YulStatement) GetId() int64
GetId returns the unique identifier of the YulStatement node.
func (*YulStatement) GetNodes ¶
func (y *YulStatement) GetNodes() []Node[NodeType]
GetNodes returns the statements within the YulStatement node.
func (*YulStatement) GetSrc ¶
func (y *YulStatement) GetSrc() SrcNode
GetSrc returns the source information of the YulStatement node.
func (*YulStatement) GetStatements ¶ added in v0.3.1
func (y *YulStatement) GetStatements() []Node[NodeType]
func (*YulStatement) GetType ¶
func (y *YulStatement) GetType() ast_pb.NodeType
GetType returns the type of the YulStatement node.
func (*YulStatement) GetTypeDescription ¶
func (y *YulStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns an empty TypeDescription for the YulStatement node.
func (*YulStatement) Parse ¶
func (y *YulStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, parentNode Node[NodeType], ctx *parser.YulStatementContext, ) Node[NodeType]
Parse processes the provided YulStatementContext and populates the YulStatement node's fields based on its content.
func (*YulStatement) SetReferenceDescriptor ¶
func (y *YulStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulStatement node. It always returns false for this node type.
func (*YulStatement) ToProto ¶
func (y *YulStatement) ToProto() NodeType
ToProto converts the YulStatement node into its protocol buffer representation.
func (*YulStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulStatement node. Currently, this function does not perform any unmarshalling and always returns nil.
type YulSwitchCaseStatement ¶ added in v0.3.1
type YulSwitchCaseStatement struct { *ASTBuilder // Embedded ASTBuilder for utility functions. Id int64 `json:"id"` // Id is the unique identifier for the switch case statement. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType specifies the type of the node. Src SrcNode `json:"src"` // Src provides source location details of the switch case statement. Case Node[NodeType] `json:"case"` // Case holds the condition for the switch case. Body Node[NodeType] `json:"body"` // Body represents the block of code to execute for this case. }
YulSwitchCaseStatement represents an individual case statement within a Yul switch structure.
func NewYulSwitchCaseStatement ¶ added in v0.3.1
func NewYulSwitchCaseStatement(b *ASTBuilder) *YulSwitchCaseStatement
NewYulSwitchCaseStatement creates and initializes a new YulSwitchCaseStatement.
func (*YulSwitchCaseStatement) GetBody ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetBody() Node[NodeType]
GetBody returns body of the associated nodes
func (*YulSwitchCaseStatement) GetCase ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetCase() Node[NodeType]
GetCase returns case identifier
func (*YulSwitchCaseStatement) GetId ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetId() int64
GetId retrieves the unique identifier of the YulSwitchCaseStatement.
func (*YulSwitchCaseStatement) GetNodes ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the YulSwitchCaseStatement.
func (*YulSwitchCaseStatement) GetSrc ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetSrc() SrcNode
GetSrc provides the source location details of the YulSwitchCaseStatement.
func (*YulSwitchCaseStatement) GetType ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulSwitchCaseStatement.
func (*YulSwitchCaseStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) GetTypeDescription() *TypeDescription
GetTypeDescription provides a description of the YulSwitchCaseStatement's type. Always returns an empty TypeDescription.
func (*YulSwitchCaseStatement) Parse ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, parentNode Node[NodeType], ctx *parser.YulSwitchCaseContext, ) Node[NodeType]
Parse populates the YulSwitchCaseStatement fields based on the provided YulSwitchCaseContext.
func (*YulSwitchCaseStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor is a placeholder method for setting reference descriptors. Currently always returns false.
func (*YulSwitchCaseStatement) ToProto ¶ added in v0.3.1
func (y *YulSwitchCaseStatement) ToProto() NodeType
ToProto converts the YulSwitchCaseStatement into its protobuf representation. Note: This method currently returns an empty Statement.
func (*YulSwitchCaseStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulSwitchCaseStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulSwitchCaseStatement. Currently, this is a placeholder and does nothing.
type YulSwitchStatement ¶ added in v0.3.1
type YulSwitchStatement struct { *ASTBuilder // Embedded ASTBuilder for utility functions. Id int64 `json:"id"` // Id is the unique identifier for the switch statement. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType specifies the type of the node. Src SrcNode `json:"src"` // Src provides source location details of the switch statement. Cases []Node[NodeType] `json:"cases"` // Cases holds the different cases of the switch statement. }
YulSwitchStatement represents a switch statement in Yul assembly.
func NewYulSwitchStatement ¶ added in v0.3.1
func NewYulSwitchStatement(b *ASTBuilder) *YulSwitchStatement
NewYulSwitchStatement creates and initializes a new YulSwitchStatement.
func (*YulSwitchStatement) GetCases ¶ added in v0.3.1
func (y *YulSwitchStatement) GetCases() []Node[NodeType]
func (*YulSwitchStatement) GetId ¶ added in v0.3.1
func (y *YulSwitchStatement) GetId() int64
GetId retrieves the unique identifier of the YulSwitchStatement.
func (*YulSwitchStatement) GetNodes ¶ added in v0.3.1
func (y *YulSwitchStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the YulSwitchStatement.
func (*YulSwitchStatement) GetSrc ¶ added in v0.3.1
func (y *YulSwitchStatement) GetSrc() SrcNode
GetSrc provides the source location details of the YulSwitchStatement.
func (*YulSwitchStatement) GetType ¶ added in v0.3.1
func (y *YulSwitchStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulSwitchStatement.
func (*YulSwitchStatement) GetTypeDescription ¶ added in v0.3.1
func (y *YulSwitchStatement) GetTypeDescription() *TypeDescription
GetTypeDescription provides a description of the YulSwitchStatement's type. Always returns an empty TypeDescription.
func (*YulSwitchStatement) Parse ¶ added in v0.3.1
func (y *YulSwitchStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulSwitchStatementContext, ) Node[NodeType]
Parse populates the YulSwitchStatement fields based on the provided YulSwitchStatementContext.
func (*YulSwitchStatement) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulSwitchStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor is a placeholder method for setting reference descriptors. Currently always returns false.
func (*YulSwitchStatement) ToProto ¶ added in v0.3.1
func (y *YulSwitchStatement) ToProto() NodeType
ToProto converts the YulSwitchStatement into its protobuf representation. Note: This method currently returns an empty Statement.
func (*YulSwitchStatement) UnmarshalJSON ¶ added in v0.3.1
func (f *YulSwitchStatement) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulSwitchStatement. Currently, this is a placeholder and does nothing.
type YulVariable ¶ added in v0.3.1
type YulVariable struct { *ASTBuilder // Embedded ASTBuilder for utility functions. Id int64 `json:"id"` // Id is a unique identifier for the variable. NodeType ast_pb.NodeType `json:"nodeType"` // NodeType specifies the type of the node. Src SrcNode `json:"src"` // Src contains the source location details of the variable. Let bool `json:"let"` // Let indicates if the variable is declared with a "let" keyword. Value Node[NodeType] `json:"value"` // Value holds the initialized value of the variable. Variables []*YulIdentifier `json:"variables"` // Variables contains a list of Yul identifiers. }
YulVariable represents a variable declaration in Yul assembly.
func NewYulVariable ¶ added in v0.3.1
func NewYulVariable(b *ASTBuilder) *YulVariable
NewYulVariable initializes a new YulVariable with default values.
func (*YulVariable) GetId ¶ added in v0.3.1
func (y *YulVariable) GetId() int64
GetId retrieves the unique identifier of the YulVariable.
func (*YulVariable) GetNodes ¶ added in v0.3.1
func (y *YulVariable) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the YulVariable, including its initialized value.
func (*YulVariable) GetSrc ¶ added in v0.3.1
func (y *YulVariable) GetSrc() SrcNode
GetSrc provides the source location details of the YulVariable.
func (*YulVariable) GetType ¶ added in v0.3.1
func (y *YulVariable) GetType() ast_pb.NodeType
GetType returns the NodeType of the YulVariable.
func (*YulVariable) GetTypeDescription ¶ added in v0.3.1
func (y *YulVariable) GetTypeDescription() *TypeDescription
GetTypeDescription provides a description of the YulVariable's type. Always returns an empty TypeDescription.
func (*YulVariable) GetValue ¶ added in v0.3.1
func (y *YulVariable) GetValue() Node[NodeType]
GetValue returns variable value declaration
func (*YulVariable) GetVariables ¶ added in v0.3.1
func (y *YulVariable) GetVariables() []*YulIdentifier
GetVariables returns variable discovered variables
func (*YulVariable) IsLet ¶ added in v0.3.1
func (y *YulVariable) IsLet() bool
IsLet returns whenever variable is using let
func (*YulVariable) Parse ¶ added in v0.3.1
func (y *YulVariable) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *Yul, statementNode *YulStatement, ctx *parser.YulVariableDeclarationContext, ) Node[NodeType]
Parse populates the YulVariable fields by parsing the provided YulVariableDeclarationContext.
func (*YulVariable) SetReferenceDescriptor ¶ added in v0.3.1
func (y *YulVariable) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor is a placeholder method for setting reference descriptors. Currently always returns false.
func (*YulVariable) ToProto ¶ added in v0.3.1
func (y *YulVariable) ToProto() NodeType
ToProto converts the YulVariable into its protobuf representation. Note: This method currently returns an empty Statement.
func (*YulVariable) UnmarshalJSON ¶ added in v0.3.1
func (y *YulVariable) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a given JSON byte array into a YulVariable.
Source Files ¶
- and_operation.go
- assignment.go
- base_contract.go
- binary.go
- bit_and_operation.go
- bit_or_operator.go
- bit_xor_operator.go
- body.go
- break.go
- builder.go
- catch.go
- comments.go
- conditional.go
- constructor.go
- continue.go
- contract.go
- declaration.go
- do.go
- doc.go
- emit.go
- enum.go
- error.go
- event.go
- expr_operation.go
- expression.go
- expression_context.go
- expression_statement.go
- fallback.go
- for.go
- function.go
- function_call.go
- helpers.go
- ids.go
- if.go
- imports.go
- index_access.go
- index_range.go
- inheritance.go
- inline_array.go
- interface.go
- library.go
- license.go
- marshaler.go
- member_access.go
- meta_type.go
- modifier.go
- modifier_invocation.go
- new.go
- node.go
- override.go
- parameter.go
- parameter_list.go
- payable_conversion.go
- pragma.go
- primary_expression.go
- receive.go
- reference.go
- return.go
- revert.go
- root_node.go
- shift_operator.go
- simple.go
- source_unit.go
- src.go
- state_variable.go
- storage.go
- struct.go
- symbols.go
- tree.go
- try.go
- tuple.go
- type_name.go
- unary_prefix.go
- unary_suffix.go
- unmarshaler.go
- user_defined.go
- using.go
- variable.go
- visitor.go
- while.go
- yul.go
- yul_assignment.go
- yul_block.go
- yul_break.go
- yul_continue.go
- yul_expression.go
- yul_for.go
- yul_function.go
- yul_function_call.go
- yul_identifier.go
- yul_if.go
- yul_leave.go
- yul_literal.go
- yul_statement.go
- yul_switch.go
- yul_switch_case.go
- yul_variable.go