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.
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
- type ASTBuilder
- func (b *ASTBuilder) EnterEveryRule(ctx antlr.ParserRuleContext)
- func (b *ASTBuilder) EnterPragmaDirective(ctx *parser.PragmaDirectiveContext)
- func (b *ASTBuilder) EnterSourceUnit(ctx *parser.SourceUnitContext)
- func (b *ASTBuilder) ExitSourceUnit(ctx *parser.SourceUnitContext)
- func (b *ASTBuilder) GarbageCollect()
- 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) 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
- type AssemblyStatement
- func (a *AssemblyStatement) GetBody() *BodyNode
- func (a *AssemblyStatement) GetId() int64
- func (a *AssemblyStatement) GetNodes() []Node[NodeType]
- func (a *AssemblyStatement) GetSrc() SrcNode
- func (a *AssemblyStatement) GetType() ast_pb.NodeType
- func (a *AssemblyStatement) GetTypeDescription() *TypeDescription
- func (a *AssemblyStatement) Parse(unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], ...) Node[NodeType]
- func (a *AssemblyStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (a *AssemblyStatement) ToProto() NodeType
- 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
- type BaseContract
- type BaseContractName
- 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
- 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
- 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
- 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
- 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
- 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) 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
- type Declaration
- func (d *Declaration) GetId() int64
- func (d *Declaration) GetIsConstant() bool
- func (d *Declaration) GetIsStateVariable() bool
- func (d *Declaration) GetName() string
- 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
- 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
- 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) 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (e *EnumDefinition) ToProto() NodeType
- type ErrorDefinition
- func (e *ErrorDefinition) GetId() int64
- func (e *ErrorDefinition) GetName() string
- 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) 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) 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
- type Expression
- 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
- type Function
- 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) 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) 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *Function) ToProto() NodeType
- 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (f *FunctionCall) ToProto() NodeType
- 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
- 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
- type Import
- func (i *Import) GetAbsolutePath() string
- func (i *Import) GetFile() string
- func (i *Import) GetId() int64
- func (i *Import) GetName() string
- 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) 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
- 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
- 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) 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
- 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) GetNodes() []Node[NodeType]
- func (l *Library) GetReceive() *Receive
- func (l *Library) GetScope() int64
- 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
- type LibraryName
- type MemberAccessExpression
- func (m *MemberAccessExpression) GetArgumentTypes() []*TypeDescription
- func (m *MemberAccessExpression) GetExpression() Node[NodeType]
- func (m *MemberAccessExpression) GetId() int64
- 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
- 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) 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
- 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
- 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 OverrideSpecifier
- func (o *OverrideSpecifier) GetId() int64
- func (o *OverrideSpecifier) GetName() string
- func (o *OverrideSpecifier) GetNodes() []Node[NodeType]
- 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) 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
- 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
- type PathNode
- 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (p *PayableConversion) ToProto() NodeType
- 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) 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
- 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
- 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
- type RootNode
- func (r *RootNode) GetComments() []*Comment
- func (r *RootNode) GetEntrySourceUnit() int64
- 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
- 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]) 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]) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (s *SourceUnit[T]) ToProto() NodeType
- type SrcNode
- type StateVariableDeclaration
- func (v *StateVariableDeclaration) GetId() int64
- 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (v *StateVariableDeclaration) ToProto() NodeType
- type StructDefinition
- func (s *StructDefinition) GetCanonicalName() string
- func (s *StructDefinition) GetId() int64
- func (s *StructDefinition) GetKind() ast_pb.NodeType
- func (s *StructDefinition) GetMembers() []*Parameter
- func (s *StructDefinition) GetName() string
- 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (s *StructDefinition) ToProto() NodeType
- type Symbol
- type Tree
- func (t *Tree) AppendRootNodes(roots ...*SourceUnit[Node[ast_pb.SourceUnit]])
- 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
- 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) GetImplemented() bool
- func (t *TryStatement) GetKind() ast_pb.NodeType
- func (t *TryStatement) GetNodes() []Node[NodeType]
- func (t *TryStatement) GetSrc() SrcNode
- func (t *TryStatement) GetType() ast_pb.NodeType
- func (t *TryStatement) GetTypeDescription() *TypeDescription
- 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
- 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
- type TypeDescription
- type TypeName
- func (t *TypeName) GetId() int64
- 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) 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) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
- func (t *TypeName) ToProto() NodeType
- type UnaryPrefix
- func (u *UnaryPrefix) GetExpression() Node[NodeType]
- func (u *UnaryPrefix) GetId() int64
- 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
- type UnarySuffix
- func (u *UnarySuffix) GetExpression() Node[NodeType]
- func (u *UnarySuffix) GetId() int64
- 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
- type UnprocessedNode
- 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
- 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
- type YulStatement
- func (y *YulStatement) GetId() int64
- func (y *YulStatement) GetNodes() []Node[NodeType]
- func (y *YulStatement) GetSrc() SrcNode
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTypedStruct ¶ added in v0.1.6
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) EnterEveryRule ¶ added in v0.1.6
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) EnterPragmaDirective ¶ added in v0.1.6
func (b *ASTBuilder) EnterPragmaDirective(ctx *parser.PragmaDirectiveContext)
EnterPragmaDirective is called when production pragmaDirective is entered. However, it won't return pragma directives properly. For example, if we have experimental pragma, it won't return it. It will return only the pragma. Because of it, we are parsing pragmas in EnterSourceUnit to be able capture all of the pragmas and assign them based on the contract they belong to. Source file can have multiple contracts and multiple files and therefore we need to be able to assign pragmas to the correct contract. @WARN: DO NOT USE THIS METHOD.
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) ExitSourceUnit ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *ASTBuilder) GarbageCollect()
GarbageCollect cleans up the ASTBuilder after resolving references.
func (*ASTBuilder) GetNextID ¶ added in v0.1.6
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 ¶ added in v0.1.7
func (b *ASTBuilder) GetParser() *parser.SolidityParser
GetParser returns the Solidity parser of the ASTBuilder.
func (*ASTBuilder) GetResolver ¶ added in v0.1.6
func (b *ASTBuilder) GetResolver() *Resolver
GetResolver returns the Resolver of the ASTBuilder.
func (*ASTBuilder) GetRoot ¶ added in v0.1.6
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) InterfaceToJSON ¶ added in v0.1.6
func (b *ASTBuilder) InterfaceToJSON(data interface{}) ([]byte, error)
ToPrettyJSON converts the provided data to a JSON byte array.
func (*ASTBuilder) ResolveReferences ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *ASTBuilder) ToProto() *ast_pb.RootSourceUnit
type AndOperation ¶ added in v0.2.1
type AndOperation struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Expressions []Node[NodeType] `json:"expressions"`
TypeDescriptions []*TypeDescription `json:"type_descriptions"`
}
AndOperation represents an 'and' operation in an abstract syntax tree.
func NewAndOperationExpression ¶ added in v0.2.1
func NewAndOperationExpression(b *ASTBuilder) *AndOperation
NewAndOperationExpression creates a new AndOperation instance.
func (*AndOperation) GetExpressions ¶ added in v0.2.1
func (f *AndOperation) GetExpressions() []Node[NodeType]
GetExpressions returns the expressions within the AndOperation.
func (*AndOperation) GetId ¶ added in v0.2.1
func (f *AndOperation) GetId() int64
GetId returns the ID of the AndOperation.
func (*AndOperation) GetNodes ¶ added in v0.2.1
func (f *AndOperation) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the AndOperation.
func (*AndOperation) GetSrc ¶ added in v0.2.1
func (f *AndOperation) GetSrc() SrcNode
GetSrc returns the source information of the AndOperation.
func (*AndOperation) GetType ¶ added in v0.2.1
func (f *AndOperation) GetType() ast_pb.NodeType
GetType returns the NodeType of the AndOperation.
func (*AndOperation) GetTypeDescription ¶ added in v0.2.1
func (f *AndOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the AndOperation.
func (*AndOperation) Parse ¶ added in v0.2.1
func (f *AndOperation) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.AndOperationContext, ) Node[NodeType]
Parse parses the AndOperation node from the parsing context and associates it with other nodes.
func (*AndOperation) SetReferenceDescriptor ¶ added in v0.2.1
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 ¶ added in v0.2.1
func (f *AndOperation) ToProto() NodeType
ToProto converts the AndOperation to its corresponding protocol buffer representation.
type AssemblyStatement ¶ added in v0.1.6
type AssemblyStatement struct {
*ASTBuilder
// Id is the unique identifier of the assembly statement.
Id int64 `json:"id"`
// NodeType is the type of the node.
// For an AssemblyStatement, this is always NodeType_ASSEMBLY_STATEMENT.
NodeType ast_pb.NodeType `json:"node_type"`
// Src contains source information about the node, such as its line and column numbers in the source file.
Src SrcNode `json:"src"`
// Body is the body of the assembly statement, represented as a BodyNode.
Body *BodyNode `json:"body"`
}
AssemblyStatement represents an assembly statement in a Solidity source file. @WARN: AssemblyStatement is not yet implemented.
func NewAssemblyStatement ¶ added in v0.1.6
func NewAssemblyStatement(b *ASTBuilder) *AssemblyStatement
NewAssemblyStatement creates a new AssemblyStatement.
func (*AssemblyStatement) GetBody ¶ added in v0.1.6
func (a *AssemblyStatement) GetBody() *BodyNode
GetBody returns the body of the assembly statement, represented as a BodyNode.
func (*AssemblyStatement) GetId ¶ added in v0.1.6
func (a *AssemblyStatement) GetId() int64
GetId returns the unique identifier of the assembly statement.
func (*AssemblyStatement) GetNodes ¶ added in v0.1.6
func (a *AssemblyStatement) GetNodes() []Node[NodeType]
GetNodes returns the statements in the body of the assembly statement.
func (*AssemblyStatement) GetSrc ¶ added in v0.1.6
func (a *AssemblyStatement) GetSrc() SrcNode
GetSrc returns source information about the node, such as its line and column numbers in the source file.
func (*AssemblyStatement) GetType ¶ added in v0.1.6
func (a *AssemblyStatement) GetType() ast_pb.NodeType
GetType returns the type of the node. For an AssemblyStatement, this is always NodeType_ASSEMBLY_STATEMENT.
func (*AssemblyStatement) GetTypeDescription ¶ added in v0.1.6
func (a *AssemblyStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the assembly statement. For an AssemblyStatement, this is always nil.
func (*AssemblyStatement) Parse ¶ added in v0.1.6
func (a *AssemblyStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, ctx *parser.AssemblyStatementContext, ) Node[NodeType]
Parse parses an AssemblyStatementContext to populate the fields of the AssemblyStatement.
func (*AssemblyStatement) SetReferenceDescriptor ¶ added in v0.1.6
func (a *AssemblyStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
func (*AssemblyStatement) ToProto ¶ added in v0.1.6
func (a *AssemblyStatement) ToProto() NodeType
ToProto returns the protobuf representation of the assembly statement. @TODO: Implement body type...
type Assignment ¶ added in v0.1.6
type Assignment struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the Assignment node.
NodeType ast_pb.NodeType `json:"node_type"` // 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:"left_expression,omitempty"` // Left-hand side expression.
RightExpression Node[NodeType] `json:"right_expression,omitempty"` // Right-hand side expression.
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"` // Referenced declaration identifier (if used).
TypeDescription *TypeDescription `json:"type_description,omitempty"` // Type description associated with the Assignment node.
}
Assignment represents an assignment statement in the AST.
func NewAssignment ¶ added in v0.1.6
func NewAssignment(b *ASTBuilder) *Assignment
NewAssignment creates a new Assignment node with a given ASTBuilder.
func (*Assignment) GetExpression ¶ added in v0.1.6
func (a *Assignment) GetExpression() Node[NodeType]
GetExpression returns the expression of the Assignment node.
func (*Assignment) GetId ¶ added in v0.1.6
func (a *Assignment) GetId() int64
GetId returns the ID of the Assignment node.
func (*Assignment) GetLeftExpression ¶ added in v0.1.6
func (a *Assignment) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression of the Assignment node.
func (*Assignment) GetNodes ¶ added in v0.1.6
func (a *Assignment) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the Assignment node.
func (*Assignment) GetOperator ¶ added in v0.1.6
func (a *Assignment) GetOperator() ast_pb.Operator
GetOperator returns the operator of the Assignment node.
func (*Assignment) GetReferencedDeclaration ¶ added in v0.1.6
func (a *Assignment) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the Assignment node.
func (*Assignment) GetRightExpression ¶ added in v0.1.6
func (a *Assignment) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression of the Assignment node.
func (*Assignment) GetSrc ¶ added in v0.1.6
func (a *Assignment) GetSrc() SrcNode
GetSrc returns the SrcNode of the Assignment node.
func (*Assignment) GetType ¶ added in v0.1.6
func (a *Assignment) GetType() ast_pb.NodeType
GetType returns the NodeType of the Assignment node.
func (*Assignment) GetTypeDescription ¶ added in v0.1.6
func (a *Assignment) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the Assignment node.
func (*Assignment) Parse ¶ added in v0.1.6
func (a *Assignment) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.AssignmentContext, ) Node[NodeType]
Parse parses an assignment context into the Assignment node.
func (*Assignment) ParseStatement ¶ added in v0.1.6
func (a *Assignment) ParseStatement( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, parentNode Node[NodeType], eCtx *parser.ExpressionStatementContext, ctx *parser.AssignmentContext, )
ParseStatement parses an expression statement context into the Assignment node.
func (*Assignment) SetReferenceDescriptor ¶ added in v0.1.6
func (a *Assignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Assignment node.
func (*Assignment) ToProto ¶ added in v0.1.6
func (a *Assignment) ToProto() NodeType
ToProto returns a protobuf representation of the Assignment node.
type BaseContract ¶ added in v0.1.6
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:"node_type"`
// 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:"base_name"`
}
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 ¶ added in v0.1.6
func (b *BaseContract) GetBaseName() *BaseContractName
GetBaseName returns the name of the base contract.
func (*BaseContract) GetId ¶ added in v0.1.6
func (b *BaseContract) GetId() int64
GetId returns the unique identifier of the base contract.
func (*BaseContract) GetSrc ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *BaseContract) ToProto() *ast_pb.BaseContract
ToProto returns the protobuf representation of the base contract.
type BaseContractName ¶ added in v0.1.6
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:"node_type"`
// 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 contract declaration that this name references.
ReferencedDeclaration int64 `json:"referenced_declaration"`
}
BaseContractName represents the name of a base contract in a Solidity source file.
func (*BaseContractName) GetId ¶ added in v0.1.6
func (b *BaseContractName) GetId() int64
GetId returns the unique identifier of the base contract name.
func (*BaseContractName) GetName ¶ added in v0.1.6
func (b *BaseContractName) GetName() string
GetName returns the name of the base contract name.
func (*BaseContractName) GetReferencedDeclaration ¶ added in v0.1.7
func (b *BaseContractName) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the unique identifier of the source unit contract declaration that this name references.
func (*BaseContractName) GetSrc ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *BaseContractName) ToProto() *ast_pb.BaseContractName
ToProto returns the protobuf representation of the base contract name.
type BinaryOperation ¶ added in v0.1.6
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:"is_constant"`
// IsPure indicates whether the binary operation is pure (i.e., it does not read or modify state).
Pure bool `json:"is_pure"`
// NodeType is the type of the node.
// For a BinaryOperation, this is always NodeType_BINARY_OPERATION.
NodeType ast_pb.NodeType `json:"node_type"`
// 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:"left_expression"`
// RightExpression is the right operand of the binary operation.
RightExpression Node[NodeType] `json:"right_expression"`
// TypeDescription is the type description of the binary operation.
TypeDescription *TypeDescription `json:"type_description"`
}
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (a *BinaryOperation) GetId() int64
GetId is a getter method that returns the unique identifier of the binary operation.
func (*BinaryOperation) GetLeftExpression ¶ added in v0.1.6
func (a *BinaryOperation) GetLeftExpression() Node[NodeType]
GetLeftExpression is a getter method that returns the left operand of the binary operation.
func (*BinaryOperation) GetNodes ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (a *BinaryOperation) GetOperator() ast_pb.Operator
GetOperator is a getter method that returns the operator of the binary operation.
func (*BinaryOperation) GetRightExpression ¶ added in v0.1.6
func (a *BinaryOperation) GetRightExpression() Node[NodeType]
GetRightExpression is a getter method that returns the right operand of the binary operation.
func (*BinaryOperation) GetSrc ¶ added in v0.1.6
func (a *BinaryOperation) GetSrc() SrcNode
GetSrc is a getter method that returns the source information of the binary operation.
func (*BinaryOperation) GetType ¶ added in v0.1.6
func (a *BinaryOperation) GetType() ast_pb.NodeType
GetType is a getter method that returns the node type of the binary operation.
func (*BinaryOperation) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (a *BinaryOperation) IsConstant() bool
IsConstant is a getter method that returns whether the binary operation is a constant.
func (*BinaryOperation) IsPure ¶ added in v0.1.6
func (a *BinaryOperation) IsPure() bool
IsPure is a getter method that returns whether the binary operation is pure.
func (*BinaryOperation) ParseAddSub ¶ added in v0.1.6
func (a *BinaryOperation) ParseAddSub( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.AddSubOperationContext, ) Node[NodeType]
ParseAddSub is a method that parses addition and subtraction operations.
func (*BinaryOperation) ParseEqualityComparison ¶ added in v0.1.6
func (a *BinaryOperation) ParseEqualityComparison( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.EqualityComparisonContext, ) Node[NodeType]
ParseEqualityComparison is a method that parses equality comparison operations.
func (*BinaryOperation) ParseMulDivMod ¶ added in v0.1.6
func (a *BinaryOperation) ParseMulDivMod( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.MulDivModOperationContext, ) Node[NodeType]
ParseMulDivMod is a method that parses multiplication, division, and modulo operations.
func (*BinaryOperation) ParseOr ¶ added in v0.1.6
func (a *BinaryOperation) ParseOr( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.OrOperationContext, ) Node[NodeType]
ParseOr is a method that parses or comparison operations.
func (*BinaryOperation) ParseOrderComparison ¶ added in v0.1.6
func (a *BinaryOperation) ParseOrderComparison( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], ctx *parser.OrderComparisonContext, ) Node[NodeType]
ParseOrderComparison is a method that parses order comparison operations.
func (*BinaryOperation) SetReferenceDescriptor ¶ added in v0.1.6
func (a *BinaryOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BinaryOperation node.
func (*BinaryOperation) ToProto ¶ added in v0.1.6
func (a *BinaryOperation) ToProto() NodeType
ToProto is a method that returns the protobuf representation of the binary operation.
type BodyNode ¶ added in v0.1.6
type BodyNode struct {
*ASTBuilder
Id int64 `json:"id"` // Id is the unique identifier of the body node.
NodeType ast_pb.NodeType `json:"node_type"` // 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.
}
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 ¶ added in v0.1.6
func NewBodyNode(b *ASTBuilder) *BodyNode
NewBodyNode creates a new BodyNode with the provided ASTBuilder. It returns a pointer to the created BodyNode.
func (*BodyNode) GetNodes ¶ added in v0.1.6
GetNodes returns the nodes associated with the body node.
func (*BodyNode) GetStatements ¶ added in v0.1.6
GetStatements returns the statements associated with the body node.
func (*BodyNode) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
IsImplemented returns the implemented status of the body node.
func (*BodyNode) ParseBlock ¶ added in v0.1.6
func (b *BodyNode) ParseBlock( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode 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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *BodyNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BodyNode node.
type BreakStatement ¶ added in v0.1.6
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:"node_type"` // 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 ¶ added in v0.1.6
func NewBreakStatement(b *ASTBuilder) *BreakStatement
NewBreakStatement creates a new BreakStatement instance.
func (*BreakStatement) GetId ¶ added in v0.1.6
func (b *BreakStatement) GetId() int64
GetId returns the unique identifier of the break statement.
func (*BreakStatement) GetNodes ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *BreakStatement) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'BREAK' for a break statement.
func (*BreakStatement) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *BreakStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the BreakStatement node.
func (*BreakStatement) ToProto ¶ added in v0.1.6
func (b *BreakStatement) ToProto() NodeType
ToProto returns the protobuf representation of the break statement.
type CatchStatement ¶ added in v0.1.6
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:"node_type"`
// 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 ¶ added in v0.1.6
func NewCatchClauseStatement(b *ASTBuilder) *CatchStatement
NewCatchClauseStatement creates a new CatchStatement instance.
func (*CatchStatement) GetBody ¶ added in v0.1.6
func (t *CatchStatement) GetBody() *BodyNode
GetBody returns the body of the 'catch' clause.
func (*CatchStatement) GetId ¶ added in v0.1.6
func (t *CatchStatement) GetId() int64
GetId returns the unique identifier of the 'catch' clause.
func (*CatchStatement) GetKind ¶ added in v0.1.6
func (t *CatchStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the node, which is 'CATCH' for a 'catch' clause.
func (*CatchStatement) GetName ¶ added in v0.1.6
func (t *CatchStatement) GetName() string
GetName returns the name of the exception variable in the 'catch' clause, if any.
func (*CatchStatement) GetNodes ¶ added in v0.1.6
func (t *CatchStatement) GetNodes() []Node[NodeType]
GetNodes returns the statements in the body of the 'catch' clause.
func (*CatchStatement) GetParameters ¶ added in v0.1.6
func (t *CatchStatement) GetParameters() *ParameterList
GetParameters returns the parameters of the 'catch' clause.
func (*CatchStatement) GetSrc ¶ added in v0.1.6
func (t *CatchStatement) GetSrc() SrcNode
GetSrc returns the source information about the 'catch' clause.
func (*CatchStatement) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (t *CatchStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the CatchStatement node.
func (*CatchStatement) ToProto ¶ added in v0.1.6
func (t *CatchStatement) ToProto() NodeType
ToProto returns the protobuf representation of the 'catch' clause.
type Comment ¶ added in v0.1.6
type Comment struct {
Id int64 `json:"id"`
Src SrcNode `json:"src"`
NodeType ast_pb.NodeType `json:"node_type"`
Text string `json:"text"`
}
Comment represents a comment in an abstract syntax tree.
type Conditional ¶ added in v0.2.1
type Conditional struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Expressions []Node[NodeType] `json:"expressions"`
TypeDescriptions []*TypeDescription `json:"type_descriptions"`
TypeDescription *TypeDescription `json:"type_description"`
}
Conditional represents a conditional expression in an abstract syntax tree.
func NewConditionalExpression ¶ added in v0.2.1
func NewConditionalExpression(b *ASTBuilder) *Conditional
NewConditionalExpression creates a new Conditional instance.
func (*Conditional) GetExpressions ¶ added in v0.2.1
func (f *Conditional) GetExpressions() []Node[NodeType]
GetExpressions returns the right expressions within the Conditional.
func (*Conditional) GetId ¶ added in v0.2.1
func (f *Conditional) GetId() int64
GetId returns the ID of the Conditional.
func (*Conditional) GetNodes ¶ added in v0.2.1
func (f *Conditional) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the Conditional.
func (*Conditional) GetSrc ¶ added in v0.2.1
func (f *Conditional) GetSrc() SrcNode
GetSrc returns the source information of the Conditional.
func (*Conditional) GetType ¶ added in v0.2.1
func (f *Conditional) GetType() ast_pb.NodeType
GetType returns the NodeType of the Conditional.
func (*Conditional) GetTypeDescription ¶ added in v0.2.1
func (f *Conditional) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Conditional.
func (*Conditional) Parse ¶ added in v0.2.1
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 ¶ added in v0.2.1
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 ¶ added in v0.2.1
func (f *Conditional) ToProto() NodeType
ToProto converts the Conditional to its corresponding protocol buffer representation.
type Constructor ¶ added in v0.1.6
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:"node_type"`
// 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:"state_mutability"`
// 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:"return_parameters"`
// 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 ¶ added in v0.1.6
func NewConstructor(b *ASTBuilder) *Constructor
NewConstructor creates a new Constructor instance.
func (*Constructor) GetBody ¶ added in v0.1.6
func (c *Constructor) GetBody() *BodyNode
GetBody returns the body of the constructor.
func (*Constructor) GetId ¶ added in v0.1.6
func (c *Constructor) GetId() int64
GetId returns the unique identifier of the constructor.
func (*Constructor) GetKind ¶ added in v0.1.6
func (c *Constructor) GetKind() ast_pb.NodeType
GetKind returns the kind of the node, which is 'CONSTRUCTOR' for a constructor.
func (*Constructor) GetModifiers ¶ added in v0.1.7
func (c *Constructor) GetModifiers() []*ModifierInvocation
func (*Constructor) GetNodes ¶ added in v0.1.6
func (c *Constructor) GetNodes() []Node[NodeType]
GetNodes returns the statements in the body of the constructor.
func (*Constructor) GetParameters ¶ added in v0.1.6
func (c *Constructor) GetParameters() *ParameterList
GetParameters returns the parameters of the constructor.
func (*Constructor) GetReturnParameters ¶ added in v0.1.6
func (c *Constructor) GetReturnParameters() *ParameterList
GetReturnParameters returns the return parameters of the constructor, which are always empty for a constructor.
func (*Constructor) GetScope ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (c *Constructor) GetSrc() SrcNode
GetSrc returns the source information about the constructor.
func (*Constructor) GetStateMutability ¶ added in v0.1.6
func (c *Constructor) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the constructor.
func (*Constructor) GetType ¶ added in v0.1.6
func (c *Constructor) GetType() ast_pb.NodeType
GetType returns the type of the node, which is 'FUNCTION_DEFINITION' for a constructor.
func (*Constructor) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (c *Constructor) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the constructor.
func (*Constructor) IsImplemented ¶ added in v0.1.6
func (c *Constructor) IsImplemented() bool
IsImplemented returns whether the constructor is implemented or not.
func (*Constructor) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (c *Constructor) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Constructor node.
func (*Constructor) ToProto ¶ added in v0.1.6
func (c *Constructor) ToProto() NodeType
ToProto returns the protobuf representation of the constructor.
type ContinueStatement ¶ added in v0.1.6
type ContinueStatement struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
}
ContinueStatement represents a 'continue' statement in the abstract syntax tree.
func NewContinueStatement ¶ added in v0.1.6
func NewContinueStatement(b *ASTBuilder) *ContinueStatement
NewContinueStatement creates a new instance of ContinueStatement.
func (*ContinueStatement) GetId ¶ added in v0.1.6
func (b *ContinueStatement) GetId() int64
GetId returns the ID of the ContinueStatement.
func (*ContinueStatement) GetNodes ¶ added in v0.1.6
func (b *ContinueStatement) GetNodes() []Node[NodeType]
GetNodes returns an empty list of child nodes for the ContinueStatement.
func (*ContinueStatement) GetSrc ¶ added in v0.1.6
func (b *ContinueStatement) GetSrc() SrcNode
GetSrc returns the source information of the ContinueStatement.
func (*ContinueStatement) GetType ¶ added in v0.1.6
func (b *ContinueStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ContinueStatement.
func (*ContinueStatement) GetTypeDescription ¶ added in v0.1.6
func (b *ContinueStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the ContinueStatement.
func (*ContinueStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (b *ContinueStatement) ToProto() NodeType
ToProto converts the ContinueStatement to its corresponding protocol buffer representation.
type Contract ¶ added in v0.1.6
type Contract struct {
*ASTBuilder
Id int64 `json:"id"`
Name string `json:"name"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Abstract bool `json:"abstract"`
Kind ast_pb.NodeType `json:"kind"`
FullyImplemented bool `json:"fully_implemented"`
Nodes []Node[NodeType] `json:"nodes"`
LinearizedBaseContracts []int64 `json:"linearized_base_contracts"`
BaseContracts []*BaseContract `json:"base_contracts"`
ContractDependencies []int64 `json:"contract_dependencies"`
}
Contract represents a Solidity contract in the abstract syntax tree.
func NewContractDefinition ¶ added in v0.1.6
func NewContractDefinition(b *ASTBuilder) *Contract
NewContractDefinition creates a new instance of Contract.
func (*Contract) GetBaseContracts ¶ added in v0.1.6
func (c *Contract) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the Contract.
func (*Contract) GetConstructor ¶ added in v0.1.7
func (s *Contract) GetConstructor() *Constructor
GetConstructor returns the constructor definition of the Contract.
func (*Contract) GetContractDependencies ¶ added in v0.1.6
GetContractDependencies returns the contract dependencies of the Contract.
func (*Contract) GetEnums ¶ added in v0.1.7
func (s *Contract) GetEnums() []*EnumDefinition
GetEnums returns the enum definitions defined in the Contract.
func (*Contract) GetErrors ¶ added in v0.1.7
func (s *Contract) GetErrors() []*ErrorDefinition
GetErrors returns the error definitions defined in the Contract.
func (*Contract) GetEvents ¶ added in v0.1.7
func (s *Contract) GetEvents() []*EventDefinition
GetEvents returns the event definitions defined in the Contract.
func (*Contract) GetFallback ¶ added in v0.1.7
GetFallback returns the fallback definition of the Contract.
func (*Contract) GetFunctions ¶ added in v0.1.7
GetFunctions returns the function definitions defined in the Contract.
func (*Contract) GetLinearizedBaseContracts ¶ added in v0.1.6
GetLinearizedBaseContracts returns the linearized base contracts of the Contract.
func (*Contract) GetReceive ¶ added in v0.1.7
GetReceive returns the receive definition of the Contract.
func (*Contract) GetStateVariables ¶ added in v0.1.7
func (s *Contract) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns the state variables defined in the Contract.
func (*Contract) GetStructs ¶ added in v0.1.7
func (s *Contract) GetStructs() []*StructDefinition
GetStructs returns the struct definitions defined in the Contract.
func (*Contract) GetTypeDescription ¶ added in v0.1.6
func (c *Contract) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Contract.
func (*Contract) IsAbstract ¶ added in v0.1.6
IsAbstract returns whether the Contract is abstract.
func (*Contract) IsFullyImplemented ¶ added in v0.1.6
IsFullyImplemented returns whether the Contract is fully implemented.
func (*Contract) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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.
type Declaration ¶ added in v0.1.6
type Declaration struct {
*ASTBuilder
IsConstant bool `json:"is_constant"`
Id int64 `json:"id"`
StateMutability ast_pb.Mutability `json:"state_mutability"`
Name string `json:"name"`
NodeType ast_pb.NodeType `json:"node_type"`
Scope int64 `json:"scope"`
Src SrcNode `json:"src"`
IsStateVariable bool `json:"is_state_variable"`
StorageLocation ast_pb.StorageLocation `json:"storage_location"`
TypeName *TypeName `json:"type_name"`
Visibility ast_pb.Visibility `json:"visibility"`
}
Declaration is a struct that contains information about a variable declaration in the AST.
func NewDeclaration ¶ added in v0.1.6
func NewDeclaration(b *ASTBuilder) *Declaration
NewDeclaration creates a new Declaration instance.
func (*Declaration) GetId ¶ added in v0.1.6
func (d *Declaration) GetId() int64
GetId returns the ID of the Declaration.
func (*Declaration) GetIsConstant ¶ added in v0.1.6
func (d *Declaration) GetIsConstant() bool
GetIsConstant returns whether or not the Declaration is constant.
func (*Declaration) GetIsStateVariable ¶ added in v0.1.6
func (d *Declaration) GetIsStateVariable() bool
GetIsStateVariable returns whether or not the Declaration is a state variable.
func (*Declaration) GetName ¶ added in v0.1.6
func (d *Declaration) GetName() string
GetName returns the name of the Declaration.
func (*Declaration) GetNodes ¶ added in v0.1.6
func (d *Declaration) GetNodes() []Node[NodeType]
GetNodes returns the nodes associated with the Declaration.
func (*Declaration) GetScope ¶ added in v0.1.6
func (d *Declaration) GetScope() int64
GetScope returns the scope of the Declaration.
func (*Declaration) GetSrc ¶ added in v0.1.6
func (d *Declaration) GetSrc() SrcNode
GetSrc returns the SrcNode of the Declaration.
func (*Declaration) GetStateMutability ¶ added in v0.1.6
func (d *Declaration) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Declaration.
func (*Declaration) GetStorageLocation ¶ added in v0.1.6
func (d *Declaration) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the Declaration.
func (*Declaration) GetType ¶ added in v0.1.6
func (d *Declaration) GetType() ast_pb.NodeType
GetType returns the NodeType of the Declaration.
func (*Declaration) GetTypeDescription ¶ added in v0.1.6
func (d *Declaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the Declaration.
func (*Declaration) GetTypeName ¶ added in v0.1.6
func (d *Declaration) GetTypeName() *TypeName
GetTypeName returns the TypeName of the Declaration.
func (*Declaration) GetVisibility ¶ added in v0.1.6
func (d *Declaration) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Declaration.
func (*Declaration) ParseVariableDeclaration ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (v *Declaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the VariableDeclaration node.
func (*Declaration) ToProto ¶ added in v0.1.6
func (d *Declaration) ToProto() NodeType
ToProto converts the Declaration to its corresponding protocol buffer representation.
type DoWhileStatement ¶ added in v0.1.6
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:"node_type"` // 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 ¶ added in v0.1.6
func NewDoWhileStatement(b *ASTBuilder) *DoWhileStatement
NewDoWhileStatement creates a new DoWhileStatement node with default values and returns it.
func (*DoWhileStatement) GetBody ¶ added in v0.1.6
func (d *DoWhileStatement) GetBody() *BodyNode
GetBody returns the body of the do-while loop.
func (*DoWhileStatement) GetCondition ¶ added in v0.1.6
func (d *DoWhileStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression of the do-while loop.
func (*DoWhileStatement) GetId ¶ added in v0.1.6
func (d *DoWhileStatement) GetId() int64
GetId returns the unique identifier of the DoWhileStatement node.
func (*DoWhileStatement) GetNodes ¶ added in v0.1.6
func (d *DoWhileStatement) GetNodes() []Node[NodeType]
GetNodes returns a slice of child nodes within the do-while loop.
func (*DoWhileStatement) GetSrc ¶ added in v0.1.6
func (d *DoWhileStatement) GetSrc() SrcNode
GetSrc returns the source location information of the DoWhileStatement node.
func (*DoWhileStatement) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (d *DoWhileStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the DoWhileStatement node.
func (*DoWhileStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (d *DoWhileStatement) ToProto() NodeType
ToProto converts the DoWhileStatement node to its corresponding protocol buffer representation.
type Emit ¶ added in v0.1.6
type Emit struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the emit statement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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 ¶ added in v0.1.6
func NewEmitStatement(b *ASTBuilder) *Emit
NewEmitStatement creates a new instance of Emit with the provided ASTBuilder.
func (*Emit) GetArguments ¶ added in v0.1.6
GetArguments returns the list of arguments associated with the emit statement.
func (*Emit) GetExpression ¶ added in v0.1.6
GetExpression returns the expression node associated with the emit statement.
func (*Emit) GetId ¶ added in v0.1.6
GetId returns the unique identifier of the emit statement node.
func (*Emit) GetNodes ¶ added in v0.1.6
GetNodes returns a list of nodes associated with the emit statement (arguments and expression).
func (*Emit) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the emit statement node.
func (*Emit) GetTypeDescription ¶ added in v0.1.6
func (e *Emit) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the emit statement.
func (*Emit) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *Emit) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the Emit node.
type EnumDefinition ¶ added in v0.1.6
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:"node_type"` // Type of the node (ENUM_DEFINITION for enumeration definition)
Src SrcNode `json:"src"` // Source information about the enumeration definition
Name string `json:"name"` // Name of the enumeration
CanonicalName string `json:"canonical_name"` // Canonical name of the enumeration
TypeDescription *TypeDescription `json:"type_description"` // 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 ¶ added in v0.1.6
func NewEnumDefinition(b *ASTBuilder) *EnumDefinition
NewEnumDefinition creates a new EnumDefinition instance.
func (*EnumDefinition) GetCanonicalName ¶ added in v0.1.6
func (e *EnumDefinition) GetCanonicalName() string
GetCanonicalName returns the canonical name of the enumeration.
func (*EnumDefinition) GetId ¶ added in v0.1.6
func (e *EnumDefinition) GetId() int64
GetId returns the unique identifier of the enumeration definition.
func (*EnumDefinition) GetMembers ¶ added in v0.1.6
func (e *EnumDefinition) GetMembers() []*Parameter
GetMembers returns the members of the enumeration.
func (*EnumDefinition) GetName ¶ added in v0.1.6
func (e *EnumDefinition) GetName() string
GetName returns the name of the enumeration.
func (*EnumDefinition) GetNodes ¶ added in v0.1.6
func (e *EnumDefinition) GetNodes() []Node[NodeType]
GetNodes returns the members of the enumeration.
func (*EnumDefinition) GetSourceUnitName ¶ added in v0.1.6
func (e *EnumDefinition) GetSourceUnitName() string
GetSourceUnitName returns the name of the source unit containing the enumeration.
func (*EnumDefinition) GetSrc ¶ added in v0.1.6
func (e *EnumDefinition) GetSrc() SrcNode
GetSrc returns the source information about the enumeration definition.
func (*EnumDefinition) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *EnumDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the enumeration.
func (*EnumDefinition) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *EnumDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the enumeration definition.
type ErrorDefinition ¶ added in v0.1.6
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:"node_type"` // Type of the node.
Src SrcNode `json:"src"` // Source location information.
Name string `json:"name"` // Name of the error definition.
Parameters *ParameterList `json:"parameters"` // List of error parameters.
TypeDescription *TypeDescription `json:"type_description"` // Type description of the error definition.
}
ErrorDefinition represents an error definition node in the abstract syntax tree.
func NewErrorDefinition ¶ added in v0.1.6
func NewErrorDefinition(b *ASTBuilder) *ErrorDefinition
NewErrorDefinition creates a new instance of ErrorDefinition with the provided ASTBuilder.
func (*ErrorDefinition) GetId ¶ added in v0.1.6
func (e *ErrorDefinition) GetId() int64
GetId returns the unique identifier of the error definition node.
func (*ErrorDefinition) GetName ¶ added in v0.1.6
func (e *ErrorDefinition) GetName() string
GetName returns the name of the error definition.
func (*ErrorDefinition) GetNodes ¶ added in v0.1.6
func (e *ErrorDefinition) GetNodes() []Node[NodeType]
GetNodes returns an empty slice of nodes associated with the error definition.
func (*ErrorDefinition) GetParameters ¶ added in v0.1.6
func (e *ErrorDefinition) GetParameters() *ParameterList
GetParameters returns the list of error parameters.
func (*ErrorDefinition) GetSourceUnitName ¶ added in v0.1.6
func (e *ErrorDefinition) GetSourceUnitName() string
GetSourceUnitName returns the source unit name associated with the error definition.
func (*ErrorDefinition) GetSrc ¶ added in v0.1.6
func (e *ErrorDefinition) GetSrc() SrcNode
GetSrc returns the source location information of the error definition node.
func (*ErrorDefinition) GetType ¶ added in v0.1.6
func (e *ErrorDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ErrorDefinition) GetTypeDescription ¶ added in v0.1.6
func (e *ErrorDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the error definition.
func (*ErrorDefinition) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (e *ErrorDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ErrorDefinition node.
func (*ErrorDefinition) ToProto ¶ added in v0.1.6
func (e *ErrorDefinition) ToProto() NodeType
ToProto converts the ErrorDefinition node to its corresponding protobuf representation.
type EventDefinition ¶ added in v0.1.6
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:"node_type"` // 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
}
EventDefinition represents an event definition in the Solidity abstract syntax tree (AST).
func NewEventDefinition ¶ added in v0.1.6
func NewEventDefinition(b *ASTBuilder) *EventDefinition
NewEventDefinition creates a new EventDefinition instance.
func (*EventDefinition) GetId ¶ added in v0.1.6
func (e *EventDefinition) GetId() int64
GetId returns the unique identifier of the event definition.
func (*EventDefinition) GetName ¶ added in v0.1.6
func (e *EventDefinition) GetName() string
GetName returns the name of the event.
func (*EventDefinition) GetNodes ¶ added in v0.1.6
func (e *EventDefinition) GetNodes() []Node[NodeType]
GetNodes returns the nodes representing the parameters of the event.
func (*EventDefinition) GetParameters ¶ added in v0.1.6
func (e *EventDefinition) GetParameters() *ParameterList
GetParameters returns the parameters of the event.
func (*EventDefinition) GetSrc ¶ added in v0.1.6
func (e *EventDefinition) GetSrc() SrcNode
GetSrc returns the source information about the event definition.
func (*EventDefinition) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *EventDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the event.
func (*EventDefinition) IsAnonymous ¶ added in v0.1.6
func (e *EventDefinition) IsAnonymous() bool
IsAnonymous returns whether the event is anonymous.
func (*EventDefinition) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *EventDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the event definition.
type ExprOperation ¶ added in v0.1.7
type ExprOperation struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the expression operation
NodeType ast_pb.NodeType `json:"node_type"` // Type of the node (EXPRESSION_OPERATION for expression operation)
Src SrcNode `json:"src"` // Source information about the expression operation
LeftExpression Node[NodeType] `json:"left_expression"` // Left expression in the operation
RightExpression Node[NodeType] `json:"right_expression"` // Right expression in the operation
TypeDescriptions []*TypeDescription `json:"type_descriptions"` // Type descriptions of the expressions
}
ExprOperation represents an expression operation in the Solidity abstract syntax tree (AST).
func NewExprOperationExpression ¶ added in v0.1.7
func NewExprOperationExpression(b *ASTBuilder) *ExprOperation
NewExprOperationExpression creates a new ExprOperation instance.
func (*ExprOperation) GetId ¶ added in v0.1.7
func (f *ExprOperation) GetId() int64
GetId returns the unique identifier of the expression operation.
func (*ExprOperation) GetLeftExpression ¶ added in v0.1.7
func (f *ExprOperation) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression in the operation.
func (*ExprOperation) GetNodes ¶ added in v0.1.7
func (f *ExprOperation) GetNodes() []Node[NodeType]
GetNodes returns the nodes representing the left and right expressions of the operation.
func (*ExprOperation) GetRightExpression ¶ added in v0.1.7
func (f *ExprOperation) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression in the operation.
func (*ExprOperation) GetSrc ¶ added in v0.1.7
func (f *ExprOperation) GetSrc() SrcNode
GetSrc returns the source information about the expression operation.
func (*ExprOperation) GetType ¶ added in v0.1.7
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 ¶ added in v0.1.7
func (f *ExprOperation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the expression operation.
func (*ExprOperation) Parse ¶ added in v0.1.7
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 ¶ added in v0.1.7
func (b *ExprOperation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ExprOperation node.
func (*ExprOperation) ToProto ¶ added in v0.1.7
func (f *ExprOperation) ToProto() NodeType
ToProto returns the protobuf representation of the expression operation.
type Expression ¶ added in v0.1.6
type Expression struct {
*ASTBuilder
}
Expression represents an AST node for an expression in Solidity.
func NewExpression ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (e *Expression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDecar *VariableDeclaration, exprNode Node[NodeType], 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. - exprNode: The 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.
type Fallback ¶ added in v0.1.7
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:"node_type"` // 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:"state_mutability"` // 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:"return_parameters"` // 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 ¶ added in v0.1.6
func NewFallbackDefinition(b *ASTBuilder) *Fallback
NewFallbackDefinition creates a new Fallback node with default values and returns it.
func (*Fallback) GetKind ¶ added in v0.1.7
GetKind returns the kind of the Fallback node, which is NodeType_FALLBACK.
func (*Fallback) GetModifiers ¶ added in v0.1.7
func (f *Fallback) GetModifiers() []*ModifierInvocation
GetModifiers returns a list of modifier invocations applied to the Fallback node.
func (*Fallback) GetNodes ¶ added in v0.1.7
GetNodes returns a slice of child nodes within the body of the fallback function.
func (*Fallback) GetOverrides ¶ added in v0.1.7
func (f *Fallback) GetOverrides() []*OverrideSpecifier
GetOverrides returns a list of override specifiers for the Fallback node.
func (*Fallback) GetParameters ¶ added in v0.1.7
func (f *Fallback) GetParameters() *ParameterList
GetParameters returns the list of parameters for the Fallback node.
func (*Fallback) GetReturnParameters ¶ added in v0.1.7
func (f *Fallback) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters for the Fallback node.
func (*Fallback) GetSrc ¶ added in v0.1.7
GetSrc returns the source location information of the Fallback node.
func (*Fallback) GetStateMutability ¶ added in v0.1.7
func (f *Fallback) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Fallback function.
func (*Fallback) GetType ¶ added in v0.1.7
GetType returns the type of the AST node, which is NodeType_FUNCTION_DEFINITION for a fallback function.
func (*Fallback) GetTypeDescription ¶ added in v0.1.7
func (f *Fallback) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Fallback node.
func (*Fallback) GetVisibility ¶ added in v0.1.7
func (f *Fallback) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Fallback function.
func (*Fallback) IsImplemented ¶ added in v0.1.7
IsImplemented returns true if the Fallback function is implemented, false otherwise.
func (*Fallback) IsVirtual ¶ added in v0.1.7
IsVirtual returns true if the Fallback function is virtual, false otherwise.
func (*Fallback) Parse ¶ added in v0.1.7
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 ¶ added in v0.1.7
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 ¶ added in v0.1.6
type ForStatement struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the ForStatement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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 ¶ added in v0.1.6
func NewForStatement(b *ASTBuilder) *ForStatement
NewForStatement creates a new ForStatement node with a given ASTBuilder.
func (*ForStatement) GetBody ¶ added in v0.1.6
func (f *ForStatement) GetBody() *BodyNode
GetBody returns the body of the for loop.
func (*ForStatement) GetClosure ¶ added in v0.1.6
func (f *ForStatement) GetClosure() Node[NodeType]
GetClosure returns the closure expression.
func (*ForStatement) GetCondition ¶ added in v0.1.6
func (f *ForStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression.
func (*ForStatement) GetId ¶ added in v0.1.6
func (f *ForStatement) GetId() int64
GetId returns the ID of the ForStatement node.
func (*ForStatement) GetInitialiser ¶ added in v0.1.6
func (f *ForStatement) GetInitialiser() Node[NodeType]
GetInitialiser returns the initialiser expression.
func (*ForStatement) GetNodes ¶ added in v0.1.6
func (f *ForStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the ForStatement node.
func (*ForStatement) GetSrc ¶ added in v0.1.6
func (f *ForStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the ForStatement node.
func (*ForStatement) GetType ¶ added in v0.1.6
func (f *ForStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ForStatement node.
func (*ForStatement) GetTypeDescription ¶ added in v0.1.6
func (f *ForStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the ForStatement node.
func (*ForStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (f *ForStatement) ToProto() NodeType
ToProto returns a protobuf representation of the ForStatement node.
type Function ¶ added in v0.1.6
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:"node_type"`
Kind ast_pb.NodeType `json:"kind"`
Src SrcNode `json:"src"`
Body *BodyNode `json:"body"`
Implemented bool `json:"implemented"`
Visibility ast_pb.Visibility `json:"visibility"`
StateMutability ast_pb.Mutability `json:"state_mutability"`
Virtual bool `json:"virtual"`
Modifiers []*ModifierInvocation `json:"modifiers"`
Overrides []*OverrideSpecifier `json:"overrides"`
Parameters *ParameterList `json:"parameters"`
ReturnParameters *ParameterList `json:"return_parameters"`
Scope int64 `json:"scope"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
TypeDescription *TypeDescription `json:"type_description"`
}
Function represents a Solidity function definition within an abstract syntax tree.
func NewFunction ¶ added in v0.1.6
func NewFunction(b *ASTBuilder) *Function
NewFunction creates and initializes a new Function node.
func (*Function) GetModifiers ¶ added in v0.1.6
func (f *Function) GetModifiers() []*ModifierInvocation
GetModifiers returns the list of modifier invocations applied to the Function node.
func (*Function) GetNodes ¶ added in v0.1.6
GetNodes returns a list of child nodes within the Function node.
func (*Function) GetOverrides ¶ added in v0.1.6
func (f *Function) GetOverrides() []*OverrideSpecifier
GetOverrides returns the list of override specifiers associated with the Function node.
func (*Function) GetParameters ¶ added in v0.1.6
func (f *Function) GetParameters() *ParameterList
GetParameters returns the list of parameters of the Function node.
func (*Function) GetReferencedDeclaration ¶ added in v0.1.6
GetReferencedDeclaration returns the referenced declaration identifier associated with the Function node.
func (*Function) GetReturnParameters ¶ added in v0.1.6
func (f *Function) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters of the Function node.
func (*Function) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the Function node.
func (*Function) GetStateMutability ¶ added in v0.1.6
func (f *Function) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Function node.
func (*Function) GetTypeDescription ¶ added in v0.1.6
func (f *Function) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the Function node.
func (*Function) GetVisibility ¶ added in v0.1.6
func (f *Function) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Function node.
func (*Function) IsImplemented ¶ added in v0.1.6
IsImplemented returns true if the Function node is implemented, false otherwise.
func (*Function) IsVirtual ¶ added in v0.1.6
IsVirtual returns true if the Function node is declared as virtual, false otherwise.
func (*Function) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (f *Function) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Function node.
type FunctionCall ¶ added in v0.1.6
type FunctionCall struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the node.
NodeType ast_pb.NodeType `json:"node_type"` // 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:"argument_types"` // 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:"referenced_declaration,omitempty"` // Referenced declaration of the function call.
TypeDescription *TypeDescription `json:"type_description"` // Type description of the function call.
}
FunctionCall represents a function call node in the AST.
func NewFunctionCall ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (f *FunctionCall) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the types of the arguments of the FunctionCall node.
func (*FunctionCall) GetArguments ¶ added in v0.1.6
func (f *FunctionCall) GetArguments() []Node[NodeType]
GetArguments returns the arguments of the FunctionCall node.
func (*FunctionCall) GetExpression ¶ added in v0.1.6
func (f *FunctionCall) GetExpression() Node[NodeType]
GetExpression returns the expression of the FunctionCall node.
func (*FunctionCall) GetId ¶ added in v0.1.6
func (f *FunctionCall) GetId() int64
GetId returns the unique identifier of the FunctionCall node.
func (*FunctionCall) GetKind ¶ added in v0.1.6
func (f *FunctionCall) GetKind() ast_pb.NodeType
GetKind returns the kind of the FunctionCall node.
func (*FunctionCall) GetNodes ¶ added in v0.1.6
func (f *FunctionCall) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the FunctionCall node.
func (*FunctionCall) GetReferenceDeclaration ¶ added in v0.1.6
func (f *FunctionCall) GetReferenceDeclaration() int64
GetReferenceDeclaration returns the referenced declaration of the FunctionCall node.
func (*FunctionCall) GetSrc ¶ added in v0.1.6
func (f *FunctionCall) GetSrc() SrcNode
GetSrc returns the source location of the FunctionCall node.
func (*FunctionCall) GetType ¶ added in v0.1.6
func (f *FunctionCall) GetType() ast_pb.NodeType
GetType returns the type of the FunctionCall node.
func (*FunctionCall) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (f *FunctionCall) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the FunctionCall node.
func (*FunctionCall) ToProto ¶ added in v0.1.6
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.
type FunctionCallOption ¶ added in v0.1.6
type FunctionCallOption struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the node.
NodeType ast_pb.NodeType `json:"node_type"` // 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:"referenced_declaration,omitempty"` // Referenced declaration of the function call.
TypeDescription *TypeDescription `json:"type_description"` // Type description of the function call.
}
FunctionCallOption represents a function call node in the AST.
func NewFunctionCallOption ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (f *FunctionCallOption) GetExpression() Node[NodeType]
GetExpression returns the expression of the FunctionCallOption node.
func (*FunctionCallOption) GetId ¶ added in v0.1.6
func (f *FunctionCallOption) GetId() int64
GetId returns the unique identifier of the FunctionCallOption node.
func (*FunctionCallOption) GetKind ¶ added in v0.1.6
func (f *FunctionCallOption) GetKind() ast_pb.NodeType
GetKind returns the kind of the FunctionCallOption node.
func (*FunctionCallOption) GetNodes ¶ added in v0.1.6
func (f *FunctionCallOption) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the FunctionCallOption node.
func (*FunctionCallOption) GetReferenceDeclaration ¶ added in v0.1.6
func (f *FunctionCallOption) GetReferenceDeclaration() int64
GetReferenceDeclaration returns the referenced declaration of the FunctionCallOption node.
func (*FunctionCallOption) GetSrc ¶ added in v0.1.6
func (f *FunctionCallOption) GetSrc() SrcNode
GetSrc returns the source location of the FunctionCallOption node.
func (*FunctionCallOption) GetType ¶ added in v0.1.6
func (f *FunctionCallOption) GetType() ast_pb.NodeType
GetType returns the type of the FunctionCallOption node.
func (*FunctionCallOption) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (f *FunctionCallOption) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the FunctionCallOption node.
func (*FunctionCallOption) ToProto ¶ added in v0.1.6
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.
type IfStatement ¶ added in v0.1.6
type IfStatement struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the if statement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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 ¶ added in v0.1.6
func NewIfStatement(b *ASTBuilder) *IfStatement
NewIfStatement creates a new instance of IfStatement with the provided ASTBuilder.
func (*IfStatement) GetBody ¶ added in v0.1.6
func (i *IfStatement) GetBody() Node[NodeType]
GetBody returns the body node of the if statement.
func (*IfStatement) GetCondition ¶ added in v0.1.6
func (i *IfStatement) GetCondition() Node[NodeType]
GetCondition returns the condition node of the if statement.
func (*IfStatement) GetId ¶ added in v0.1.6
func (i *IfStatement) GetId() int64
GetId returns the unique identifier of the if statement node.
func (*IfStatement) GetNodes ¶ added in v0.1.6
func (i *IfStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the if statement (condition and body).
func (*IfStatement) GetSrc ¶ added in v0.1.6
func (i *IfStatement) GetSrc() SrcNode
GetSrc returns the source location information of the if statement node.
func (*IfStatement) GetType ¶ added in v0.1.6
func (i *IfStatement) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*IfStatement) GetTypeDescription ¶ added in v0.1.6
func (i *IfStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the if statement.
func (*IfStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (i *IfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the IfStatement node.
func (*IfStatement) ToProto ¶ added in v0.1.6
func (i *IfStatement) ToProto() NodeType
ToProto converts the IfStatement node to its corresponding protobuf representation.
type Import ¶ added in v0.1.6
type Import struct {
Id int64 `json:"id"` // Unique identifier of the import node.
NodeType ast_pb.NodeType `json:"node_type"` // Type of the node.
Src SrcNode `json:"src"` // Source location information.
AbsolutePath string `json:"absolute_path"` // 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:"unit_alias"` // Alias of the imported unit.
SourceUnit int64 `json:"source_unit"` // Source unit identifier.
}
Import represents an import node in the abstract syntax tree.
func (*Import) GetAbsolutePath ¶ added in v0.1.6
GetAbsolutePath returns the absolute path of the imported file.
func (*Import) GetName ¶ added in v0.1.6
GetName returns the name of the imported file (excluding extension).
func (*Import) GetNodes ¶ added in v0.1.6
GetNodes returns an empty slice of nodes associated with the import.
func (*Import) GetSourceUnit ¶ added in v0.1.6
GetSourceUnit returns the source unit identifier of the import.
func (*Import) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the import node.
func (*Import) GetTypeDescription ¶ added in v0.1.6
func (i *Import) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the import node.
func (*Import) GetUnitAlias ¶ added in v0.1.6
GetUnitAlias returns the alias of the imported unit.
func (*Import) SetReferenceDescriptor ¶ added in v0.1.6
func (i *Import) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Import node.
type IndexAccess ¶ added in v0.1.6
type IndexAccess struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the IndexAccess node.
NodeType ast_pb.NodeType `json:"node_type"` // Type of the AST node.
Src SrcNode `json:"src"` // Source location information.
IndexExpression Node[NodeType] `json:"index_expression"` // Index expression.
BaseExpression Node[NodeType] `json:"base_expression"` // Base expression.
TypeDescriptions []*TypeDescription `json:"type_descriptions"` // Type descriptions.
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"` // Referenced declaration.
TypeDescription *TypeDescription `json:"type_description"` // Type description.
}
IndexAccess represents an index access expression in the AST.
func NewIndexAccess ¶ added in v0.1.6
func NewIndexAccess(b *ASTBuilder) *IndexAccess
NewIndexAccess creates a new IndexAccess node with a given ASTBuilder.
func (*IndexAccess) GetBaseExpression ¶ added in v0.1.6
func (i *IndexAccess) GetBaseExpression() Node[NodeType]
GetBaseExpression returns the base expression.
func (*IndexAccess) GetId ¶ added in v0.1.6
func (i *IndexAccess) GetId() int64
GetId returns the ID of the IndexAccess node.
func (*IndexAccess) GetIndexExpression ¶ added in v0.1.6
func (i *IndexAccess) GetIndexExpression() Node[NodeType]
GetIndexExpression returns the index expression.
func (*IndexAccess) GetName ¶ added in v0.2.1
func (i *IndexAccess) GetName() string
GetName returns the name of the IndexAccess node.
func (*IndexAccess) GetNodes ¶ added in v0.1.6
func (i *IndexAccess) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the IndexAccess node.
func (*IndexAccess) GetReferencedDeclaration ¶ added in v0.1.6
func (i *IndexAccess) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration.
func (*IndexAccess) GetSrc ¶ added in v0.1.6
func (i *IndexAccess) GetSrc() SrcNode
GetSrc returns the SrcNode of the IndexAccess node.
func (*IndexAccess) GetType ¶ added in v0.1.6
func (i *IndexAccess) GetType() ast_pb.NodeType
GetType returns the NodeType of the IndexAccess node.
func (*IndexAccess) GetTypeDescription ¶ added in v0.1.6
func (i *IndexAccess) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description.
func (*IndexAccess) GetTypeDescriptions ¶ added in v0.1.6
func (i *IndexAccess) GetTypeDescriptions() []*TypeDescription
GetTypeDescriptions returns the list of type descriptions.
func (*IndexAccess) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (i *IndexAccess) ToProto() NodeType
ToProto returns a protobuf representation of the IndexAccess node.
type IndexRange ¶ added in v0.1.6
type IndexRange struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
LeftExpression Node[NodeType] `json:"left_expression"`
RightExpression Node[NodeType] `json:"right_expression"`
TypeDescriptions []*TypeDescription `json:"type_descriptions"`
}
IndexRange represents an Index Range expression in the AST.
func NewIndexRangeAccessExpression ¶ added in v0.1.6
func NewIndexRangeAccessExpression(b *ASTBuilder) *IndexRange
NewIndexRange creates a new instance of IndexRange with initialized values.
func (*IndexRange) GetId ¶ added in v0.1.6
func (f *IndexRange) GetId() int64
GetId returns the unique identifier of the IndexRange node.
func (*IndexRange) GetLeftExpression ¶ added in v0.1.6
func (f *IndexRange) GetLeftExpression() Node[NodeType]
GetLeftExpression returns the left expression of the IndexRange.
func (*IndexRange) GetNodes ¶ added in v0.1.6
func (f *IndexRange) GetNodes() []Node[NodeType]
GetNodes returns the list of nodes within the IndexRange.
func (*IndexRange) GetRightExpression ¶ added in v0.1.6
func (f *IndexRange) GetRightExpression() Node[NodeType]
GetRightExpression returns the right expression of the IndexRange.
func (*IndexRange) GetSrc ¶ added in v0.1.6
func (f *IndexRange) GetSrc() SrcNode
GetSrc returns the source information of the IndexRange node.
func (*IndexRange) GetType ¶ added in v0.1.6
func (f *IndexRange) GetType() ast_pb.NodeType
GetType returns the node type of the IndexRange.
func (*IndexRange) GetTypeDescription ¶ added in v0.1.6
func (f *IndexRange) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the IndexRange.
func (*IndexRange) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (f *IndexRange) ToProto() NodeType
ToProto converts the IndexRange node to its Protocol Buffers representation.
type Interface ¶ added in v0.1.6
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:"node_type"` // Type of the AST node.
Src SrcNode `json:"src"` // Source location information.
Abstract bool `json:"abstract"` // Indicates whether the interface is abstract.
Kind ast_pb.NodeType `json:"kind"` // Kind of the interface.
FullyImplemented bool `json:"fully_implemented"` // Indicates whether the interface is fully implemented.
Nodes []Node[NodeType] `json:"nodes"` // List of child nodes within the interface.
LinearizedBaseContracts []int64 `json:"linearized_base_contracts"` // List of linearized base contract identifiers.
BaseContracts []*BaseContract `json:"base_contracts"` // List of base contracts.
ContractDependencies []int64 `json:"contract_dependencies"` // 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 ¶ added in v0.1.6
func NewInterfaceDefinition(b *ASTBuilder) *Interface
NewInterfaceDefinition creates a new Interface node with default values and returns it.
func (*Interface) GetBaseContracts ¶ added in v0.1.6
func (l *Interface) GetBaseContracts() []*BaseContract
GetBaseContracts returns a list of base contracts associated with the Interface.
func (*Interface) GetConstructor ¶ added in v0.1.7
func (l *Interface) GetConstructor() *Constructor
GetConstructor returns the constructor node within the Interface, if present.
func (*Interface) GetContractDependencies ¶ added in v0.1.6
GetContractDependencies returns a list of contract dependency identifiers for the Interface.
func (*Interface) GetEnums ¶ added in v0.1.7
func (l *Interface) GetEnums() []*EnumDefinition
GetEnums returns a list of enum definitions within the Interface.
func (*Interface) GetErrors ¶ added in v0.1.7
func (l *Interface) GetErrors() []*ErrorDefinition
GetErrors returns a list of error definitions within the Interface.
func (*Interface) GetEvents ¶ added in v0.1.7
func (l *Interface) GetEvents() []*EventDefinition
GetEvents returns a list of event definitions within the Interface.
func (*Interface) GetFallback ¶ added in v0.1.7
GetFallback returns the fallback function node within the Interface, if present.
func (*Interface) GetFunctions ¶ added in v0.1.7
GetFunctions returns a list of function definitions within the Interface.
func (*Interface) GetId ¶ added in v0.1.6
GetId returns the unique identifier of the Interface node.
func (*Interface) GetLinearizedBaseContracts ¶ added in v0.1.6
GetLinearizedBaseContracts returns a list of linearized base contract identifiers for the Interface.
func (*Interface) GetNodes ¶ added in v0.1.6
GetNodes returns a slice of child nodes within the interface.
func (*Interface) GetReceive ¶ added in v0.1.7
GetReceive returns the receive function node within the Interface, if present.
func (*Interface) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the Interface node.
func (*Interface) GetStateVariables ¶ added in v0.1.7
func (l *Interface) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns a list of state variable declarations within the Interface.
func (*Interface) GetStructs ¶ added in v0.1.7
func (l *Interface) GetStructs() []*StructDefinition
GetStructs returns a list of struct definitions within the Interface.
func (*Interface) GetType ¶ added in v0.1.6
GetType returns the type of the AST node, which is NodeType_CONTRACT_DEFINITION for an interface.
func (*Interface) GetTypeDescription ¶ added in v0.1.6
func (l *Interface) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Interface node.
func (*Interface) IsAbstract ¶ added in v0.1.6
IsAbstract returns true if the Interface is abstract, false otherwise.
func (*Interface) IsFullyImplemented ¶ added in v0.1.6
IsFullyImplemented returns true if the Interface is fully implemented, false otherwise.
func (*Interface) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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.
type Library ¶ added in v0.1.6
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:"node_type"` // NodeType is the type of the node.
Src SrcNode `json:"src"` // Src is the source node associated with 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:"fully_implemented"` // FullyImplemented indicates if the library is fully implemented.
Nodes []Node[NodeType] `json:"nodes"` // Nodes are the nodes associated with the library.
LinearizedBaseContracts []int64 `json:"linearized_base_contracts"` // LinearizedBaseContracts are the linearized base contracts of the library.
BaseContracts []*BaseContract `json:"base_contracts"` // BaseContracts are the base contracts of the library.
ContractDependencies []int64 `json:"contract_dependencies"` // ContractDependencies are the contract dependencies of the library.
Scope int64 `json:"scope"` // Scope is the scope 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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (l *Library) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the library.
func (*Library) GetConstructor ¶ added in v0.1.7
func (l *Library) GetConstructor() *Constructor
GetConstructor returns the constructor definition in the library.
func (*Library) GetContractDependencies ¶ added in v0.1.6
GetContractDependencies returns the contract dependencies of the library.
func (*Library) GetEnums ¶ added in v0.1.7
func (l *Library) GetEnums() []*EnumDefinition
GetEnums returns an array of enum definitions in the library.
func (*Library) GetErrors ¶ added in v0.1.7
func (l *Library) GetErrors() []*ErrorDefinition
GetErrors returns an array of error definitions in the library.
func (*Library) GetEvents ¶ added in v0.1.7
func (l *Library) GetEvents() []*EventDefinition
GetEvents returns an array of event definitions in the library.
func (*Library) GetFallback ¶ added in v0.1.7
GetFallback returns the fallback function definition in the library.
func (*Library) GetFunctions ¶ added in v0.1.7
GetFunctions returns an array of function definitions in the library.
func (*Library) GetLinearizedBaseContracts ¶ added in v0.1.6
GetLinearizedBaseContracts returns the linearized base contracts of the library.
func (*Library) GetReceive ¶ added in v0.1.7
GetReceive returns the receive function definition in the library.
func (*Library) GetSrc ¶ added in v0.1.6
GetSrc returns the source node associated with the library node.
func (*Library) GetStateVariables ¶ added in v0.1.7
func (l *Library) GetStateVariables() []*StateVariableDeclaration
GetStateVariables returns an array of state variable declarations in the library.
func (*Library) GetStructs ¶ added in v0.1.7
func (l *Library) GetStructs() []*StructDefinition
GetStructs returns an array of struct definitions in the library.
func (*Library) GetTypeDescription ¶ added in v0.1.6
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 ¶ added in v0.1.6
IsAbstract returns a boolean indicating whether the library is abstract.
func (*Library) IsFullyImplemented ¶ added in v0.1.6
IsFullyImplemented returns a boolean indicating whether the library is fully implemented.
func (*Library) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (l *Library) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Library node.
type LibraryName ¶ added in v0.1.6
type LibraryName struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Name string `json:"name"`
ReferencedDeclaration int64 `json:"referenced_declaration"`
}
LibraryName represents the name of an external library referenced in a using directive.
func (*LibraryName) ToProto ¶ added in v0.1.6
func (ln *LibraryName) ToProto() *ast_pb.LibraryName
ToProto converts the LibraryName instance to its corresponding protocol buffer representation.
type MemberAccessExpression ¶ added in v0.1.6
type MemberAccessExpression struct {
*ASTBuilder
Id int64 `json:"id"`
Constant bool `json:"is_constant"`
LValue bool `json:"is_l_value"`
Pure bool `json:"is_pure"`
LValueRequested bool `json:"l_value_requested"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Expression Node[NodeType] `json:"expression"`
MemberName string `json:"member_name"`
ArgumentTypes []*TypeDescription `json:"argument_types"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
TypeDescription *TypeDescription `json:"type_description"`
}
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 ¶ added in v0.1.6
func NewMemberAccessExpression(b *ASTBuilder) *MemberAccessExpression
NewMemberAccessExpression creates a new MemberAccessExpression instance with initial values.
func (*MemberAccessExpression) GetArgumentTypes ¶ added in v0.1.6
func (m *MemberAccessExpression) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the type descriptions of arguments in case of function call member access.
func (*MemberAccessExpression) GetExpression ¶ added in v0.1.6
func (m *MemberAccessExpression) GetExpression() Node[NodeType]
GetExpression returns the expression being accessed in the member access.
func (*MemberAccessExpression) GetId ¶ added in v0.1.6
func (m *MemberAccessExpression) GetId() int64
GetId returns the ID of the MemberAccessExpression node.
func (*MemberAccessExpression) GetMemberName ¶ added in v0.1.6
func (m *MemberAccessExpression) GetMemberName() string
GetMemberName returns the name of the accessed member.
func (*MemberAccessExpression) GetNodes ¶ added in v0.1.6
func (m *MemberAccessExpression) GetNodes() []Node[NodeType]
GetNodes returns the list of child nodes of the MemberAccessExpression node.
func (*MemberAccessExpression) GetReferencedDeclaration ¶ added in v0.1.6
func (m *MemberAccessExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the ID of the referenced declaration in the context of member access.
func (*MemberAccessExpression) GetSrc ¶ added in v0.1.6
func (m *MemberAccessExpression) GetSrc() SrcNode
GetSrc returns the source information of the MemberAccessExpression node.
func (*MemberAccessExpression) GetType ¶ added in v0.1.6
func (m *MemberAccessExpression) GetType() ast_pb.NodeType
GetType returns the NodeType of the MemberAccessExpression node.
func (*MemberAccessExpression) GetTypeDescription ¶ added in v0.1.6
func (m *MemberAccessExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the member access.
func (*MemberAccessExpression) IsConstant ¶ added in v0.1.6
func (m *MemberAccessExpression) IsConstant() bool
IsConstant returns whether the member access is constant.
func (*MemberAccessExpression) IsLValue ¶ added in v0.1.6
func (m *MemberAccessExpression) IsLValue() bool
IsLValue returns whether the member access is an l-value.
func (*MemberAccessExpression) IsLValueRequested ¶ added in v0.1.6
func (m *MemberAccessExpression) IsLValueRequested() bool
IsLValueRequested returns whether an l-value is requested in the context of member access.
func (*MemberAccessExpression) IsPure ¶ added in v0.1.6
func (m *MemberAccessExpression) IsPure() bool
IsPure returns whether the member access is pure.
func (*MemberAccessExpression) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (m *MemberAccessExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the MemberAccessExpression node.
func (*MemberAccessExpression) ToProto ¶ added in v0.1.6
func (m *MemberAccessExpression) ToProto() NodeType
ToProto converts the MemberAccessExpression node to its corresponding protobuf representation.
type MetaType ¶ added in v0.1.6
type MetaType struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the meta-type node.
NodeType ast_pb.NodeType `json:"node_type"` // Type of the node.
Name string `json:"name"` // Name of the meta-type.
Src SrcNode `json:"src"` // Source location information.
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"` // Referenced declaration identifier.
TypeDescription *TypeDescription `json:"type_description"` // Type description of the meta-type.
}
MetaType represents a meta-type node in the abstract syntax tree.
func NewMetaTypeExpression ¶ added in v0.1.6
func NewMetaTypeExpression(b *ASTBuilder) *MetaType
NewMetaTypeExpression creates a new instance of MetaType with the provided ASTBuilder.
func (*MetaType) GetNodes ¶ added in v0.1.6
GetNodes returns a slice of nodes associated with the meta-type.
func (*MetaType) GetReferencedDeclaration ¶ added in v0.1.6
GetReferencedDeclaration returns the referenced declaration identifier of the meta-type.
func (*MetaType) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the meta-type node.
func (*MetaType) GetTypeDescription ¶ added in v0.1.6
func (m *MetaType) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the meta-type.
func (*MetaType) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (m *MetaType) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the MetaType node.
type ModifierDefinition ¶ added in v0.1.6
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:"node_type"` // Type of the node.
Src SrcNode `json:"src"` // Source location information.
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 ¶ added in v0.1.6
func NewModifierDefinition(b *ASTBuilder) *ModifierDefinition
NewModifierDefinition creates a new instance of ModifierDefinition with the provided ASTBuilder.
func (*ModifierDefinition) GetBody ¶ added in v0.1.6
func (m *ModifierDefinition) GetBody() *BodyNode
GetBody returns the body node of the modifier.
func (*ModifierDefinition) GetId ¶ added in v0.1.6
func (m *ModifierDefinition) GetId() int64
GetId returns the unique identifier of the modifier definition node.
func (*ModifierDefinition) GetName ¶ added in v0.1.6
func (m *ModifierDefinition) GetName() string
GetName returns the name of the modifier.
func (*ModifierDefinition) GetNodes ¶ added in v0.1.6
func (m *ModifierDefinition) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the modifier definition (body statements).
func (*ModifierDefinition) GetParameters ¶ added in v0.1.6
func (m *ModifierDefinition) GetParameters() *ParameterList
GetParameters returns the parameter list of the modifier.
func (*ModifierDefinition) GetSrc ¶ added in v0.1.6
func (m *ModifierDefinition) GetSrc() SrcNode
GetSrc returns the source location information of the modifier definition node.
func (*ModifierDefinition) GetType ¶ added in v0.1.6
func (m *ModifierDefinition) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ModifierDefinition) GetTypeDescription ¶ added in v0.1.6
func (m *ModifierDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the modifier definition.
func (*ModifierDefinition) GetVisibility ¶ added in v0.1.6
func (m *ModifierDefinition) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the modifier.
func (*ModifierDefinition) IsVirtual ¶ added in v0.1.6
func (m *ModifierDefinition) IsVirtual() bool
IsVirtual returns true if the modifier is virtual.
func (*ModifierDefinition) ParseDefinition ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (m *ModifierDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ModifierDefinition node.
func (*ModifierDefinition) ToProto ¶ added in v0.1.6
func (m *ModifierDefinition) ToProto() NodeType
ToProto converts the ModifierDefinition node to its corresponding protobuf representation.
type ModifierInvocation ¶ added in v0.1.6
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:"node_type"` // 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:"argument_types"` // Types of the arguments.
Arguments []Node[NodeType] `json:"arguments"` // Argument nodes.
ModifierName *ModifierName `json:"modifier_name,omitempty"` // Modifier name node.
}
ModifierInvocation represents a modifier invocation node in the abstract syntax tree.
func NewModifierInvocation ¶ added in v0.1.6
func NewModifierInvocation(b *ASTBuilder) *ModifierInvocation
NewModifierInvocation creates a new instance of ModifierInvocation with the provided ASTBuilder.
func (*ModifierInvocation) GetArgumentTypes ¶ added in v0.1.6
func (m *ModifierInvocation) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns a slice of argument types of the modifier invocation.
func (*ModifierInvocation) GetArguments ¶ added in v0.1.6
func (m *ModifierInvocation) GetArguments() []Node[NodeType]
GetArguments returns a slice of argument nodes of the modifier invocation.
func (*ModifierInvocation) GetId ¶ added in v0.1.6
func (m *ModifierInvocation) GetId() int64
GetId returns the unique identifier of the modifier invocation node.
func (*ModifierInvocation) GetKind ¶ added in v0.1.6
func (m *ModifierInvocation) GetKind() ast_pb.NodeType
GetKind returns the kind of the modifier invocation.
func (*ModifierInvocation) GetName ¶ added in v0.1.6
func (m *ModifierInvocation) GetName() string
GetName returns the name of the modifier invocation.
func (*ModifierInvocation) GetNodes ¶ added in v0.1.6
func (m *ModifierInvocation) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes associated with the modifier invocation (arguments).
func (*ModifierInvocation) GetSrc ¶ added in v0.1.6
func (m *ModifierInvocation) GetSrc() SrcNode
GetSrc returns the source location information of the modifier invocation node.
func (*ModifierInvocation) GetType ¶ added in v0.1.6
func (m *ModifierInvocation) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*ModifierInvocation) GetTypeDescription ¶ added in v0.1.6
func (m *ModifierInvocation) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the modifier invocation (returns nil).
func (*ModifierInvocation) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (m *ModifierInvocation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the ModifierInvocation node.
func (*ModifierInvocation) ToProto ¶ added in v0.1.6
func (m *ModifierInvocation) ToProto() NodeType
ToProto converts the ModifierInvocation node to its corresponding protobuf representation.
type ModifierName ¶ added in v0.1.6
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:"node_type"` // 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 ¶ added in v0.1.6
func (m *ModifierName) ToProto() *ast_pb.ModifierName
ToProto converts the ModifierName node to its corresponding protobuf representation.
type NewExpr ¶ added in v0.1.6
type NewExpr struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
ArgumentTypes []*TypeDescription `json:"argument_types"`
TypeName *TypeName `json:"type_name"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
TypeDescription *TypeDescription `json:"type_description"`
}
NewExpr represents a new expression node in the AST. It contains information about the type being instantiated, type description, and related metadata.
func NewExprExpression ¶ added in v0.1.6
func NewExprExpression(b *ASTBuilder) *NewExpr
NewExprExpression creates a new NewExpr instance with initial values.
func (*NewExpr) GetArgumentTypes ¶ added in v0.1.6
func (n *NewExpr) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the type descriptions of arguments in the new expression.
func (*NewExpr) GetNodes ¶ added in v0.1.6
GetNodes returns the list of child nodes of the NewExpr node.
func (*NewExpr) GetReferencedDeclaration ¶ added in v0.1.6
GetReferencedDeclaration returns the ID of the referenced declaration in the context of new expression.
func (*NewExpr) GetTypeDescription ¶ added in v0.1.6
func (n *NewExpr) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the new expression.
func (*NewExpr) GetTypeName ¶ added in v0.1.6
GetTypeName returns the type name associated with the new expression.
func (*NewExpr) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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.
type NodeType ¶ added in v0.1.6
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 OverrideSpecifier ¶ added in v0.1.6
type OverrideSpecifier struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the override specifier node.
NodeType ast_pb.NodeType `json:"node_type"` // Type of the node.
Name string `json:"name"` // Name of the overridden identifier.
Src SrcNode `json:"src"` // Source location information.
ReferencedDeclaration int64 `json:"referenced_declaration"` // Referenced declaration identifier.
TypeDescription *TypeDescription `json:"type_descriptions"` // Type description of the override specifier.
}
OverrideSpecifier represents an override specifier node in the abstract syntax tree.
func NewOverrideSpecifier ¶ added in v0.1.6
func NewOverrideSpecifier(b *ASTBuilder) *OverrideSpecifier
NewOverrideSpecifier creates a new instance of OverrideSpecifier with the provided ASTBuilder.
func (*OverrideSpecifier) GetId ¶ added in v0.1.6
func (o *OverrideSpecifier) GetId() int64
GetId returns the unique identifier of the override specifier node.
func (*OverrideSpecifier) GetName ¶ added in v0.1.7
func (o *OverrideSpecifier) GetName() string
GetName returns the name of the identifier that is being overridden.
func (*OverrideSpecifier) GetNodes ¶ added in v0.1.7
func (o *OverrideSpecifier) GetNodes() []Node[NodeType]
GetNodes returns an empty slice of nodes associated with the override specifier.
func (*OverrideSpecifier) GetReferencedDeclaration ¶ added in v0.1.7
func (o *OverrideSpecifier) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration identifier of the override specifier.
func (*OverrideSpecifier) GetSrc ¶ added in v0.1.6
func (o *OverrideSpecifier) GetSrc() SrcNode
GetSrc returns the source location information of the override specifier node.
func (*OverrideSpecifier) GetType ¶ added in v0.1.6
func (o *OverrideSpecifier) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*OverrideSpecifier) GetTypeDescription ¶ added in v0.1.7
func (o *OverrideSpecifier) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the override specifier.
func (*OverrideSpecifier) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.7
func (o *OverrideSpecifier) SetReferenceDescriptor(refId int64, refType *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptor of the OverrideSpecifier.
func (*OverrideSpecifier) ToProto ¶ added in v0.1.6
func (o *OverrideSpecifier) ToProto() NodeType
ToProto converts the OverrideSpecifier node to its corresponding protobuf representation.
type Parameter ¶ added in v0.1.6
type Parameter struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the parameter node.
NodeType ast_pb.NodeType `json:"node_type"` // Type of the node.
Src SrcNode `json:"src"` // Source location information.
Scope int64 `json:"scope,omitempty"` // Scope of the parameter.
Name string `json:"name"` // Name of the parameter.
TypeName *TypeName `json:"type_name,omitempty"` // Type name of the parameter.
StorageLocation ast_pb.StorageLocation `json:"storage_location,omitempty"` // Storage location of the parameter.
Visibility ast_pb.Visibility `json:"visibility,omitempty"` // Visibility of the parameter.
StateMutability ast_pb.Mutability `json:"state_mutability,omitempty"` // State mutability of the parameter.
Constant bool `json:"constant,omitempty"` // Whether the parameter is constant.
StateVariable bool `json:"state_variable,omitempty"` // Whether the parameter is a state variable.
TypeDescription *TypeDescription `json:"type_description,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 ¶ added in v0.1.6
func NewParameter(b *ASTBuilder) *Parameter
NewParameter creates a new instance of Parameter with the provided ASTBuilder.
func (*Parameter) GetId ¶ added in v0.1.6
GetId returns the unique identifier of the parameter node.
func (*Parameter) GetNodes ¶ added in v0.1.6
GetNodes returns a slice of nodes associated with the parameter.
func (*Parameter) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the parameter node.
func (*Parameter) GetStateMutability ¶ added in v0.1.6
func (p *Parameter) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the parameter.
func (*Parameter) GetStorageLocation ¶ added in v0.1.6
func (p *Parameter) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the parameter.
func (*Parameter) GetTypeDescription ¶ added in v0.1.6
func (p *Parameter) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the parameter.
func (*Parameter) GetTypeName ¶ added in v0.1.6
GetTypeName returns the type name of the parameter.
func (*Parameter) GetVisibility ¶ added in v0.1.6
func (p *Parameter) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the parameter.
func (*Parameter) IsConstant ¶ added in v0.1.6
IsConstant returns whether the parameter is constant.
func (*Parameter) IsStateVariable ¶ added in v0.1.6
IsStateVariable returns whether the parameter is a state variable.
func (*Parameter) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (p *Parameter) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the Parameter node.
type ParameterList ¶ added in v0.1.6
type ParameterList struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Parameters []*Parameter `json:"parameters"`
ParameterTypes []*TypeDescription `json:"parameter_types"`
}
ParameterList represents a list of function or event parameters in the AST.
func NewParameterList ¶ added in v0.1.6
func NewParameterList(b *ASTBuilder) *ParameterList
NewParameterList creates a new instance of ParameterList using the provided ASTBuilder.
func (*ParameterList) GetId ¶ added in v0.1.6
func (p *ParameterList) GetId() int64
GetId returns the ID of the ParameterList node.
func (*ParameterList) GetNodes ¶ added in v0.1.6
func (p *ParameterList) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the ParameterList.
func (*ParameterList) GetParameterTypes ¶ added in v0.1.6
func (p *ParameterList) GetParameterTypes() []*TypeDescription
GetParameterTypes returns the list of parameter types in the ParameterList.
func (*ParameterList) GetParameters ¶ added in v0.1.6
func (p *ParameterList) GetParameters() []*Parameter
GetParameters returns the list of parameters in the ParameterList.
func (*ParameterList) GetSrc ¶ added in v0.1.6
func (p *ParameterList) GetSrc() SrcNode
GetSrc returns the source information of the ParameterList node.
func (*ParameterList) GetType ¶ added in v0.1.6
func (p *ParameterList) GetType() ast_pb.NodeType
GetType returns the NodeType of the ParameterList node.
func (*ParameterList) GetTypeDescription ¶ added in v0.1.6
func (p *ParameterList) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the ParameterList node.
func (*ParameterList) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (p *ParameterList) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ParameterList node.
func (*ParameterList) ToProto ¶ added in v0.1.6
func (p *ParameterList) ToProto() *ast_pb.ParameterList
ToProto converts the ParameterList into its corresponding Protocol Buffers representation.
type PathNode ¶ added in v0.1.6
type PathNode struct {
Id int64 `json:"id"`
Name string `json:"name"`
NodeType ast_pb.NodeType `json:"node_type"`
ReferencedDeclaration int64 `json:"referenced_declaration"`
Src SrcNode `json:"src"`
}
PathNode represents a path node within a TypeName.
type PayableConversion ¶ added in v0.1.6
type PayableConversion struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Arguments []Node[NodeType] `json:"arguments"`
ArgumentTypes []*TypeDescription `json:"argument_types"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
TypeDescription *TypeDescription `json:"type_description"`
Payable bool `json:"payable"`
}
PayableConversion represents a payable conversion expression in the AST.
func NewPayableConversionExpression ¶ added in v0.1.6
func NewPayableConversionExpression(b *ASTBuilder) *PayableConversion
NewPayableConversionExpression creates a new instance of PayableConversion using the provided ASTBuilder.
func (*PayableConversion) GetArgumentTypes ¶ added in v0.1.6
func (p *PayableConversion) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the list of argument types in the PayableConversion node.
func (*PayableConversion) GetArguments ¶ added in v0.1.6
func (p *PayableConversion) GetArguments() []Node[NodeType]
GetArguments returns the list of arguments in the PayableConversion node.
func (*PayableConversion) GetId ¶ added in v0.1.6
func (p *PayableConversion) GetId() int64
GetId returns the ID of the PayableConversion node.
func (*PayableConversion) GetNodes ¶ added in v0.1.6
func (p *PayableConversion) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the PayableConversion.
func (*PayableConversion) GetReferencedDeclaration ¶ added in v0.1.6
func (p *PayableConversion) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the ID of the referenced declaration.
func (*PayableConversion) GetSrc ¶ added in v0.1.6
func (p *PayableConversion) GetSrc() SrcNode
GetSrc returns the source information of the PayableConversion node.
func (*PayableConversion) GetType ¶ added in v0.1.6
func (p *PayableConversion) GetType() ast_pb.NodeType
GetType returns the NodeType of the PayableConversion node.
func (*PayableConversion) GetTypeDescription ¶ added in v0.1.6
func (p *PayableConversion) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the PayableConversion node.
func (*PayableConversion) IsPayable ¶ added in v0.1.6
func (p *PayableConversion) IsPayable() bool
IsPayable returns whether the PayableConversion is marked as payable.
func (*PayableConversion) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (p *PayableConversion) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the PayableConversion node.
func (*PayableConversion) ToProto ¶ added in v0.1.6
func (p *PayableConversion) ToProto() NodeType
ToProto converts the PayableConversion into its corresponding Protocol Buffers representation.
type Pragma ¶ added in v0.1.7
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:"node_type"`
// 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 ¶ added in v0.1.7
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 ¶ added in v0.1.7
GetLiterals returns a slice of strings that represent the literals of the pragma directive.
func (*Pragma) GetNodes ¶ added in v0.1.7
GetNodes returns the child nodes of the node. For a Pragma, this is always nil.
func (*Pragma) GetSrc ¶ added in v0.1.7
GetSrc returns the source information about the node, such as its line and column numbers in the source file.
func (*Pragma) GetType ¶ added in v0.1.7
GetType returns the type of the node. For a Pragma, this is always NodeType_PRAGMA_DIRECTIVE.
func (*Pragma) GetTypeDescription ¶ added in v0.1.7
func (p *Pragma) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the node. For a Pragma, this is always nil.
func (*Pragma) SetReferenceDescriptor ¶ added in v0.1.7
func (p *Pragma) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the Pragma node.
type PrimaryExpression ¶ added in v0.1.6
type PrimaryExpression struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the node.
NodeType ast_pb.NodeType `json:"node_type"` // 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:"hex_value,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:"type_name,omitempty"` // Type name of the node.
TypeDescription *TypeDescription `json:"type_description,omitempty"` // Type description of the node.
OverloadedDeclarations []int64 `json:"overloaded_declarations"` // Overloaded declarations of the node.
ReferencedDeclaration int64 `json:"referenced_declaration"` // Referenced declaration of the node.
Pure bool `json:"is_pure"` // Indicates if the node is pure.
ArgumentTypes []*TypeDescription `json:"argument_types,omitempty"` // Argument types of the node.
}
PrimaryExpression represents a primary expression node in the AST.
func NewPrimaryExpression ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (p *PrimaryExpression) GetArgumentTypes() []*TypeDescription
GetArgumentTypes returns the argument types of the PrimaryExpression node.
func (*PrimaryExpression) GetHexValue ¶ added in v0.1.6
func (p *PrimaryExpression) GetHexValue() string
GetHexValue returns the hexadecimal value of the PrimaryExpression node.
func (*PrimaryExpression) GetId ¶ added in v0.1.6
func (p *PrimaryExpression) GetId() int64
GetId returns the unique identifier of the PrimaryExpression node.
func (*PrimaryExpression) GetKind ¶ added in v0.1.6
func (p *PrimaryExpression) GetKind() ast_pb.NodeType
GetKind returns the kind of the PrimaryExpression node.
func (*PrimaryExpression) GetName ¶ added in v0.1.6
func (p *PrimaryExpression) GetName() string
GetName returns the name of the PrimaryExpression node.
func (*PrimaryExpression) GetNodes ¶ added in v0.1.6
func (p *PrimaryExpression) GetNodes() []Node[NodeType]
GetNodes returns a slice of nodes that includes the expression of the PrimaryExpression node.
func (*PrimaryExpression) GetOverloadedDeclarations ¶ added in v0.1.6
func (p *PrimaryExpression) GetOverloadedDeclarations() []int64
GetOverloadedDeclarations returns the overloaded declarations of the PrimaryExpression node.
func (*PrimaryExpression) GetReferencedDeclaration ¶ added in v0.1.6
func (p *PrimaryExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the PrimaryExpression node.
func (*PrimaryExpression) GetSrc ¶ added in v0.1.6
func (p *PrimaryExpression) GetSrc() SrcNode
GetSrc returns the source location of the PrimaryExpression node.
func (*PrimaryExpression) GetType ¶ added in v0.1.6
func (p *PrimaryExpression) GetType() ast_pb.NodeType
GetType returns the type of the PrimaryExpression node.
func (*PrimaryExpression) GetTypeDescription ¶ added in v0.1.6
func (p *PrimaryExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the PrimaryExpression node.
func (*PrimaryExpression) GetTypeName ¶ added in v0.1.7
func (p *PrimaryExpression) GetTypeName() *TypeName
GetTypeName returns the type name of the PrimaryExpression node.
func (*PrimaryExpression) GetValue ¶ added in v0.1.6
func (p *PrimaryExpression) GetValue() string
GetValue returns the value of the PrimaryExpression node.
func (*PrimaryExpression) IsPure ¶ added in v0.1.6
func (p *PrimaryExpression) IsPure() bool
IsPure returns true if the PrimaryExpression node is pure.
func (*PrimaryExpression) Parse ¶ added in v0.1.6
func (p *PrimaryExpression) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, vDeclar *VariableDeclaration, expNode Node[NodeType], 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) SetReferenceDescriptor ¶ added in v0.1.6
func (p *PrimaryExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the PrimaryExpression node.
func (*PrimaryExpression) ToProto ¶ added in v0.1.6
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 ¶ added in v0.1.7
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:"node_type"` // 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:"state_mutability"` // 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:"return_parameters"` // 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 ¶ added in v0.1.6
func NewReceiveDefinition(b *ASTBuilder) *Receive
NewReceiveDefinition creates a new Receive node with default values and returns it.
func (*Receive) GetKind ¶ added in v0.1.7
GetKind returns the kind of the Receive node, which is NodeType_RECEIVE.
func (*Receive) GetModifiers ¶ added in v0.1.7
func (f *Receive) GetModifiers() []*ModifierInvocation
GetModifiers returns a list of modifier invocations applied to the Receive node.
func (*Receive) GetNodes ¶ added in v0.1.7
GetNodes returns a slice of child nodes within the body of the receive function.
func (*Receive) GetOverrides ¶ added in v0.1.7
func (f *Receive) GetOverrides() []*OverrideSpecifier
GetOverrides returns a list of override specifiers for the Receive node.
func (*Receive) GetParameters ¶ added in v0.1.7
func (f *Receive) GetParameters() *ParameterList
GetParameters returns the list of parameters for the Receive node.
func (*Receive) GetReturnParameters ¶ added in v0.1.7
func (f *Receive) GetReturnParameters() *ParameterList
GetReturnParameters returns the list of return parameters for the Receive node.
func (*Receive) GetSrc ¶ added in v0.1.7
GetSrc returns the source location information of the Receive node.
func (*Receive) GetStateMutability ¶ added in v0.1.7
func (f *Receive) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the Receive function.
func (*Receive) GetType ¶ added in v0.1.7
GetType returns the type of the AST node, which is NodeType_FUNCTION_DEFINITION for a receive function.
func (*Receive) GetTypeDescription ¶ added in v0.1.7
func (f *Receive) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the Receive node (currently returns nil).
func (*Receive) GetVisibility ¶ added in v0.1.7
func (f *Receive) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the Receive function.
func (*Receive) IsImplemented ¶ added in v0.1.7
IsImplemented returns true if the Receive function is implemented, false otherwise.
func (*Receive) IsVirtual ¶ added in v0.1.7
IsVirtual returns true if the Receive function is virtual, false otherwise.
func (*Receive) Parse ¶ added in v0.1.7
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 ¶ added in v0.1.7
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.
type Resolver ¶ added in v0.1.6
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 ¶ added in v0.1.6
func NewResolver(builder *ASTBuilder) *Resolver
NewResolver creates a new Resolver with the provided ASTBuilder and initializes the UnprocessedNodes map.
func (*Resolver) GetUnprocessedCount ¶ added in v0.1.6
GetUnprocessedCount returns the number of UnprocessedNodes in the Resolver.
func (*Resolver) GetUnprocessedNodes ¶ added in v0.1.6
func (r *Resolver) GetUnprocessedNodes() map[int64]UnprocessedNode
GetUnprocessedNodes returns the map of UnprocessedNodes in the Resolver.
func (*Resolver) Resolve ¶ added in v0.1.6
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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
type ReturnStatement struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
FunctionReturnParameters int64 `json:"function_return_parameters"`
Expression Node[NodeType] `json:"expression"`
}
ReturnStatement represents a return statement in the AST.
func NewReturnStatement ¶ added in v0.1.6
func NewReturnStatement(b *ASTBuilder) *ReturnStatement
NewReturnStatement creates a new instance of ReturnStatement using the provided ASTBuilder.
func (*ReturnStatement) GetExpression ¶ added in v0.1.6
func (r *ReturnStatement) GetExpression() Node[NodeType]
GetExpression returns the expression associated with the ReturnStatement node.
func (*ReturnStatement) GetFunctionReturnParameters ¶ added in v0.1.6
func (r *ReturnStatement) GetFunctionReturnParameters() int64
GetFunctionReturnParameters returns the ID of the function's return parameters.
func (*ReturnStatement) GetId ¶ added in v0.1.6
func (r *ReturnStatement) GetId() int64
GetId returns the ID of the ReturnStatement node.
func (*ReturnStatement) GetNodes ¶ added in v0.1.6
func (r *ReturnStatement) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes contained in the ReturnStatement.
func (*ReturnStatement) GetSrc ¶ added in v0.1.6
func (r *ReturnStatement) GetSrc() SrcNode
GetSrc returns the source information of the ReturnStatement node.
func (*ReturnStatement) GetType ¶ added in v0.1.6
func (r *ReturnStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the ReturnStatement node.
func (*ReturnStatement) GetTypeDescription ¶ added in v0.1.6
func (r *ReturnStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the ReturnStatement's expression.
func (*ReturnStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (r *ReturnStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the ReturnStatement node.
func (*ReturnStatement) ToProto ¶ added in v0.1.6
func (r *ReturnStatement) ToProto() NodeType
ToProto converts the ReturnStatement into its corresponding Protocol Buffers representation.
type RevertStatement ¶ added in v0.1.6
type RevertStatement struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the RevertStatement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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 ¶ added in v0.1.6
func NewRevertStatement(b *ASTBuilder) *RevertStatement
NewRevertStatement creates a new RevertStatement node with a given ASTBuilder.
func (*RevertStatement) GetArguments ¶ added in v0.1.6
func (r *RevertStatement) GetArguments() []Node[NodeType]
GetArguments returns the list of argument expressions.
func (*RevertStatement) GetExpression ¶ added in v0.1.6
func (r *RevertStatement) GetExpression() Node[NodeType]
GetExpression returns the expression within the revert statement.
func (*RevertStatement) GetId ¶ added in v0.1.6
func (r *RevertStatement) GetId() int64
GetId returns the ID of the RevertStatement node.
func (*RevertStatement) GetNodes ¶ added in v0.1.6
func (r *RevertStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the RevertStatement node.
func (*RevertStatement) GetSrc ¶ added in v0.1.6
func (r *RevertStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the RevertStatement node.
func (*RevertStatement) GetType ¶ added in v0.1.6
func (r *RevertStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the RevertStatement node.
func (*RevertStatement) GetTypeDescription ¶ added in v0.1.6
func (r *RevertStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the RevertStatement node.
func (*RevertStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (r *RevertStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the RevertStatement node.
func (*RevertStatement) ToProto ¶ added in v0.1.6
func (r *RevertStatement) ToProto() NodeType
ToProto returns a protobuf representation of the RevertStatement node.
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:"node_type"`
// EntrySourceUnit is the entry source unit of the root node.
EntrySourceUnit int64 `json:"entry_source_unit"`
// 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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
GetComments returns the comments of the root node.
func (*RootNode) GetEntrySourceUnit ¶ added in v0.1.6
GetEntrySourceUnit returns the entry source unit of the root node.
func (*RootNode) GetSourceUnitById ¶ added in v0.1.7
func (r *RootNode) GetSourceUnitById(id int64) *SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnitById returns the source unit with the provided id.
func (*RootNode) GetSourceUnitByName ¶ added in v0.1.7
func (r *RootNode) GetSourceUnitByName(name string) *SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnitByName returns the source unit with the provided name.
func (*RootNode) GetSourceUnitCount ¶ added in v0.1.6
GetSourceUnitCount returns the number of source units of the root node.
func (*RootNode) GetSourceUnits ¶ added in v0.1.6
func (r *RootNode) GetSourceUnits() []*SourceUnit[Node[ast_pb.SourceUnit]]
GetSourceUnits returns the source units of the root node.
func (*RootNode) GetSrc ¶ added in v0.1.6
GetSrc returns the source code location of the RootNode node.
func (*RootNode) GetTypeDescription ¶ added in v0.1.6
func (r *RootNode) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the RootNode node. RootNode nodes do not have type descriptions.
func (*RootNode) HasSourceUnits ¶ added in v0.1.7
HasSourceUnits returns true if the root node has source units.
func (*RootNode) SetEntrySourceUnit ¶ added in v0.1.6
SetEntrySourceUnit sets the entry source unit of the root node.
func (*RootNode) SetReferenceDescriptor ¶ added in v0.1.6
func (r *RootNode) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the RootNode node.
func (*RootNode) ToProto ¶ added in v0.1.6
func (r *RootNode) ToProto() *ast_pb.RootSourceUnit
ToProto returns the protobuf representation of the root node.
type SimpleStatement ¶ added in v0.1.6
type SimpleStatement struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
}
SimpleStatement represents a simple statement in the AST.
func NewSimpleStatement ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (s *SimpleStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, parentNode Node[NodeType], ctx *parser.SimpleStatementContext, ) Node[NodeType]
Parse parses the SimpleStatement node from the provided context.
type SourceUnit ¶ added in v0.1.6
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:"base_contracts"` // BaseContracts are the base contracts of the source unit. License string `json:"license"` // License is the license of the source unit. ExportedSymbols []Symbol `json:"exported_symbols"` // ExportedSymbols is the list of source units, including its names and node tree ids used by current source unit. AbsolutePath string `json:"absolute_path"` // 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:"node_type"` // NodeType is the type of the AST node. 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 ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (s *SourceUnit[T]) GetAbsolutePath() string
GetAbsolutePath returns the absolute path of the source unit.
func (*SourceUnit[T]) GetBaseContracts ¶ added in v0.1.6
func (s *SourceUnit[T]) GetBaseContracts() []*BaseContract
GetBaseContracts returns the base contracts of the source unit.
func (*SourceUnit[T]) GetContract ¶ added in v0.1.6
func (s *SourceUnit[T]) GetContract() Node[NodeType]
GetContract returns the contract associated with the source unit.
func (*SourceUnit[T]) GetExportedSymbols ¶ added in v0.1.6
func (s *SourceUnit[T]) GetExportedSymbols() []Symbol
GetExportedSymbols returns the exported symbols of the source unit.
func (*SourceUnit[T]) GetId ¶ added in v0.1.6
func (s *SourceUnit[T]) GetId() int64
GetId returns the unique identifier of the source unit.
func (*SourceUnit[T]) GetImports ¶ added in v0.1.7
func (s *SourceUnit[T]) GetImports() []*Import
func (*SourceUnit[T]) GetLicense ¶ added in v0.1.6
func (s *SourceUnit[T]) GetLicense() string
GetLicense returns the license of the source unit.
func (*SourceUnit[T]) GetName ¶ added in v0.1.6
func (s *SourceUnit[T]) GetName() string
GetName returns the name of the source unit.
func (*SourceUnit[T]) GetNodes ¶ added in v0.1.6
func (s *SourceUnit[T]) GetNodes() []Node[NodeType]
GetNodes returns the nodes associated with the source unit.
func (*SourceUnit[T]) GetPragmas ¶ added in v0.1.7
func (s *SourceUnit[T]) GetPragmas() []*Pragma
func (*SourceUnit[T]) GetSrc ¶ added in v0.1.6
func (s *SourceUnit[T]) GetSrc() SrcNode
GetSrc returns the source code location of the source unit.
func (*SourceUnit[T]) GetType ¶ added in v0.1.6
func (s *SourceUnit[T]) GetType() ast_pb.NodeType
GetType returns the type of the source unit.
func (*SourceUnit[T]) GetTypeDescription ¶ added in v0.1.6
func (s *SourceUnit[T]) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the source unit.
func (*SourceUnit[T]) SetAbsolutePathFromSources ¶ added in v0.1.6
func (s *SourceUnit[T]) SetAbsolutePathFromSources(sources *solgo.Sources)
SetAbsolutePathFromSources sets the absolute path of the source unit from the provided sources.
func (*SourceUnit[T]) SetReferenceDescriptor ¶ added in v0.1.6
func (s *SourceUnit[T]) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the SourceUnit node.
func (*SourceUnit[T]) ToProto ¶ added in v0.1.6
func (s *SourceUnit[T]) ToProto() NodeType
ToProto converts the SourceUnit to a protocol buffer representation.
type SrcNode ¶ added in v0.1.6
type SrcNode struct {
Id int64 `json:"id"` // Unique identifier of the source node.
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:"parent_index"` // Index of the parent node in the source code.
}
SrcNode represents a node in the source code.
func (SrcNode) GetColumn ¶ added in v0.1.6
GetColumn returns the column number of the source node in the source code.
func (SrcNode) GetEnd ¶ added in v0.1.6
GetEnd returns the end position of the source node in the source code.
func (SrcNode) GetLength ¶ added in v0.1.6
GetLength returns the length of the source node in the source code.
func (SrcNode) GetLine ¶ added in v0.1.6
GetLine returns the line number of the source node in the source code.
func (SrcNode) GetParentIndex ¶ added in v0.1.6
GetParentIndex returns the index of the parent node in the source code.
type StateVariableDeclaration ¶ added in v0.1.6
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:"is_constant"` // Indicates if the state variable is constant
StateVariable bool `json:"is_state_variable"` // Indicates if the declaration is a state variable
NodeType ast_pb.NodeType `json:"node_type"` // 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:"type_description"` // Type description of the state variable declaration
Visibility ast_pb.Visibility `json:"visibility"` // Visibility of the state variable declaration
StorageLocation ast_pb.StorageLocation `json:"storage_location"` // Storage location of the state variable declaration
StateMutability ast_pb.Mutability `json:"mutability"` // State mutability of the state variable declaration
TypeName *TypeName `json:"type_name"` // Type name of the state variable
}
StateVariableDeclaration represents a state variable declaration in the Solidity abstract syntax tree (AST).
func NewStateVariableDeclaration ¶ added in v0.1.6
func NewStateVariableDeclaration(b *ASTBuilder) *StateVariableDeclaration
NewStateVariableDeclaration creates a new StateVariableDeclaration instance.
func (*StateVariableDeclaration) GetId ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetId() int64
GetId returns the unique identifier of the state variable declaration.
func (*StateVariableDeclaration) GetName ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetName() string
GetName returns the name of the state variable.
func (*StateVariableDeclaration) GetNodes ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetNodes() []Node[NodeType]
GetNodes returns the type name node in the state variable declaration.
func (*StateVariableDeclaration) GetReferencedDeclaration ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the type name in the state variable declaration.
func (*StateVariableDeclaration) GetScope ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetScope() int64
GetScope returns the scope of the state variable declaration.
func (*StateVariableDeclaration) GetSrc ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetSrc() SrcNode
GetSrc returns the source information about the state variable declaration.
func (*StateVariableDeclaration) GetStateMutability ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the state variable declaration.
func (*StateVariableDeclaration) GetStorageLocation ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the state variable declaration.
func (*StateVariableDeclaration) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the state variable declaration.
func (*StateVariableDeclaration) GetTypeName ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetTypeName() *TypeName
GetTypeName returns the type name of the state variable declaration.
func (*StateVariableDeclaration) GetVisibility ¶ added in v0.1.6
func (v *StateVariableDeclaration) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the state variable declaration.
func (*StateVariableDeclaration) IsConstant ¶ added in v0.1.6
func (v *StateVariableDeclaration) IsConstant() bool
IsConstant returns whether the state variable declaration is constant.
func (*StateVariableDeclaration) IsStateVariable ¶ added in v0.1.6
func (v *StateVariableDeclaration) IsStateVariable() bool
IsStateVariable returns whether the declaration is a state variable.
func (*StateVariableDeclaration) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (v *StateVariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the StateVariableDeclaration node.
func (*StateVariableDeclaration) ToProto ¶ added in v0.1.6
func (v *StateVariableDeclaration) ToProto() NodeType
ToProto returns the protobuf representation of the state variable declaration.
type StructDefinition ¶ added in v0.1.6
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:"node_type"` // Type of the node (STRUCT_DEFINITION for struct definition)
Src SrcNode `json:"src"` // Source information about the struct definition
Kind ast_pb.NodeType `json:"kind,omitempty"` // Kind of the struct definition (e.g., "contract")
Name string `json:"name"` // Name of the struct
CanonicalName string `json:"canonical_name"` // Canonical name of the struct
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"` // Referenced declaration of the struct definition
TypeDescription *TypeDescription `json:"type_description"` // 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:"storage_location"` // Storage location of the struct definition
}
StructDefinition represents a struct definition in the Solidity abstract syntax tree (AST).
func NewStructDefinition ¶ added in v0.1.6
func NewStructDefinition(b *ASTBuilder) *StructDefinition
NewStructDefinition creates a new StructDefinition instance.
func (*StructDefinition) GetCanonicalName ¶ added in v0.1.6
func (s *StructDefinition) GetCanonicalName() string
GetCanonicalName returns the canonical name of the struct definition.
func (*StructDefinition) GetId ¶ added in v0.1.6
func (s *StructDefinition) GetId() int64
GetId returns the unique identifier of the struct definition.
func (*StructDefinition) GetKind ¶ added in v0.1.6
func (s *StructDefinition) GetKind() ast_pb.NodeType
GetKind returns the kind of the struct definition.
func (*StructDefinition) GetMembers ¶ added in v0.1.6
func (s *StructDefinition) GetMembers() []*Parameter
GetMembers returns the members of the struct definition.
func (*StructDefinition) GetName ¶ added in v0.1.6
func (s *StructDefinition) GetName() string
GetName returns the name of the struct definition.
func (*StructDefinition) GetNodes ¶ added in v0.1.6
func (s *StructDefinition) GetNodes() []Node[NodeType]
GetNodes returns the members of the struct definition.
func (*StructDefinition) GetReferencedDeclaration ¶ added in v0.1.6
func (s *StructDefinition) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the struct definition.
func (*StructDefinition) GetSourceUnitName ¶ added in v0.1.6
func (s *StructDefinition) GetSourceUnitName() string
GetSourceUnitName returns the name of the source unit.
func (*StructDefinition) GetSrc ¶ added in v0.1.6
func (s *StructDefinition) GetSrc() SrcNode
GetSrc returns the source information about the struct definition.
func (*StructDefinition) GetStorageLocation ¶ added in v0.1.6
func (s *StructDefinition) GetStorageLocation() ast_pb.StorageLocation
GetStorageLocation returns the storage location of the struct definition.
func (*StructDefinition) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (s *StructDefinition) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the struct definition.
func (*StructDefinition) GetVisibility ¶ added in v0.1.6
func (s *StructDefinition) GetVisibility() ast_pb.Visibility
GetVisibility returns the visibility of the struct definition.
func (*StructDefinition) Parse ¶ added in v0.1.6
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) SetReferenceDescriptor ¶ added in v0.1.6
func (s *StructDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the StructDefinition node.
func (*StructDefinition) ToProto ¶ added in v0.1.6
func (s *StructDefinition) ToProto() NodeType
ToProto returns the protobuf representation of the struct definition.
type Symbol ¶ added in v0.1.6
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 NewSymbol ¶ added in v0.1.6
NewSymbol creates a new Symbol instance with the provided attributes.
func (Symbol) GetAbsolutePath ¶ added in v0.1.6
GetAbsolutePath returns the absolute path to the symbol.
type Tree ¶ added in v0.1.6
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 ¶ added in v0.1.6
func NewTree(b *ASTBuilder) *Tree
NewTree creates a new Tree with the provided ASTBuilder.
func (*Tree) AppendRootNodes ¶ added in v0.1.6
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) GetById ¶ added in v0.1.6
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) GetRoot ¶ added in v0.1.6
GetRoot returns the root node of the Abstract Syntax Tree (AST).
func (*Tree) SetRoot ¶ added in v0.1.6
SetRoot sets the root node of the Abstract Syntax Tree (AST).
func (*Tree) UpdateNodeReferenceById ¶ added in v0.1.6
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.
type TryStatement ¶ added in v0.1.6
type TryStatement struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the TryStatement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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.
Expression Node[NodeType] `json:"expression"` // Expression within the try block.
Clauses []Node[NodeType] `json:"clauses"` // List of catch clauses.
}
TryStatement represents a try-catch statement in the AST.
func NewTryStatement ¶ added in v0.1.6
func NewTryStatement(b *ASTBuilder) *TryStatement
NewTryStatement creates a new TryStatement node with a given ASTBuilder.
func (*TryStatement) GetBody ¶ added in v0.1.6
func (t *TryStatement) GetBody() *BodyNode
GetBody returns the body of the TryStatement node.
func (*TryStatement) GetClauses ¶ added in v0.1.6
func (t *TryStatement) GetClauses() []Node[NodeType]
GetClauses returns the list of catch clauses.
func (*TryStatement) GetExpression ¶ added in v0.1.6
func (t *TryStatement) GetExpression() Node[NodeType]
GetExpression returns the expression within the try block.
func (*TryStatement) GetId ¶ added in v0.1.6
func (t *TryStatement) GetId() int64
GetId returns the ID of the TryStatement node.
func (*TryStatement) GetImplemented ¶ added in v0.1.6
func (t *TryStatement) GetImplemented() bool
GetImplemented returns true if the try statement is implemented.
func (*TryStatement) GetKind ¶ added in v0.1.6
func (t *TryStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the try statement.
func (*TryStatement) GetNodes ¶ added in v0.1.6
func (t *TryStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the TryStatement node.
func (*TryStatement) GetSrc ¶ added in v0.1.6
func (t *TryStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the TryStatement node.
func (*TryStatement) GetType ¶ added in v0.1.6
func (t *TryStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the TryStatement node.
func (*TryStatement) GetTypeDescription ¶ added in v0.1.6
func (t *TryStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the TryStatement node.
func (*TryStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (t *TryStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TryStatement node.
func (*TryStatement) ToProto ¶ added in v0.1.6
func (t *TryStatement) ToProto() NodeType
ToProto returns a protobuf representation of the TryStatement node.
type TupleExpression ¶ added in v0.1.6
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:"node_type"` // Type of the node (TUPLE_EXPRESSION for a tuple expression)
Src SrcNode `json:"src"` // Source information about the tuple expression
Constant bool `json:"is_constant"` // Whether the tuple expression is constant
Pure bool `json:"is_pure"` // Whether the tuple expression is pure
Components []Node[NodeType] `json:"components"` // Components of the tuple expression
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"` // Referenced declaration of the tuple expression
TypeDescription *TypeDescription `json:"type_description"` // Type description of the tuple expression
}
TupleExpression represents a tuple expression in Solidity.
func NewTupleExpression ¶ added in v0.1.6
func NewTupleExpression(b *ASTBuilder) *TupleExpression
NewTupleExpression creates a new TupleExpression instance.
func (*TupleExpression) GetComponents ¶ added in v0.1.6
func (t *TupleExpression) GetComponents() []Node[NodeType]
GetComponents returns the components of the tuple expression.
func (*TupleExpression) GetId ¶ added in v0.1.6
func (t *TupleExpression) GetId() int64
GetId returns the unique identifier of the tuple expression.
func (*TupleExpression) GetNodes ¶ added in v0.1.6
func (t *TupleExpression) GetNodes() []Node[NodeType]
GetNodes returns the components of the tuple expression.
func (*TupleExpression) GetReferencedDeclaration ¶ added in v0.1.6
func (t *TupleExpression) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the tuple expression.
func (*TupleExpression) GetSrc ¶ added in v0.1.6
func (t *TupleExpression) GetSrc() SrcNode
GetSrc returns the source information about the tuple expression.
func (*TupleExpression) GetType ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (t *TupleExpression) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description of the tuple expression.
func (*TupleExpression) IsConstant ¶ added in v0.1.6
func (t *TupleExpression) IsConstant() bool
IsConstant returns whether the tuple expression is constant.
func (*TupleExpression) IsPure ¶ added in v0.1.6
func (t *TupleExpression) IsPure() bool
IsPure returns whether the tuple expression is pure.
func (*TupleExpression) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (t *TupleExpression) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TupleExpression node.
func (*TupleExpression) ToProto ¶ added in v0.1.6
func (t *TupleExpression) ToProto() NodeType
ToProto returns the protobuf representation of the tuple expression.
type TypeDescription ¶ added in v0.1.6
type TypeDescription struct {
TypeIdentifier string `json:"type_identifier"`
TypeString string `json:"type_string"`
}
TypeDescription represents a description of a type.
func (*TypeDescription) GetIdentifier ¶ added in v0.1.7
func (td *TypeDescription) GetIdentifier() string
GetIdentifier returns the type identifier of the TypeDescription.
func (*TypeDescription) GetString ¶ added in v0.1.7
func (td *TypeDescription) GetString() string
GetString returns the type string of the TypeDescription.
func (TypeDescription) ToProto ¶ added in v0.1.6
func (td TypeDescription) ToProto() *ast_pb.TypeDescription
ToProto converts the TypeDescription instance to its corresponding protocol buffer representation.
type TypeName ¶ added in v0.1.6
type TypeName struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Name string `json:"name,omitempty"`
TypeDescription *TypeDescription `json:"type_description,omitempty"`
KeyType *TypeName `json:"key_type,omitempty"`
ValueType *TypeName `json:"value_type,omitempty"`
PathNode *PathNode `json:"path_node,omitempty"`
StateMutability ast_pb.Mutability `json:"state_mutability,omitempty"`
ReferencedDeclaration int64 `json:"referenced_declaration"`
}
TypeName represents a type name used in Solidity code.
func NewTypeName ¶ added in v0.1.6
func NewTypeName(b *ASTBuilder) *TypeName
NewTypeName creates a new TypeName instance with the given ASTBuilder.
func (*TypeName) GetKeyType ¶ added in v0.1.6
GetKeyType returns the key type for mapping types.
func (*TypeName) GetNodes ¶ added in v0.1.6
GetNodes returns a list of child nodes for traversal within the TypeName.
func (*TypeName) GetPathNode ¶ added in v0.1.6
GetPathNode returns the path node associated with the TypeName.
func (*TypeName) GetReferencedDeclaration ¶ added in v0.1.6
GetReferencedDeclaration returns the referenced declaration of the TypeName.
func (*TypeName) GetSrc ¶ added in v0.1.6
GetSrc returns the source location information of the TypeName.
func (*TypeName) GetStateMutability ¶ added in v0.1.6
func (t *TypeName) GetStateMutability() ast_pb.Mutability
GetStateMutability returns the state mutability of the TypeName.
func (*TypeName) GetTypeDescription ¶ added in v0.1.6
func (t *TypeName) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the TypeName.
func (*TypeName) GetValueType ¶ added in v0.1.6
GetValueType returns the value type for mapping types.
func (*TypeName) Parse ¶ added in v0.1.6
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 ¶ added in v0.2.1
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) SetReferenceDescriptor ¶ added in v0.1.6
func (t *TypeName) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the TypeName node.
type UnaryPrefix ¶ added in v0.1.6
type UnaryPrefix struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Operator ast_pb.Operator `json:"operator"`
Prefix bool `json:"prefix"`
Constant bool `json:"is_constant"`
LValue bool `json:"is_l_value"`
Pure bool `json:"is_pure"`
LValueRequested bool `json:"l_value_requested"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
Expression Node[NodeType] `json:"expression"`
TypeDescription *TypeDescription `json:"type_description"`
}
UnaryPrefix represents a unary operation applied as a prefix to an expression.
func NewUnaryPrefixExpression ¶ added in v0.1.6
func NewUnaryPrefixExpression(b *ASTBuilder) *UnaryPrefix
NewUnaryPrefixExpression creates a new UnaryPrefix instance with the given ASTBuilder.
func (*UnaryPrefix) GetExpression ¶ added in v0.1.6
func (u *UnaryPrefix) GetExpression() Node[NodeType]
GetExpression returns the expression to which the unary operation is applied.
func (*UnaryPrefix) GetId ¶ added in v0.1.6
func (u *UnaryPrefix) GetId() int64
GetId returns the unique identifier of the UnaryPrefix.
func (*UnaryPrefix) GetNodes ¶ added in v0.1.6
func (u *UnaryPrefix) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UnaryPrefix.
func (*UnaryPrefix) GetOperator ¶ added in v0.1.6
func (u *UnaryPrefix) GetOperator() ast_pb.Operator
GetOperator returns the unary operator applied to the expression.
func (*UnaryPrefix) GetPrefix ¶ added in v0.1.6
func (u *UnaryPrefix) GetPrefix() bool
GetPrefix returns true if the unary operation is a prefix operation.
func (*UnaryPrefix) GetReferencedDeclaration ¶ added in v0.1.6
func (u *UnaryPrefix) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UnaryPrefix.
func (*UnaryPrefix) GetSrc ¶ added in v0.1.6
func (u *UnaryPrefix) GetSrc() SrcNode
GetSrc returns the source location information of the UnaryPrefix.
func (*UnaryPrefix) GetType ¶ added in v0.1.6
func (u *UnaryPrefix) GetType() ast_pb.NodeType
GetType returns the node type of the UnaryPrefix.
func (*UnaryPrefix) GetTypeDescription ¶ added in v0.1.6
func (u *UnaryPrefix) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UnaryPrefix.
func (*UnaryPrefix) IsConstant ¶ added in v0.1.6
func (u *UnaryPrefix) IsConstant() bool
IsConstant returns true if the operation's result is a constant.
func (*UnaryPrefix) IsLValue ¶ added in v0.1.6
func (u *UnaryPrefix) IsLValue() bool
IsLValue returns true if the expression is an l-value.
func (*UnaryPrefix) IsLValueRequested ¶ added in v0.1.6
func (u *UnaryPrefix) IsLValueRequested() bool
IsLValueRequested returns true if an l-value is requested from the operation.
func (*UnaryPrefix) IsPure ¶ added in v0.1.6
func (u *UnaryPrefix) IsPure() bool
IsPure returns true if the operation is pure, i.e., it doesn't modify state.
func (*UnaryPrefix) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (u *UnaryPrefix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UnaryPrefix node.
func (*UnaryPrefix) ToProto ¶ added in v0.1.6
func (u *UnaryPrefix) ToProto() NodeType
ToProto converts the UnaryPrefix instance to its corresponding protocol buffer representation.
type UnarySuffix ¶ added in v0.1.6
type UnarySuffix struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Operator ast_pb.Operator `json:"operator"`
Expression Node[NodeType] `json:"expression"`
ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`
TypeDescription *TypeDescription `json:"type_description"`
Prefix bool `json:"prefix"`
Constant bool `json:"is_constant"`
LValue bool `json:"is_l_value"`
Pure bool `json:"is_pure"`
LValueRequested bool `json:"l_value_requested"`
}
UnarySuffix represents a unary operation applied as a suffix to an expression.
func NewUnarySuffixExpression ¶ added in v0.1.6
func NewUnarySuffixExpression(b *ASTBuilder) *UnarySuffix
NewUnarySuffixExpression creates a new UnarySuffix instance with the given ASTBuilder.
func (*UnarySuffix) GetExpression ¶ added in v0.1.6
func (u *UnarySuffix) GetExpression() Node[NodeType]
GetExpression returns the expression to which the unary operation is applied.
func (*UnarySuffix) GetId ¶ added in v0.1.6
func (u *UnarySuffix) GetId() int64
GetId returns the unique identifier of the UnarySuffix.
func (*UnarySuffix) GetNodes ¶ added in v0.1.6
func (u *UnarySuffix) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UnarySuffix.
func (*UnarySuffix) GetOperator ¶ added in v0.1.6
func (u *UnarySuffix) GetOperator() ast_pb.Operator
GetOperator returns the unary operator applied to the expression.
func (*UnarySuffix) GetPrefix ¶ added in v0.1.6
func (u *UnarySuffix) GetPrefix() bool
GetPrefix returns true if the unary operation is a prefix operation.
func (*UnarySuffix) GetReferencedDeclaration ¶ added in v0.1.6
func (u *UnarySuffix) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UnarySuffix.
func (*UnarySuffix) GetSrc ¶ added in v0.1.6
func (u *UnarySuffix) GetSrc() SrcNode
GetSrc returns the source location information of the UnarySuffix.
func (*UnarySuffix) GetType ¶ added in v0.1.6
func (u *UnarySuffix) GetType() ast_pb.NodeType
GetType returns the node type of the UnarySuffix.
func (*UnarySuffix) GetTypeDescription ¶ added in v0.1.6
func (u *UnarySuffix) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UnarySuffix.
func (*UnarySuffix) IsConstant ¶ added in v0.1.6
func (u *UnarySuffix) IsConstant() bool
IsConstant returns true if the operation's result is a constant.
func (*UnarySuffix) IsLValue ¶ added in v0.1.6
func (u *UnarySuffix) IsLValue() bool
IsLValue returns true if the expression is an l-value.
func (*UnarySuffix) IsLValueRequested ¶ added in v0.1.6
func (u *UnarySuffix) IsLValueRequested() bool
IsLValueRequested returns true if an l-value is requested from the operation.
func (*UnarySuffix) IsPure ¶ added in v0.1.6
func (u *UnarySuffix) IsPure() bool
IsPure returns true if the operation is pure, i.e., it doesn't modify state.
func (*UnarySuffix) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (u *UnarySuffix) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UnarySuffix node.
func (*UnarySuffix) ToProto ¶ added in v0.1.6
func (u *UnarySuffix) ToProto() NodeType
ToProto converts the UnarySuffix instance to its corresponding protocol buffer representation.
type UnprocessedNode ¶ added in v0.1.6
type UnprocessedNode struct {
Id int64 `json:"id"`
Name string `json:"name"`
Node Node[NodeType] `json:"ref"`
}
UnprocessedNode is a structure that represents a node that could not be processed during the parsing of the AST.
type UsingDirective ¶ added in v0.1.6
type UsingDirective struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
TypeDescription *TypeDescription `json:"type_description"`
TypeName *TypeName `json:"type_name"`
LibraryName *LibraryName `json:"library_name"`
}
UsingDirective represents a Solidity using directive, which is used to import and use symbols from external libraries.
func NewUsingDirective ¶ added in v0.1.6
func NewUsingDirective(b *ASTBuilder) *UsingDirective
NewUsingDirective creates a new UsingDirective instance with the given ASTBuilder.
func (*UsingDirective) GetId ¶ added in v0.1.6
func (u *UsingDirective) GetId() int64
GetId returns the unique identifier of the UsingDirective.
func (*UsingDirective) GetLibraryName ¶ added in v0.1.6
func (u *UsingDirective) GetLibraryName() *LibraryName
GetLibraryName returns the library name associated with the UsingDirective.
func (*UsingDirective) GetNodes ¶ added in v0.1.6
func (u *UsingDirective) GetNodes() []Node[NodeType]
GetNodes returns a list of child nodes for traversal within the UsingDirective.
func (*UsingDirective) GetPathNode ¶ added in v0.1.6
func (u *UsingDirective) GetPathNode() *PathNode
GetPathNode returns the path node associated with the UsingDirective.
func (*UsingDirective) GetReferencedDeclaration ¶ added in v0.1.6
func (u *UsingDirective) GetReferencedDeclaration() int64
GetReferencedDeclaration returns the referenced declaration of the UsingDirective.
func (*UsingDirective) GetSrc ¶ added in v0.1.6
func (u *UsingDirective) GetSrc() SrcNode
GetSrc returns the source location information of the UsingDirective.
func (*UsingDirective) GetType ¶ added in v0.1.6
func (u *UsingDirective) GetType() ast_pb.NodeType
GetType returns the node type of the UsingDirective.
func (*UsingDirective) GetTypeDescription ¶ added in v0.1.6
func (u *UsingDirective) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the UsingDirective.
func (*UsingDirective) GetTypeName ¶ added in v0.1.6
func (u *UsingDirective) GetTypeName() *TypeName
GetTypeName returns the type name associated with the UsingDirective.
func (*UsingDirective) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (u *UsingDirective) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the UsingDirective node.
func (*UsingDirective) ToProto ¶ added in v0.1.6
func (u *UsingDirective) ToProto() NodeType
ToProto converts the UsingDirective instance to its corresponding protocol buffer representation.
type VariableDeclaration ¶ added in v0.1.6
type VariableDeclaration struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier of the variable declaration node.
NodeType ast_pb.NodeType `json:"node_type"` // 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:"initial_value,omitempty"` // Initial value node.
}
VariableDeclaration represents a variable declaration node in the abstract syntax tree.
func NewVariableDeclarationStatement ¶ added in v0.1.6
func NewVariableDeclarationStatement(b *ASTBuilder) *VariableDeclaration
NewVariableDeclarationStatement creates a new instance of VariableDeclaration with the provided ASTBuilder.
func (*VariableDeclaration) GetAssignments ¶ added in v0.1.6
func (v *VariableDeclaration) GetAssignments() []int64
GetAssignments returns a list of assignment identifiers associated with the variable declaration.
func (*VariableDeclaration) GetDeclarations ¶ added in v0.1.6
func (v *VariableDeclaration) GetDeclarations() []*Declaration
GetDeclarations returns a list of declaration nodes associated with the variable declaration.
func (*VariableDeclaration) GetId ¶ added in v0.1.6
func (v *VariableDeclaration) GetId() int64
GetId returns the unique identifier of the variable declaration node.
func (*VariableDeclaration) GetInitialValue ¶ added in v0.1.6
func (v *VariableDeclaration) GetInitialValue() Node[NodeType]
GetInitialValue returns the initial value node associated with the variable declaration.
func (*VariableDeclaration) GetNodes ¶ added in v0.1.6
func (v *VariableDeclaration) GetNodes() []Node[NodeType]
GetNodes returns a list of nodes associated with the variable declaration (initial value and declarations).
func (*VariableDeclaration) GetSrc ¶ added in v0.1.6
func (v *VariableDeclaration) GetSrc() SrcNode
GetSrc returns the source location information of the variable declaration node.
func (*VariableDeclaration) GetType ¶ added in v0.1.6
func (v *VariableDeclaration) GetType() ast_pb.NodeType
GetType returns the type of the node.
func (*VariableDeclaration) GetTypeDescription ¶ added in v0.1.6
func (v *VariableDeclaration) GetTypeDescription() *TypeDescription
GetTypeDescription returns the type description associated with the variable declaration.
func (*VariableDeclaration) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (v *VariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptors of the VariableDeclaration node.
func (*VariableDeclaration) ToProto ¶ added in v0.1.6
func (v *VariableDeclaration) ToProto() NodeType
ToProto converts the VariableDeclaration node to its corresponding protobuf representation.
type WhileStatement ¶ added in v0.1.6
type WhileStatement struct {
*ASTBuilder
Id int64 `json:"id"` // Unique identifier for the WhileStatement node.
NodeType ast_pb.NodeType `json:"node_type"` // 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 ¶ added in v0.1.6
func NewWhileStatement(b *ASTBuilder) *WhileStatement
NewWhileStatement creates a new WhileStatement node with a given ASTBuilder.
func (*WhileStatement) GetBody ¶ added in v0.1.6
func (w *WhileStatement) GetBody() *BodyNode
GetBody returns the body of the WhileStatement node.
func (*WhileStatement) GetCondition ¶ added in v0.1.6
func (w *WhileStatement) GetCondition() Node[NodeType]
GetCondition returns the condition expression of the WhileStatement node.
func (*WhileStatement) GetId ¶ added in v0.1.6
func (w *WhileStatement) GetId() int64
GetId returns the ID of the WhileStatement node.
func (*WhileStatement) GetKind ¶ added in v0.1.6
func (w *WhileStatement) GetKind() ast_pb.NodeType
GetKind returns the kind of the while loop.
func (*WhileStatement) GetNodes ¶ added in v0.1.6
func (w *WhileStatement) GetNodes() []Node[NodeType]
GetNodes returns the child nodes of the WhileStatement node.
func (*WhileStatement) GetSrc ¶ added in v0.1.6
func (w *WhileStatement) GetSrc() SrcNode
GetSrc returns the SrcNode of the WhileStatement node.
func (*WhileStatement) GetType ¶ added in v0.1.6
func (w *WhileStatement) GetType() ast_pb.NodeType
GetType returns the NodeType of the WhileStatement node.
func (*WhileStatement) GetTypeDescription ¶ added in v0.1.6
func (w *WhileStatement) GetTypeDescription() *TypeDescription
GetTypeDescription returns the TypeDescription of the WhileStatement node.
func (*WhileStatement) Parse ¶ added in v0.1.6
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 ¶ added in v0.1.6
func (w *WhileStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the WhileStatement node.
func (*WhileStatement) ToProto ¶ added in v0.1.6
func (w *WhileStatement) ToProto() NodeType
ToProto returns a protobuf representation of the WhileStatement node.
type YulStatement ¶ added in v0.1.6
type YulStatement struct {
*ASTBuilder
Id int64 `json:"id"`
NodeType ast_pb.NodeType `json:"node_type"`
Src SrcNode `json:"src"`
Statements []Node[NodeType] `json:"body"`
}
func NewYulStatement ¶ added in v0.1.6
func NewYulStatement(b *ASTBuilder) *YulStatement
func (*YulStatement) GetId ¶ added in v0.1.6
func (y *YulStatement) GetId() int64
func (*YulStatement) GetNodes ¶ added in v0.1.6
func (y *YulStatement) GetNodes() []Node[NodeType]
func (*YulStatement) GetSrc ¶ added in v0.1.6
func (y *YulStatement) GetSrc() SrcNode
func (*YulStatement) GetType ¶ added in v0.1.6
func (y *YulStatement) GetType() ast_pb.NodeType
func (*YulStatement) GetTypeDescription ¶ added in v0.1.6
func (y *YulStatement) GetTypeDescription() *TypeDescription
func (*YulStatement) Parse ¶ added in v0.1.6
func (y *YulStatement) Parse( unit *SourceUnit[Node[ast_pb.SourceUnit]], contractNode Node[NodeType], fnNode Node[NodeType], bodyNode *BodyNode, assemblyNode *AssemblyStatement, ctx *parser.YulStatementContext, ) Node[NodeType]
func (*YulStatement) SetReferenceDescriptor ¶ added in v0.1.6
func (y *YulStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool
SetReferenceDescriptor sets the reference descriptions of the YulStatement node.
func (*YulStatement) ToProto ¶ added in v0.1.6
func (y *YulStatement) ToProto() NodeType
Source Files
¶
- and_operation.go
- assembly.go
- assignment.go
- base_contract.go
- binary.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_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
- 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
- simple.go
- source_unit.go
- src.go
- state_variable.go
- struct.go
- symbols.go
- tree.go
- try.go
- tuple.go
- type_name.go
- unary_prefix.go
- unary_suffix.go
- using.go
- variable.go
- while.go
- yul.go
- yul_assignment.go