ast

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

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.

Index

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

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 license and any comments that code has. ANTLR parser by default have comments disabled to be parsed as tokens, so we need to search for them manually 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

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) ToPrettyJSON added in v0.1.6

func (b *ASTBuilder) ToPrettyJSON(data interface{}) ([]byte, error)

ToPrettyJSON converts the provided data to a pretty (indented) JSON byte array.

func (*ASTBuilder) ToProto added in v0.1.6

func (b *ASTBuilder) ToProto() *ast_pb.RootSourceUnit

func (*ASTBuilder) WriteJSONToFile added in v0.1.6

func (b *ASTBuilder) WriteJSONToFile(path string) error

WriteJSONToFile writes the root node of the AST as a JSON byte array to a file at the provided path.

func (*ASTBuilder) WriteToFile added in v0.1.6

func (b *ASTBuilder) WriteToFile(path string, data []byte) error

WriteToFile writes the provided data byte array to a file at the provided path.

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"`
	NodeType              ast_pb.NodeType  `json:"node_type"`
	Src                   SrcNode          `json:"src"`
	Expression            Node[NodeType]   `json:"expression,omitempty"`
	Operator              ast_pb.Operator  `json:"operator,omitempty"`
	LeftExpression        Node[NodeType]   `json:"left_expression,omitempty"`
	RightExpression       Node[NodeType]   `json:"right_expression,omitempty"`
	ReferencedDeclaration int64            `json:"referenced_declaration,omitempty"`
	TypeDescription       *TypeDescription `json:"type_description,omitempty"`
}

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

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]

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) GetId added in v0.1.6

func (b *BodyNode) GetId() int64

GetId returns the unique identifier of the body node.

func (*BodyNode) GetKind added in v0.1.6

func (b *BodyNode) GetKind() ast_pb.NodeType

GetKind returns the kind of the body node.

func (*BodyNode) GetNodes added in v0.1.6

func (b *BodyNode) GetNodes() []Node[NodeType]

GetNodes returns the nodes associated with the body node.

func (*BodyNode) GetSrc added in v0.1.6

func (b *BodyNode) GetSrc() SrcNode

GetSrc returns the source code location of the body node.

func (*BodyNode) GetStatements added in v0.1.6

func (b *BodyNode) GetStatements() []Node[NodeType]

GetStatements returns the statements associated with the body node.

func (*BodyNode) GetType added in v0.1.6

func (b *BodyNode) GetType() ast_pb.NodeType

GetType returns the type of 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

func (b *BodyNode) IsImplemented() bool

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.

func (*BodyNode) ToProto added in v0.1.6

func (b *BodyNode) ToProto() NodeType

ToProto converts the BodyNode to a protocol buffer representation.

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 is the unique identifier of the comment node.
	Id int64 `json:"id"`
	// Src is the source node locations of the comment node.
	Src SrcNode `json:"src"`
	// NodeType is the type of the AST node.
	NodeType ast_pb.NodeType `json:"node_type"`
	// Value is the value of the comment node.
	Text string `json:"text"`
}

func (*Comment) GetId added in v0.1.6

func (c *Comment) GetId() int64

func (*Comment) GetSrc added in v0.1.6

func (c *Comment) GetSrc() SrcNode

func (*Comment) GetText added in v0.1.6

func (c *Comment) GetText() string

func (*Comment) GetType added in v0.1.6

func (c *Comment) GetType() ast_pb.NodeType

func (*Comment) ToProto added in v0.1.6

func (c *Comment) ToProto() *ast_pb.Comment

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

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"`
}

func NewContinueStatement added in v0.1.6

func NewContinueStatement(b *ASTBuilder) *ContinueStatement

func (*ContinueStatement) GetId added in v0.1.6

func (b *ContinueStatement) GetId() int64

func (*ContinueStatement) GetNodes added in v0.1.6

func (b *ContinueStatement) GetNodes() []Node[NodeType]

func (*ContinueStatement) GetSrc added in v0.1.6

func (b *ContinueStatement) GetSrc() SrcNode

func (*ContinueStatement) GetType added in v0.1.6

func (b *ContinueStatement) GetType() ast_pb.NodeType

func (*ContinueStatement) GetTypeDescription added in v0.1.6

func (b *ContinueStatement) GetTypeDescription() *TypeDescription

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]

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.

func (*ContinueStatement) ToProto added in v0.1.6

func (b *ContinueStatement) ToProto() NodeType

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"`
}

func NewContractDefinition added in v0.1.6

func NewContractDefinition(b *ASTBuilder) *Contract

func (*Contract) GetBaseContracts added in v0.1.6

func (c *Contract) GetBaseContracts() []*BaseContract

func (*Contract) GetConstructor added in v0.1.7

func (s *Contract) GetConstructor() *Constructor

func (*Contract) GetContractDependencies added in v0.1.6

func (c *Contract) GetContractDependencies() []int64

func (*Contract) GetEnums added in v0.1.7

func (s *Contract) GetEnums() []*EnumDefinition

func (*Contract) GetErrors added in v0.1.7

func (s *Contract) GetErrors() []*ErrorDefinition

func (*Contract) GetEvents added in v0.1.7

func (s *Contract) GetEvents() []*EventDefinition

func (*Contract) GetFallback added in v0.1.7

func (s *Contract) GetFallback() *Fallback

func (*Contract) GetFunctions added in v0.1.7

func (s *Contract) GetFunctions() []*Function

func (*Contract) GetId added in v0.1.6

func (c *Contract) GetId() int64

func (*Contract) GetKind added in v0.1.6

func (c *Contract) GetKind() ast_pb.NodeType

func (*Contract) GetLinearizedBaseContracts added in v0.1.6

func (c *Contract) GetLinearizedBaseContracts() []int64

func (*Contract) GetName added in v0.1.6

func (c *Contract) GetName() string

func (*Contract) GetNodes added in v0.1.6

func (c *Contract) GetNodes() []Node[NodeType]

func (*Contract) GetReceive added in v0.1.7

func (s *Contract) GetReceive() *Receive

func (*Contract) GetSrc added in v0.1.6

func (c *Contract) GetSrc() SrcNode

func (*Contract) GetStateVariables added in v0.1.7

func (s *Contract) GetStateVariables() []*StateVariableDeclaration

func (*Contract) GetStructs added in v0.1.7

func (s *Contract) GetStructs() []*StructDefinition

func (*Contract) GetType added in v0.1.6

func (c *Contract) GetType() ast_pb.NodeType

func (*Contract) GetTypeDescription added in v0.1.6

func (c *Contract) GetTypeDescription() *TypeDescription

func (*Contract) IsAbstract added in v0.1.6

func (c *Contract) IsAbstract() bool

func (*Contract) IsFullyImplemented added in v0.1.6

func (c *Contract) IsFullyImplemented() bool

func (*Contract) Parse added in v0.1.6

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.

func (*Contract) ToProto added in v0.1.6

func (c *Contract) ToProto() NodeType

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"`
}

func NewDeclaration added in v0.1.6

func NewDeclaration(b *ASTBuilder) *Declaration

func (*Declaration) GetId added in v0.1.6

func (d *Declaration) GetId() int64

func (*Declaration) GetIsConstant added in v0.1.6

func (d *Declaration) GetIsConstant() bool

func (*Declaration) GetIsStateVariable added in v0.1.6

func (d *Declaration) GetIsStateVariable() bool

func (*Declaration) GetName added in v0.1.6

func (d *Declaration) GetName() string

func (*Declaration) GetNodes added in v0.1.6

func (d *Declaration) GetNodes() []Node[NodeType]

func (*Declaration) GetScope added in v0.1.6

func (d *Declaration) GetScope() int64

func (*Declaration) GetSrc added in v0.1.6

func (d *Declaration) GetSrc() SrcNode

func (*Declaration) GetStateMutability added in v0.1.6

func (d *Declaration) GetStateMutability() ast_pb.Mutability

func (*Declaration) GetStorageLocation added in v0.1.6

func (d *Declaration) GetStorageLocation() ast_pb.StorageLocation

func (*Declaration) GetType added in v0.1.6

func (d *Declaration) GetType() ast_pb.NodeType

func (*Declaration) GetTypeDescription added in v0.1.6

func (d *Declaration) GetTypeDescription() *TypeDescription

func (*Declaration) GetTypeName added in v0.1.6

func (d *Declaration) GetTypeName() *TypeName

func (*Declaration) GetVisibility added in v0.1.6

func (d *Declaration) GetVisibility() ast_pb.Visibility

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,
)

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

type DoWhileStatement added in v0.1.6

type DoWhileStatement struct {
	*ASTBuilder

	Id        int64           `json:"id"`
	NodeType  ast_pb.NodeType `json:"node_type"`
	Src       SrcNode         `json:"src"`
	Condition Node[NodeType]  `json:"condition"`
	Body      *BodyNode       `json:"body"`
}

func NewDoWhileStatement added in v0.1.6

func NewDoWhileStatement(b *ASTBuilder) *DoWhileStatement

func (*DoWhileStatement) GetBody added in v0.1.6

func (d *DoWhileStatement) GetBody() *BodyNode

func (*DoWhileStatement) GetCondition added in v0.1.6

func (d *DoWhileStatement) GetCondition() Node[NodeType]

func (*DoWhileStatement) GetId added in v0.1.6

func (d *DoWhileStatement) GetId() int64

func (*DoWhileStatement) GetNodes added in v0.1.6

func (d *DoWhileStatement) GetNodes() []Node[NodeType]

func (*DoWhileStatement) GetSrc added in v0.1.6

func (d *DoWhileStatement) GetSrc() SrcNode

func (*DoWhileStatement) GetType added in v0.1.6

func (d *DoWhileStatement) GetType() ast_pb.NodeType

func (*DoWhileStatement) GetTypeDescription added in v0.1.6

func (d *DoWhileStatement) GetTypeDescription() *TypeDescription

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]

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.

func (*DoWhileStatement) ToProto added in v0.1.6

func (d *DoWhileStatement) ToProto() NodeType

type Emit added in v0.1.6

type Emit struct {
	*ASTBuilder

	Id         int64            `json:"id"`
	NodeType   ast_pb.NodeType  `json:"node_type"`
	Src        SrcNode          `json:"src"`
	Arguments  []Node[NodeType] `json:"arguments"`
	Expression Node[NodeType]   `json:"expression"`
}

func NewEmitStatement added in v0.1.6

func NewEmitStatement(b *ASTBuilder) *Emit

func (*Emit) GetArguments added in v0.1.6

func (e *Emit) GetArguments() []Node[NodeType]

func (*Emit) GetExpression added in v0.1.6

func (e *Emit) GetExpression() Node[NodeType]

func (*Emit) GetId added in v0.1.6

func (e *Emit) GetId() int64

func (*Emit) GetNodes added in v0.1.6

func (e *Emit) GetNodes() []Node[NodeType]

func (*Emit) GetSrc added in v0.1.6

func (e *Emit) GetSrc() SrcNode

func (*Emit) GetType added in v0.1.6

func (e *Emit) GetType() ast_pb.NodeType

func (*Emit) GetTypeDescription added in v0.1.6

func (e *Emit) GetTypeDescription() *TypeDescription

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]

func (*Emit) SetReferenceDescriptor added in v0.1.6

func (e *Emit) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the Emit node.

func (*Emit) ToProto added in v0.1.6

func (e *Emit) ToProto() NodeType

type EnumDefinition added in v0.1.6

type EnumDefinition struct {
	*ASTBuilder
	SourceUnitName  string           `json:"-"`
	Id              int64            `json:"id"`
	NodeType        ast_pb.NodeType  `json:"node_type"`
	Src             SrcNode          `json:"src"`
	Name            string           `json:"name"`
	CanonicalName   string           `json:"canonical_name"`
	TypeDescription *TypeDescription `json:"type_description"`
	Members         []Node[NodeType] `json:"members"`
}

func NewEnumDefinition added in v0.1.6

func NewEnumDefinition(b *ASTBuilder) *EnumDefinition

func (*EnumDefinition) GetCanonicalName added in v0.1.6

func (e *EnumDefinition) GetCanonicalName() string

func (*EnumDefinition) GetId added in v0.1.6

func (e *EnumDefinition) GetId() int64

func (*EnumDefinition) GetMembers added in v0.1.6

func (e *EnumDefinition) GetMembers() []*Parameter

func (*EnumDefinition) GetName added in v0.1.6

func (e *EnumDefinition) GetName() string

func (*EnumDefinition) GetNodes added in v0.1.6

func (e *EnumDefinition) GetNodes() []Node[NodeType]

func (*EnumDefinition) GetSourceUnitName added in v0.1.6

func (e *EnumDefinition) GetSourceUnitName() string

func (*EnumDefinition) GetSrc added in v0.1.6

func (e *EnumDefinition) GetSrc() SrcNode

func (*EnumDefinition) GetType added in v0.1.6

func (e *EnumDefinition) GetType() ast_pb.NodeType

func (*EnumDefinition) GetTypeDescription added in v0.1.6

func (e *EnumDefinition) GetTypeDescription() *TypeDescription

func (*EnumDefinition) Parse added in v0.1.6

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

type ErrorDefinition added in v0.1.6

type ErrorDefinition struct {
	*ASTBuilder
	SourceUnitName  string           `json:"-"`
	Id              int64            `json:"id"`
	NodeType        ast_pb.NodeType  `json:"node_type"`
	Src             SrcNode          `json:"src"`
	Name            string           `json:"name"`
	Parameters      *ParameterList   `json:"parameters"`
	TypeDescription *TypeDescription `json:"type_description"`
}

func NewErrorDefinition added in v0.1.6

func NewErrorDefinition(b *ASTBuilder) *ErrorDefinition

func (*ErrorDefinition) GetId added in v0.1.6

func (e *ErrorDefinition) GetId() int64

func (*ErrorDefinition) GetName added in v0.1.6

func (e *ErrorDefinition) GetName() string

func (*ErrorDefinition) GetNodes added in v0.1.6

func (e *ErrorDefinition) GetNodes() []Node[NodeType]

func (*ErrorDefinition) GetParameters added in v0.1.6

func (e *ErrorDefinition) GetParameters() *ParameterList

func (*ErrorDefinition) GetSourceUnitName added in v0.1.6

func (e *ErrorDefinition) GetSourceUnitName() string

func (*ErrorDefinition) GetSrc added in v0.1.6

func (e *ErrorDefinition) GetSrc() SrcNode

func (*ErrorDefinition) GetType added in v0.1.6

func (e *ErrorDefinition) GetType() ast_pb.NodeType

func (*ErrorDefinition) GetTypeDescription added in v0.1.6

func (e *ErrorDefinition) GetTypeDescription() *TypeDescription

func (*ErrorDefinition) Parse added in v0.1.6

func (*ErrorDefinition) SetReferenceDescriptor added in v0.1.6

func (e *ErrorDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the ErrorDefinition node. We don't need to do any reference description updates here, at least for now...

func (*ErrorDefinition) ToProto added in v0.1.6

func (e *ErrorDefinition) ToProto() NodeType

type EventDefinition added in v0.1.6

type EventDefinition struct {
	*ASTBuilder
	SourceUnitName string          `json:"-"`
	Id             int64           `json:"id"`
	NodeType       ast_pb.NodeType `json:"node_type"`
	Src            SrcNode         `json:"src"`
	Parameters     *ParameterList  `json:"parameters"`
	Name           string          `json:"name"`
	Anonymous      bool            `json:"anonymous"`
}

func NewEventDefinition added in v0.1.6

func NewEventDefinition(b *ASTBuilder) *EventDefinition

func (*EventDefinition) GetId added in v0.1.6

func (e *EventDefinition) GetId() int64

func (*EventDefinition) GetName added in v0.1.6

func (e *EventDefinition) GetName() string

func (*EventDefinition) GetNodes added in v0.1.6

func (e *EventDefinition) GetNodes() []Node[NodeType]

func (*EventDefinition) GetParameters added in v0.1.6

func (e *EventDefinition) GetParameters() *ParameterList

func (*EventDefinition) GetSrc added in v0.1.6

func (e *EventDefinition) GetSrc() SrcNode

func (*EventDefinition) GetType added in v0.1.6

func (e *EventDefinition) GetType() ast_pb.NodeType

func (*EventDefinition) GetTypeDescription added in v0.1.6

func (e *EventDefinition) GetTypeDescription() *TypeDescription

func (*EventDefinition) IsAnonymous added in v0.1.6

func (e *EventDefinition) IsAnonymous() bool

func (*EventDefinition) Parse added in v0.1.6

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

type ExprOperation added in v0.1.7

type ExprOperation 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"`
}

func NewExprOperationExpression added in v0.1.7

func NewExprOperationExpression(b *ASTBuilder) *ExprOperation

func (*ExprOperation) GetId added in v0.1.7

func (f *ExprOperation) GetId() int64

func (*ExprOperation) GetLeftExpression added in v0.1.7

func (f *ExprOperation) GetLeftExpression() Node[NodeType]

func (*ExprOperation) GetNodes added in v0.1.7

func (f *ExprOperation) GetNodes() []Node[NodeType]

func (*ExprOperation) GetRightExpression added in v0.1.7

func (f *ExprOperation) GetRightExpression() Node[NodeType]

func (*ExprOperation) GetSrc added in v0.1.7

func (f *ExprOperation) GetSrc() SrcNode

func (*ExprOperation) GetType added in v0.1.7

func (f *ExprOperation) GetType() ast_pb.NodeType

func (*ExprOperation) GetTypeDescription added in v0.1.7

func (f *ExprOperation) GetTypeDescription() *TypeDescription

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]

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

type Expression added in v0.1.6

type Expression struct {
	*ASTBuilder
}

func NewExpression added in v0.1.6

func NewExpression(b *ASTBuilder) *Expression

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]

type Fallback added in v0.1.7

type Fallback struct {
	*ASTBuilder

	Id               int64                 `json:"id"`
	NodeType         ast_pb.NodeType       `json:"node_type"`
	Kind             ast_pb.NodeType       `json:"kind"`
	Src              SrcNode               `json:"src"`
	Implemented      bool                  `json:"implemented"`
	Visibility       ast_pb.Visibility     `json:"visibility"`
	StateMutability  ast_pb.Mutability     `json:"state_mutability"`
	Modifiers        []*ModifierInvocation `json:"modifiers"`
	Overrides        []*OverrideSpecifier  `json:"overrides"`
	Parameters       *ParameterList        `json:"parameters"`
	ReturnParameters *ParameterList        `json:"return_parameters"`
	Body             *BodyNode             `json:"body"`
	Virtual          bool                  `json:"virtual"`
}

func NewFallbackDefinition added in v0.1.6

func NewFallbackDefinition(b *ASTBuilder) *Fallback

func (*Fallback) GetBody added in v0.1.7

func (f *Fallback) GetBody() *BodyNode

func (*Fallback) GetId added in v0.1.7

func (f *Fallback) GetId() int64

func (*Fallback) GetKind added in v0.1.7

func (f *Fallback) GetKind() ast_pb.NodeType

func (*Fallback) GetModifiers added in v0.1.7

func (f *Fallback) GetModifiers() []*ModifierInvocation

func (*Fallback) GetNodes added in v0.1.7

func (f *Fallback) GetNodes() []Node[NodeType]

func (*Fallback) GetOverrides added in v0.1.7

func (f *Fallback) GetOverrides() []*OverrideSpecifier

func (*Fallback) GetParameters added in v0.1.7

func (f *Fallback) GetParameters() *ParameterList

func (*Fallback) GetReturnParameters added in v0.1.7

func (f *Fallback) GetReturnParameters() *ParameterList

func (*Fallback) GetSrc added in v0.1.7

func (f *Fallback) GetSrc() SrcNode

func (*Fallback) GetStateMutability added in v0.1.7

func (f *Fallback) GetStateMutability() ast_pb.Mutability

func (*Fallback) GetType added in v0.1.7

func (f *Fallback) GetType() ast_pb.NodeType

func (*Fallback) GetTypeDescription added in v0.1.7

func (f *Fallback) GetTypeDescription() *TypeDescription

func (*Fallback) GetVisibility added in v0.1.7

func (f *Fallback) GetVisibility() ast_pb.Visibility

func (*Fallback) IsImplemented added in v0.1.7

func (f *Fallback) IsImplemented() bool

func (*Fallback) IsVirtual added in v0.1.7

func (f *Fallback) IsVirtual() bool

func (*Fallback) Parse added in v0.1.7

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. We don't need to do any reference description updates here, at least for now...

func (*Fallback) ToProto added in v0.1.7

func (f *Fallback) ToProto() NodeType

type ForStatement added in v0.1.6

type ForStatement struct {
	*ASTBuilder

	Id          int64           `json:"id"`
	NodeType    ast_pb.NodeType `json:"node_type"`
	Src         SrcNode         `json:"src"`
	Initialiser Node[NodeType]  `json:"initialiser"`
	Condition   Node[NodeType]  `json:"condition"`
	Closure     Node[NodeType]  `json:"closure"`
	Body        *BodyNode       `json:"body"`
}

func NewForStatement added in v0.1.6

func NewForStatement(b *ASTBuilder) *ForStatement

func (*ForStatement) GetBody added in v0.1.6

func (f *ForStatement) GetBody() *BodyNode

func (*ForStatement) GetClosure added in v0.1.6

func (f *ForStatement) GetClosure() Node[NodeType]

func (*ForStatement) GetCondition added in v0.1.6

func (f *ForStatement) GetCondition() Node[NodeType]

func (*ForStatement) GetId added in v0.1.6

func (f *ForStatement) GetId() int64

func (*ForStatement) GetInitialiser added in v0.1.6

func (f *ForStatement) GetInitialiser() Node[NodeType]

func (*ForStatement) GetNodes added in v0.1.6

func (f *ForStatement) GetNodes() []Node[NodeType]

func (*ForStatement) GetSrc added in v0.1.6

func (f *ForStatement) GetSrc() SrcNode

func (*ForStatement) GetType added in v0.1.6

func (f *ForStatement) GetType() ast_pb.NodeType

func (*ForStatement) GetTypeDescription added in v0.1.6

func (f *ForStatement) GetTypeDescription() *TypeDescription

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

type Function added in v0.1.6

type Function struct {
	*ASTBuilder

	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"`
}

func NewFunction added in v0.1.6

func NewFunction(b *ASTBuilder) *Function

func (*Function) GetBody added in v0.1.6

func (f *Function) GetBody() *BodyNode

func (*Function) GetId added in v0.1.6

func (f *Function) GetId() int64

func (*Function) GetKind added in v0.1.6

func (f *Function) GetKind() ast_pb.NodeType

func (*Function) GetModifiers added in v0.1.6

func (f *Function) GetModifiers() []*ModifierInvocation

func (*Function) GetName added in v0.1.6

func (f *Function) GetName() string

func (*Function) GetNodes added in v0.1.6

func (f *Function) GetNodes() []Node[NodeType]

func (*Function) GetOverrides added in v0.1.6

func (f *Function) GetOverrides() []*OverrideSpecifier

func (*Function) GetParameters added in v0.1.6

func (f *Function) GetParameters() *ParameterList

func (*Function) GetReferencedDeclaration added in v0.1.6

func (f *Function) GetReferencedDeclaration() int64

func (*Function) GetReturnParameters added in v0.1.6

func (f *Function) GetReturnParameters() *ParameterList

func (*Function) GetScope added in v0.1.6

func (f *Function) GetScope() int64

func (*Function) GetSrc added in v0.1.6

func (f *Function) GetSrc() SrcNode

func (*Function) GetStateMutability added in v0.1.6

func (f *Function) GetStateMutability() ast_pb.Mutability

func (*Function) GetType added in v0.1.6

func (f *Function) GetType() ast_pb.NodeType

func (*Function) GetTypeDescription added in v0.1.6

func (f *Function) GetTypeDescription() *TypeDescription

func (*Function) GetVisibility added in v0.1.6

func (f *Function) GetVisibility() ast_pb.Visibility

func (*Function) IsImplemented added in v0.1.6

func (f *Function) IsImplemented() bool

func (*Function) IsVirtual added in v0.1.6

func (f *Function) IsVirtual() bool

func (*Function) Parse added in v0.1.6

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.

func (*Function) ToProto added in v0.1.6

func (f *Function) ToProto() NodeType

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]

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"`
	NodeType  ast_pb.NodeType `json:"node_type"`
	Src       SrcNode         `json:"src"`
	Condition Node[NodeType]  `json:"condition"`
	Body      Node[NodeType]  `json:"body"`
}

func NewIfStatement added in v0.1.6

func NewIfStatement(b *ASTBuilder) *IfStatement

func (*IfStatement) GetBody added in v0.1.6

func (i *IfStatement) GetBody() Node[NodeType]

func (*IfStatement) GetCondition added in v0.1.6

func (i *IfStatement) GetCondition() Node[NodeType]

func (*IfStatement) GetId added in v0.1.6

func (i *IfStatement) GetId() int64

func (*IfStatement) GetNodes added in v0.1.6

func (i *IfStatement) GetNodes() []Node[NodeType]

func (*IfStatement) GetSrc added in v0.1.6

func (i *IfStatement) GetSrc() SrcNode

func (*IfStatement) GetType added in v0.1.6

func (i *IfStatement) GetType() ast_pb.NodeType

func (*IfStatement) GetTypeDescription added in v0.1.6

func (i *IfStatement) GetTypeDescription() *TypeDescription

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]

func (*IfStatement) SetReferenceDescriptor added in v0.1.6

func (i *IfStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the IfStatement node.

func (*IfStatement) ToProto added in v0.1.6

func (i *IfStatement) ToProto() NodeType

type Import added in v0.1.6

type Import struct {
	// Id is the unique identifier of the import node.
	Id int64 `json:"id"`

	NodeType     ast_pb.NodeType `json:"node_type"`
	Src          SrcNode         `json:"src"`
	AbsolutePath string          `json:"absolute_path"`
	File         string          `json:"file"`
	Scope        int64           `json:"scope"`
	UnitAlias    string          `json:"unit_alias"`
	SourceUnit   int64           `json:"source_unit"`
}

func (*Import) GetAbsolutePath added in v0.1.6

func (i *Import) GetAbsolutePath() string

func (*Import) GetFile added in v0.1.6

func (i *Import) GetFile() string

func (*Import) GetId added in v0.1.6

func (i *Import) GetId() int64

func (*Import) GetName added in v0.1.6

func (i *Import) GetName() string

func (*Import) GetNodes added in v0.1.6

func (i *Import) GetNodes() []Node[NodeType]

func (*Import) GetScope added in v0.1.6

func (i *Import) GetScope() int64

func (*Import) GetSourceUnit added in v0.1.6

func (i *Import) GetSourceUnit() int64

func (*Import) GetSrc added in v0.1.6

func (i *Import) GetSrc() SrcNode

func (*Import) GetType added in v0.1.6

func (i *Import) GetType() ast_pb.NodeType

func (*Import) GetTypeDescription added in v0.1.6

func (i *Import) GetTypeDescription() *TypeDescription

func (*Import) GetUnitAlias added in v0.1.6

func (i *Import) GetUnitAlias() string

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.

func (*Import) ToProto added in v0.1.6

func (i *Import) ToProto() NodeType

type IndexAccess added in v0.1.6

type IndexAccess struct {
	*ASTBuilder

	Id                    int64              `json:"id"`
	NodeType              ast_pb.NodeType    `json:"node_type"`
	Src                   SrcNode            `json:"src"`
	IndexExpression       Node[NodeType]     `json:"index_expression"`
	BaseExpression        Node[NodeType]     `json:"base_expression"`
	TypeDescriptions      []*TypeDescription `json:"type_descriptions"`
	ReferencedDeclaration int64              `json:"referenced_declaration,omitempty"`
	TypeDescription       *TypeDescription   `json:"type_description"`
}

func NewIndexAccess added in v0.1.6

func NewIndexAccess(b *ASTBuilder) *IndexAccess

func (*IndexAccess) GetBaseExpression added in v0.1.6

func (i *IndexAccess) GetBaseExpression() Node[NodeType]

func (*IndexAccess) GetId added in v0.1.6

func (i *IndexAccess) GetId() int64

func (*IndexAccess) GetIndexExpression added in v0.1.6

func (i *IndexAccess) GetIndexExpression() Node[NodeType]

func (*IndexAccess) GetNodes added in v0.1.6

func (i *IndexAccess) GetNodes() []Node[NodeType]

func (*IndexAccess) GetReferencedDeclaration added in v0.1.6

func (i *IndexAccess) GetReferencedDeclaration() int64

func (*IndexAccess) GetSrc added in v0.1.6

func (i *IndexAccess) GetSrc() SrcNode

func (*IndexAccess) GetType added in v0.1.6

func (i *IndexAccess) GetType() ast_pb.NodeType

func (*IndexAccess) GetTypeDescription added in v0.1.6

func (i *IndexAccess) GetTypeDescription() *TypeDescription

func (*IndexAccess) GetTypeDescriptions added in v0.1.6

func (i *IndexAccess) GetTypeDescriptions() []*TypeDescription

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]

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.

func (*IndexAccess) ToProto added in v0.1.6

func (i *IndexAccess) ToProto() NodeType

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"`
}

func NewIndexRangeAccessExpression added in v0.1.6

func NewIndexRangeAccessExpression(b *ASTBuilder) *IndexRange

func (*IndexRange) GetId added in v0.1.6

func (f *IndexRange) GetId() int64

func (*IndexRange) GetLeftExpression added in v0.1.6

func (f *IndexRange) GetLeftExpression() Node[NodeType]

func (*IndexRange) GetNodes added in v0.1.6

func (f *IndexRange) GetNodes() []Node[NodeType]

func (*IndexRange) GetRightExpression added in v0.1.6

func (f *IndexRange) GetRightExpression() Node[NodeType]

func (*IndexRange) GetSrc added in v0.1.6

func (f *IndexRange) GetSrc() SrcNode

func (*IndexRange) GetType added in v0.1.6

func (f *IndexRange) GetType() ast_pb.NodeType

func (*IndexRange) GetTypeDescription added in v0.1.6

func (f *IndexRange) GetTypeDescription() *TypeDescription

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]

func (*IndexRange) SetReferenceDescriptor added in v0.1.6

func (b *IndexRange) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the IndexRange node.

func (*IndexRange) ToProto added in v0.1.6

func (f *IndexRange) ToProto() NodeType

type Interface added in v0.1.6

type Interface 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"`
}

func NewInterfaceDefinition added in v0.1.6

func NewInterfaceDefinition(b *ASTBuilder) *Interface

func (*Interface) GetBaseContracts added in v0.1.6

func (l *Interface) GetBaseContracts() []*BaseContract

func (*Interface) GetConstructor added in v0.1.7

func (l *Interface) GetConstructor() *Constructor

func (*Interface) GetContractDependencies added in v0.1.6

func (l *Interface) GetContractDependencies() []int64

func (*Interface) GetEnums added in v0.1.7

func (l *Interface) GetEnums() []*EnumDefinition

func (*Interface) GetErrors added in v0.1.7

func (l *Interface) GetErrors() []*ErrorDefinition

func (*Interface) GetEvents added in v0.1.7

func (l *Interface) GetEvents() []*EventDefinition

func (*Interface) GetFallback added in v0.1.7

func (l *Interface) GetFallback() *Fallback

func (*Interface) GetFunctions added in v0.1.7

func (l *Interface) GetFunctions() []*Function

func (*Interface) GetId added in v0.1.6

func (l *Interface) GetId() int64

func (*Interface) GetKind added in v0.1.6

func (l *Interface) GetKind() ast_pb.NodeType

func (*Interface) GetLinearizedBaseContracts added in v0.1.6

func (l *Interface) GetLinearizedBaseContracts() []int64

func (*Interface) GetName added in v0.1.6

func (l *Interface) GetName() string

func (*Interface) GetNodes added in v0.1.6

func (l *Interface) GetNodes() []Node[NodeType]

func (*Interface) GetReceive added in v0.1.7

func (l *Interface) GetReceive() *Receive

func (*Interface) GetSrc added in v0.1.6

func (l *Interface) GetSrc() SrcNode

func (*Interface) GetStateVariables added in v0.1.7

func (l *Interface) GetStateVariables() []*StateVariableDeclaration

func (*Interface) GetStructs added in v0.1.7

func (l *Interface) GetStructs() []*StructDefinition

func (*Interface) GetType added in v0.1.6

func (l *Interface) GetType() ast_pb.NodeType

func (*Interface) GetTypeDescription added in v0.1.6

func (l *Interface) GetTypeDescription() *TypeDescription

func (*Interface) IsAbstract added in v0.1.6

func (l *Interface) IsAbstract() bool

func (*Interface) IsFullyImplemented added in v0.1.6

func (l *Interface) IsFullyImplemented() bool

func (*Interface) Parse added in v0.1.6

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.

func (*Interface) ToProto added in v0.1.6

func (l *Interface) ToProto() NodeType

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

func (*Library) GetContractDependencies added in v0.1.6

func (l *Library) GetContractDependencies() []int64

GetContractDependencies returns the contract dependencies of the library.

func (*Library) GetEnums added in v0.1.7

func (l *Library) GetEnums() []*EnumDefinition

func (*Library) GetErrors added in v0.1.7

func (l *Library) GetErrors() []*ErrorDefinition

func (*Library) GetEvents added in v0.1.7

func (l *Library) GetEvents() []*EventDefinition

func (*Library) GetFallback added in v0.1.7

func (l *Library) GetFallback() *Fallback

func (*Library) GetFunctions added in v0.1.7

func (l *Library) GetFunctions() []*Function

func (*Library) GetId added in v0.1.6

func (l *Library) GetId() int64

GetId returns the unique identifier of the library node.

func (*Library) GetKind added in v0.1.6

func (l *Library) GetKind() ast_pb.NodeType

GetKind returns the kind of the library node.

func (*Library) GetLinearizedBaseContracts added in v0.1.6

func (l *Library) GetLinearizedBaseContracts() []int64

GetLinearizedBaseContracts returns the linearized base contracts of the library.

func (*Library) GetName added in v0.1.6

func (l *Library) GetName() string

GetName returns the name of the library.

func (*Library) GetNodes added in v0.1.6

func (l *Library) GetNodes() []Node[NodeType]

GetNodes returns the nodes associated with the library.

func (*Library) GetReceive added in v0.1.7

func (l *Library) GetReceive() *Receive

func (*Library) GetScope added in v0.1.6

func (l *Library) GetScope() int64

GetScope returns the scope of the library.

func (*Library) GetSrc added in v0.1.6

func (l *Library) GetSrc() SrcNode

GetSrc returns the source node associated with the library node.

func (*Library) GetStateVariables added in v0.1.7

func (l *Library) GetStateVariables() []*StateVariableDeclaration

func (*Library) GetStructs added in v0.1.7

func (l *Library) GetStructs() []*StructDefinition

func (*Library) GetType added in v0.1.6

func (l *Library) GetType() ast_pb.NodeType

GetType returns the type of the library node.

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

func (l *Library) IsAbstract() bool

IsAbstract returns a boolean indicating whether the library is abstract.

func (*Library) IsFullyImplemented added in v0.1.6

func (l *Library) IsFullyImplemented() bool

IsFullyImplemented returns a boolean indicating whether the library is fully implemented.

func (*Library) Parse added in v0.1.6

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.

func (*Library) ToProto added in v0.1.6

func (l *Library) ToProto() NodeType

ToProto converts the Library to a protocol buffer representation. Currently, it returns an empty Contract and needs to be implemented.

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"`
}

func (*LibraryName) ToProto added in v0.1.6

func (ln *LibraryName) ToProto() *ast_pb.LibraryName

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"`
}

func NewMemberAccessExpression added in v0.1.6

func NewMemberAccessExpression(b *ASTBuilder) *MemberAccessExpression

func (*MemberAccessExpression) GetArgumentTypes added in v0.1.6

func (m *MemberAccessExpression) GetArgumentTypes() []*TypeDescription

func (*MemberAccessExpression) GetExpression added in v0.1.6

func (m *MemberAccessExpression) GetExpression() Node[NodeType]

func (*MemberAccessExpression) GetId added in v0.1.6

func (m *MemberAccessExpression) GetId() int64

func (*MemberAccessExpression) GetMemberName added in v0.1.6

func (m *MemberAccessExpression) GetMemberName() string

func (*MemberAccessExpression) GetNodes added in v0.1.6

func (m *MemberAccessExpression) GetNodes() []Node[NodeType]

func (*MemberAccessExpression) GetReferencedDeclaration added in v0.1.6

func (m *MemberAccessExpression) GetReferencedDeclaration() int64

func (*MemberAccessExpression) GetSrc added in v0.1.6

func (m *MemberAccessExpression) GetSrc() SrcNode

func (*MemberAccessExpression) GetType added in v0.1.6

func (m *MemberAccessExpression) GetType() ast_pb.NodeType

func (*MemberAccessExpression) GetTypeDescription added in v0.1.6

func (m *MemberAccessExpression) GetTypeDescription() *TypeDescription

func (*MemberAccessExpression) IsConstant added in v0.1.6

func (m *MemberAccessExpression) IsConstant() bool

func (*MemberAccessExpression) IsLValue added in v0.1.6

func (m *MemberAccessExpression) IsLValue() bool

func (*MemberAccessExpression) IsLValueRequested added in v0.1.6

func (m *MemberAccessExpression) IsLValueRequested() bool

func (*MemberAccessExpression) IsPure added in v0.1.6

func (m *MemberAccessExpression) IsPure() bool

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]

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

type MetaType added in v0.1.6

type MetaType struct {
	*ASTBuilder

	Id                    int64            `json:"id"`
	NodeType              ast_pb.NodeType  `json:"node_type"`
	Name                  string           `json:"name"`
	Src                   SrcNode          `json:"src"`
	ReferencedDeclaration int64            `json:"referenced_declaration,omitempty"`
	TypeDescription       *TypeDescription `json:"type_description"`
}

func NewMetaTypeExpression added in v0.1.6

func NewMetaTypeExpression(b *ASTBuilder) *MetaType

func (*MetaType) GetId added in v0.1.6

func (m *MetaType) GetId() int64

func (*MetaType) GetName added in v0.1.6

func (m *MetaType) GetName() string

func (*MetaType) GetNodes added in v0.1.6

func (m *MetaType) GetNodes() []Node[NodeType]

func (*MetaType) GetReferencedDeclaration added in v0.1.6

func (m *MetaType) GetReferencedDeclaration() int64

func (*MetaType) GetSrc added in v0.1.6

func (m *MetaType) GetSrc() SrcNode

func (*MetaType) GetType added in v0.1.6

func (m *MetaType) GetType() ast_pb.NodeType

func (*MetaType) GetTypeDescription added in v0.1.6

func (m *MetaType) GetTypeDescription() *TypeDescription

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]

func (*MetaType) SetReferenceDescriptor added in v0.1.6

func (m *MetaType) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the MetaType node.

func (*MetaType) ToProto added in v0.1.6

func (m *MetaType) ToProto() NodeType

type ModifierDefinition added in v0.1.6

type ModifierDefinition struct {
	*ASTBuilder

	Id         int64             `json:"id"`
	Name       string            `json:"name"`
	NodeType   ast_pb.NodeType   `json:"node_type"`
	Src        SrcNode           `json:"src"`
	Visibility ast_pb.Visibility `json:"visibility"`
	Virtual    bool              `json:"virtual"`
	Parameters *ParameterList    `json:"parameters"`
	Body       *BodyNode         `json:"body"`
}

func NewModifierDefinition added in v0.1.6

func NewModifierDefinition(b *ASTBuilder) *ModifierDefinition

func (*ModifierDefinition) GetBody added in v0.1.6

func (m *ModifierDefinition) GetBody() *BodyNode

func (*ModifierDefinition) GetId added in v0.1.6

func (m *ModifierDefinition) GetId() int64

func (*ModifierDefinition) GetName added in v0.1.6

func (m *ModifierDefinition) GetName() string

func (*ModifierDefinition) GetNodes added in v0.1.6

func (m *ModifierDefinition) GetNodes() []Node[NodeType]

func (*ModifierDefinition) GetParameters added in v0.1.6

func (m *ModifierDefinition) GetParameters() *ParameterList

func (*ModifierDefinition) GetSrc added in v0.1.6

func (m *ModifierDefinition) GetSrc() SrcNode

func (*ModifierDefinition) GetType added in v0.1.6

func (m *ModifierDefinition) GetType() ast_pb.NodeType

func (*ModifierDefinition) GetTypeDescription added in v0.1.6

func (m *ModifierDefinition) GetTypeDescription() *TypeDescription

func (*ModifierDefinition) GetVisibility added in v0.1.6

func (m *ModifierDefinition) GetVisibility() ast_pb.Visibility

func (*ModifierDefinition) IsVirtual added in v0.1.6

func (m *ModifierDefinition) IsVirtual() bool

func (*ModifierDefinition) ParseDefinition added in v0.1.6

func (*ModifierDefinition) SetReferenceDescriptor added in v0.1.6

func (m *ModifierDefinition) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the ModifierDefinition node.

func (*ModifierDefinition) ToProto added in v0.1.6

func (m *ModifierDefinition) ToProto() NodeType

type ModifierInvocation added in v0.1.6

type ModifierInvocation struct {
	*ASTBuilder

	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"`
	ArgumentTypes []*TypeDescription `json:"argument_types"`
	Arguments     []Node[NodeType]   `json:"arguments"`
	ModifierName  *ModifierName      `json:"modifier_name,omitempty"`
}

func NewModifierInvocation added in v0.1.6

func NewModifierInvocation(b *ASTBuilder) *ModifierInvocation

func (*ModifierInvocation) GetArgumentTypes added in v0.1.6

func (m *ModifierInvocation) GetArgumentTypes() []*TypeDescription

func (*ModifierInvocation) GetArguments added in v0.1.6

func (m *ModifierInvocation) GetArguments() []Node[NodeType]

func (*ModifierInvocation) GetId added in v0.1.6

func (m *ModifierInvocation) GetId() int64

func (*ModifierInvocation) GetKind added in v0.1.6

func (m *ModifierInvocation) GetKind() ast_pb.NodeType

func (*ModifierInvocation) GetName added in v0.1.6

func (m *ModifierInvocation) GetName() string

func (*ModifierInvocation) GetNodes added in v0.1.6

func (m *ModifierInvocation) GetNodes() []Node[NodeType]

func (*ModifierInvocation) GetSrc added in v0.1.6

func (m *ModifierInvocation) GetSrc() SrcNode

func (*ModifierInvocation) GetType added in v0.1.6

func (m *ModifierInvocation) GetType() ast_pb.NodeType

func (*ModifierInvocation) GetTypeDescription added in v0.1.6

func (m *ModifierInvocation) GetTypeDescription() *TypeDescription

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,
)

func (*ModifierInvocation) SetReferenceDescriptor added in v0.1.6

func (m *ModifierInvocation) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the ModifierInvocation node.

func (*ModifierInvocation) ToProto added in v0.1.6

func (m *ModifierInvocation) ToProto() NodeType

type ModifierName added in v0.1.6

type ModifierName struct {
	Id       int64           `json:"id"`
	Name     string          `json:"name"`
	NodeType ast_pb.NodeType `json:"node_type"`
	Src      SrcNode         `json:"src"`
}

func (*ModifierName) ToProto added in v0.1.6

func (m *ModifierName) ToProto() *ast_pb.ModifierName

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"`
}

func NewExprExpression added in v0.1.6

func NewExprExpression(b *ASTBuilder) *NewExpr

func (*NewExpr) GetArgumentTypes added in v0.1.6

func (n *NewExpr) GetArgumentTypes() []*TypeDescription

func (*NewExpr) GetId added in v0.1.6

func (n *NewExpr) GetId() int64

func (*NewExpr) GetNodes added in v0.1.6

func (n *NewExpr) GetNodes() []Node[NodeType]

func (*NewExpr) GetReferencedDeclaration added in v0.1.6

func (n *NewExpr) GetReferencedDeclaration() int64

func (*NewExpr) GetSrc added in v0.1.6

func (n *NewExpr) GetSrc() SrcNode

func (*NewExpr) GetType added in v0.1.6

func (n *NewExpr) GetType() ast_pb.NodeType

func (*NewExpr) GetTypeDescription added in v0.1.6

func (n *NewExpr) GetTypeDescription() *TypeDescription

func (*NewExpr) GetTypeName added in v0.1.6

func (n *NewExpr) GetTypeName() *TypeName

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]

func (*NewExpr) SetReferenceDescriptor added in v0.1.6

func (m *NewExpr) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the NewExpr node.

func (*NewExpr) ToProto added in v0.1.6

func (n *NewExpr) ToProto() NodeType

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
}

type OverrideSpecifier added in v0.1.6

type OverrideSpecifier struct {
	*ASTBuilder

	Id                    int64            `json:"id"`
	NodeType              ast_pb.NodeType  `json:"node_type"`
	Name                  string           `json:"name"`
	Src                   SrcNode          `json:"src"`
	ReferencedDeclaration int64            `json:"referenced_declaration"`
	TypeDescription       *TypeDescription `json:"type_descriptions"`
}

func NewOverrideSpecifier added in v0.1.6

func NewOverrideSpecifier(b *ASTBuilder) *OverrideSpecifier

func (*OverrideSpecifier) GetId added in v0.1.6

func (o *OverrideSpecifier) GetId() int64

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]

func (*OverrideSpecifier) GetReferencedDeclaration added in v0.1.7

func (o *OverrideSpecifier) GetReferencedDeclaration() int64

GetReferencedDeclaration returns the referenced declaration

func (*OverrideSpecifier) GetSrc added in v0.1.6

func (o *OverrideSpecifier) GetSrc() SrcNode

func (*OverrideSpecifier) GetType added in v0.1.6

func (o *OverrideSpecifier) GetType() ast_pb.NodeType

func (*OverrideSpecifier) GetTypeDescription added in v0.1.7

func (o *OverrideSpecifier) GetTypeDescription() *TypeDescription

GetTypeDescription returns the type description

func (*OverrideSpecifier) Parse added in v0.1.6

func (*OverrideSpecifier) SetReferenceDescriptor added in v0.1.7

func (o *OverrideSpecifier) SetReferenceDescriptor(refId int64, refType *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptor

func (*OverrideSpecifier) ToProto added in v0.1.6

func (o *OverrideSpecifier) ToProto() NodeType

ToProto converts the node to its proto representation

type Parameter added in v0.1.6

type Parameter struct {
	*ASTBuilder

	Id              int64                  `json:"id"`
	NodeType        ast_pb.NodeType        `json:"node_type"`
	Src             SrcNode                `json:"src"`
	Scope           int64                  `json:"scope,omitempty"`
	Name            string                 `json:"name"`
	TypeName        *TypeName              `json:"type_name,omitempty"`
	StorageLocation ast_pb.StorageLocation `json:"storage_location,omitempty"`
	Visibility      ast_pb.Visibility      `json:"visibility,omitempty"`
	StateMutability ast_pb.Mutability      `json:"state_mutability,omitempty"`
	Constant        bool                   `json:"constant,omitempty"`
	StateVariable   bool                   `json:"state_variable,omitempty"`
	TypeDescription *TypeDescription       `json:"type_description,omitempty"`
	Indexed         bool                   `json:"indexed,omitempty"`
}

func NewParameter added in v0.1.6

func NewParameter(b *ASTBuilder) *Parameter

func (*Parameter) GetId added in v0.1.6

func (p *Parameter) GetId() int64

func (*Parameter) GetName added in v0.1.6

func (p *Parameter) GetName() string

func (*Parameter) GetNodes added in v0.1.6

func (p *Parameter) GetNodes() []Node[NodeType]

func (*Parameter) GetScope added in v0.1.6

func (p *Parameter) GetScope() int64

func (*Parameter) GetSrc added in v0.1.6

func (p *Parameter) GetSrc() SrcNode

func (*Parameter) GetStateMutability added in v0.1.6

func (p *Parameter) GetStateMutability() ast_pb.Mutability

func (*Parameter) GetStorageLocation added in v0.1.6

func (p *Parameter) GetStorageLocation() ast_pb.StorageLocation

func (*Parameter) GetType added in v0.1.6

func (p *Parameter) GetType() ast_pb.NodeType

func (*Parameter) GetTypeDescription added in v0.1.6

func (p *Parameter) GetTypeDescription() *TypeDescription

func (*Parameter) GetTypeName added in v0.1.6

func (p *Parameter) GetTypeName() *TypeName

func (*Parameter) GetVisibility added in v0.1.6

func (p *Parameter) GetVisibility() ast_pb.Visibility

func (*Parameter) IsConstant added in v0.1.6

func (p *Parameter) IsConstant() bool

func (*Parameter) IsIndexed added in v0.1.8

func (p *Parameter) IsIndexed() bool

func (*Parameter) IsStateVariable added in v0.1.6

func (p *Parameter) IsStateVariable() bool

func (*Parameter) Parse added in v0.1.6

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)

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)

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)

func (*Parameter) SetReferenceDescriptor added in v0.1.6

func (p *Parameter) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the Parameter node.

func (*Parameter) ToProto added in v0.1.6

func (p *Parameter) ToProto() NodeType

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"`
}

func NewParameterList added in v0.1.6

func NewParameterList(b *ASTBuilder) *ParameterList

func (*ParameterList) GetId added in v0.1.6

func (p *ParameterList) GetId() int64

func (*ParameterList) GetNodes added in v0.1.6

func (p *ParameterList) GetNodes() []Node[NodeType]

func (*ParameterList) GetParameterTypes added in v0.1.6

func (p *ParameterList) GetParameterTypes() []*TypeDescription

func (*ParameterList) GetParameters added in v0.1.6

func (p *ParameterList) GetParameters() []*Parameter

func (*ParameterList) GetSrc added in v0.1.6

func (p *ParameterList) GetSrc() SrcNode

func (*ParameterList) GetType added in v0.1.6

func (p *ParameterList) GetType() ast_pb.NodeType

func (*ParameterList) GetTypeDescription added in v0.1.6

func (p *ParameterList) GetTypeDescription() *TypeDescription

func (*ParameterList) Parse added in v0.1.6

func (*ParameterList) ParseErrorParameters added in v0.1.6

func (p *ParameterList) ParseErrorParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ctx []parser.IErrorParameterContext)

func (*ParameterList) ParseEventParameters added in v0.1.6

func (p *ParameterList) ParseEventParameters(unit *SourceUnit[Node[ast_pb.SourceUnit]], eNode Node[NodeType], ctx []parser.IEventParameterContext)

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

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"`
}

func (*PathNode) ToProto added in v0.1.6

func (pn *PathNode) ToProto() *ast_pb.PathNode

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"`
}

func NewPayableConversionExpression added in v0.1.6

func NewPayableConversionExpression(b *ASTBuilder) *PayableConversion

func (*PayableConversion) GetArgumentTypes added in v0.1.6

func (p *PayableConversion) GetArgumentTypes() []*TypeDescription

func (*PayableConversion) GetArguments added in v0.1.6

func (p *PayableConversion) GetArguments() []Node[NodeType]

func (*PayableConversion) GetId added in v0.1.6

func (p *PayableConversion) GetId() int64

func (*PayableConversion) GetNodes added in v0.1.6

func (p *PayableConversion) GetNodes() []Node[NodeType]

func (*PayableConversion) GetReferencedDeclaration added in v0.1.6

func (p *PayableConversion) GetReferencedDeclaration() int64

func (*PayableConversion) GetSrc added in v0.1.6

func (p *PayableConversion) GetSrc() SrcNode

func (*PayableConversion) GetType added in v0.1.6

func (p *PayableConversion) GetType() ast_pb.NodeType

func (*PayableConversion) GetTypeDescription added in v0.1.6

func (p *PayableConversion) GetTypeDescription() *TypeDescription

func (*PayableConversion) IsPayable added in v0.1.6

func (p *PayableConversion) IsPayable() bool

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]

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

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) GetId added in v0.1.7

func (p *Pragma) GetId() int64

GetId returns the unique identifier of the pragma directive.

func (*Pragma) GetLiterals added in v0.1.7

func (p *Pragma) GetLiterals() []string

GetLiterals returns a slice of strings that represent the literals of the pragma directive.

func (*Pragma) GetNodes added in v0.1.7

func (p *Pragma) GetNodes() []Node[NodeType]

GetNodes returns the child nodes of the node. For a Pragma, this is always nil.

func (*Pragma) GetSrc added in v0.1.7

func (p *Pragma) GetSrc() SrcNode

GetSrc returns the source information about the node, such as its line and column numbers in the source file.

func (*Pragma) GetText added in v0.1.7

func (p *Pragma) GetText() string

GetText returns the text of the pragma directive.

func (*Pragma) GetType added in v0.1.7

func (p *Pragma) GetType() ast_pb.NodeType

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.

func (*Pragma) ToProto added in v0.1.7

func (p *Pragma) ToProto() NodeType

ToProto returns the protobuf representation of the 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

	Id               int64                 `json:"id"`
	NodeType         ast_pb.NodeType       `json:"node_type"`
	Kind             ast_pb.NodeType       `json:"kind"`
	Src              SrcNode               `json:"src"`
	Implemented      bool                  `json:"implemented"`
	Visibility       ast_pb.Visibility     `json:"visibility"`
	StateMutability  ast_pb.Mutability     `json:"state_mutability"`
	Modifiers        []*ModifierInvocation `json:"modifiers"`
	Overrides        []*OverrideSpecifier  `json:"overrides"`
	Parameters       *ParameterList        `json:"parameters"`
	ReturnParameters *ParameterList        `json:"return_parameters"`
	Body             *BodyNode             `json:"body"`
	Virtual          bool                  `json:"virtual"`
	Payable          bool                  `json:"payable"`
}

func NewReceiveDefinition added in v0.1.6

func NewReceiveDefinition(b *ASTBuilder) *Receive

func (*Receive) GetBody added in v0.1.7

func (f *Receive) GetBody() *BodyNode

func (*Receive) GetId added in v0.1.7

func (f *Receive) GetId() int64

func (*Receive) GetKind added in v0.1.7

func (f *Receive) GetKind() ast_pb.NodeType

func (*Receive) GetModifiers added in v0.1.7

func (f *Receive) GetModifiers() []*ModifierInvocation

func (*Receive) GetNodes added in v0.1.7

func (f *Receive) GetNodes() []Node[NodeType]

func (*Receive) GetOverrides added in v0.1.7

func (f *Receive) GetOverrides() []*OverrideSpecifier

func (*Receive) GetParameters added in v0.1.7

func (f *Receive) GetParameters() *ParameterList

func (*Receive) GetReturnParameters added in v0.1.7

func (f *Receive) GetReturnParameters() *ParameterList

func (*Receive) GetSrc added in v0.1.7

func (f *Receive) GetSrc() SrcNode

func (*Receive) GetStateMutability added in v0.1.7

func (f *Receive) GetStateMutability() ast_pb.Mutability

func (*Receive) GetType added in v0.1.7

func (f *Receive) GetType() ast_pb.NodeType

func (*Receive) GetTypeDescription added in v0.1.7

func (f *Receive) GetTypeDescription() *TypeDescription

func (*Receive) GetVisibility added in v0.1.7

func (f *Receive) GetVisibility() ast_pb.Visibility

func (*Receive) IsImplemented added in v0.1.7

func (f *Receive) IsImplemented() bool

func (*Receive) IsVirtual added in v0.1.7

func (f *Receive) IsVirtual() bool

func (*Receive) Parse added in v0.1.7

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.

func (*Receive) ToProto added in v0.1.7

func (f *Receive) ToProto() NodeType

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

func (r *Resolver) GetUnprocessedCount() int

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

func (r *Resolver) Resolve() []error

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

func (r *Resolver) ResolveByNode(node Node[NodeType], name string) (int64, *TypeDescription)

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"`
}

func NewReturnStatement added in v0.1.6

func NewReturnStatement(b *ASTBuilder) *ReturnStatement

func (*ReturnStatement) GetExpression added in v0.1.6

func (r *ReturnStatement) GetExpression() Node[NodeType]

func (*ReturnStatement) GetFunctionReturnParameters added in v0.1.6

func (r *ReturnStatement) GetFunctionReturnParameters() int64

func (*ReturnStatement) GetId added in v0.1.6

func (r *ReturnStatement) GetId() int64

func (*ReturnStatement) GetNodes added in v0.1.6

func (r *ReturnStatement) GetNodes() []Node[NodeType]

func (*ReturnStatement) GetSrc added in v0.1.6

func (r *ReturnStatement) GetSrc() SrcNode

func (*ReturnStatement) GetType added in v0.1.6

func (r *ReturnStatement) GetType() ast_pb.NodeType

func (*ReturnStatement) GetTypeDescription added in v0.1.6

func (r *ReturnStatement) GetTypeDescription() *TypeDescription

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]

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

type RevertStatement added in v0.1.6

type RevertStatement struct {
	*ASTBuilder

	Id         int64            `json:"id"`
	NodeType   ast_pb.NodeType  `json:"node_type"`
	Src        SrcNode          `json:"src"`
	Arguments  []Node[NodeType] `json:"arguments"`
	Expression Node[NodeType]   `json:"expression"`
}

func NewRevertStatement added in v0.1.6

func NewRevertStatement(b *ASTBuilder) *RevertStatement

func (*RevertStatement) GetArguments added in v0.1.6

func (r *RevertStatement) GetArguments() []Node[NodeType]

func (*RevertStatement) GetExpression added in v0.1.6

func (r *RevertStatement) GetExpression() Node[NodeType]

func (*RevertStatement) GetId added in v0.1.6

func (r *RevertStatement) GetId() int64

func (*RevertStatement) GetNodes added in v0.1.6

func (r *RevertStatement) GetNodes() []Node[NodeType]

func (*RevertStatement) GetSrc added in v0.1.6

func (r *RevertStatement) GetSrc() SrcNode

func (*RevertStatement) GetType added in v0.1.6

func (r *RevertStatement) GetType() ast_pb.NodeType

func (*RevertStatement) GetTypeDescription added in v0.1.6

func (r *RevertStatement) GetTypeDescription() *TypeDescription

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]

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

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

func (r *RootNode) GetComments() []*Comment

GetComments returns the comments of the root node.

func (*RootNode) GetEntrySourceUnit added in v0.1.6

func (r *RootNode) GetEntrySourceUnit() int64

GetEntrySourceUnit returns the entry source unit of the root node.

func (*RootNode) GetId added in v0.1.6

func (r *RootNode) GetId() int64

GetId returns the id of the RootNode node.

func (*RootNode) GetNodes added in v0.1.6

func (r *RootNode) GetNodes() []Node[NodeType]

GetNodes returns the nodes 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

func (r *RootNode) GetSourceUnitCount() int32

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

func (r *RootNode) GetSrc() SrcNode

GetSrc returns the source code location of the RootNode node.

func (*RootNode) GetType added in v0.1.6

func (r *RootNode) GetType() ast_pb.NodeType

GetType returns the type 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

func (r *RootNode) HasSourceUnits() bool

HasSourceUnits returns true if the root node has source units.

func (*RootNode) SetEntrySourceUnit added in v0.1.6

func (r *RootNode) SetEntrySourceUnit(entrySourceUnit int64)

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"`
}

func NewSimpleStatement added in v0.1.6

func NewSimpleStatement(b *ASTBuilder) *SimpleStatement

func (*SimpleStatement) GetId added in v0.1.6

func (s *SimpleStatement) GetId() int64

func (*SimpleStatement) GetNodes added in v0.1.6

func (s *SimpleStatement) GetNodes() []Node[NodeType]

func (*SimpleStatement) GetSrc added in v0.1.6

func (s *SimpleStatement) GetSrc() SrcNode

func (*SimpleStatement) GetType added in v0.1.6

func (s *SimpleStatement) GetType() ast_pb.NodeType

func (*SimpleStatement) GetTypeDescription added in v0.1.6

func (s *SimpleStatement) GetTypeDescription() *TypeDescription

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]

func (*SimpleStatement) SetReferenceDescriptor added in v0.1.6

func (s *SimpleStatement) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the SimpleStatement node.

func (*SimpleStatement) ToProto added in v0.1.6

func (s *SimpleStatement) ToProto() NodeType

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

func (s SrcNode) GetColumn() int64

GetColumn returns the column number of the source node in the source code.

func (SrcNode) GetEnd added in v0.1.6

func (s SrcNode) GetEnd() int64

GetEnd returns the end position of the source node in the source code.

func (SrcNode) GetId added in v0.1.6

func (s SrcNode) GetId() int64

GetId returns the unique identifier of the source node.

func (SrcNode) GetLength added in v0.1.6

func (s SrcNode) GetLength() int64

GetLength returns the length of the source node in the source code.

func (SrcNode) GetLine added in v0.1.6

func (s SrcNode) GetLine() int64

GetLine returns the line number of the source node in the source code.

func (SrcNode) GetParentIndex added in v0.1.6

func (s SrcNode) GetParentIndex() int64

GetParentIndex returns the index of the parent node in the source code.

func (SrcNode) GetStart added in v0.1.6

func (s SrcNode) GetStart() int64

GetStart returns the start position of the source node in the source code.

func (SrcNode) ToProto added in v0.1.6

func (s SrcNode) ToProto() *ast_pb.Src

ToProto converts the SrcNode to a protocol buffer representation.

type StateVariableDeclaration added in v0.1.6

type StateVariableDeclaration struct {
	*ASTBuilder

	Id              int64                  `json:"id"`
	Name            string                 `json:"name"`
	Constant        bool                   `json:"is_constant"`
	StateVariable   bool                   `json:"is_state_variable"`
	NodeType        ast_pb.NodeType        `json:"node_type"`
	Src             SrcNode                `json:"src"`
	Scope           int64                  `json:"scope"`
	TypeDescription *TypeDescription       `json:"type_description"`
	Visibility      ast_pb.Visibility      `json:"visibility"`
	StorageLocation ast_pb.StorageLocation `json:"storage_location"`
	StateMutability ast_pb.Mutability      `json:"mutability"`
	TypeName        *TypeName              `json:"type_name"`
}

func NewStateVariableDeclaration added in v0.1.6

func NewStateVariableDeclaration(b *ASTBuilder) *StateVariableDeclaration

func (*StateVariableDeclaration) GetId added in v0.1.6

func (v *StateVariableDeclaration) GetId() int64

func (*StateVariableDeclaration) GetName added in v0.1.6

func (v *StateVariableDeclaration) GetName() string

func (*StateVariableDeclaration) GetNodes added in v0.1.6

func (v *StateVariableDeclaration) GetNodes() []Node[NodeType]

func (*StateVariableDeclaration) GetReferencedDeclaration added in v0.1.6

func (v *StateVariableDeclaration) GetReferencedDeclaration() int64

func (*StateVariableDeclaration) GetScope added in v0.1.6

func (v *StateVariableDeclaration) GetScope() int64

func (*StateVariableDeclaration) GetSrc added in v0.1.6

func (v *StateVariableDeclaration) GetSrc() SrcNode

func (*StateVariableDeclaration) GetStateMutability added in v0.1.6

func (v *StateVariableDeclaration) GetStateMutability() ast_pb.Mutability

func (*StateVariableDeclaration) GetStorageLocation added in v0.1.6

func (v *StateVariableDeclaration) GetStorageLocation() ast_pb.StorageLocation

func (*StateVariableDeclaration) GetType added in v0.1.6

func (*StateVariableDeclaration) GetTypeDescription added in v0.1.6

func (v *StateVariableDeclaration) GetTypeDescription() *TypeDescription

func (*StateVariableDeclaration) GetTypeName added in v0.1.6

func (v *StateVariableDeclaration) GetTypeName() *TypeName

func (*StateVariableDeclaration) GetVisibility added in v0.1.6

func (v *StateVariableDeclaration) GetVisibility() ast_pb.Visibility

func (*StateVariableDeclaration) IsConstant added in v0.1.6

func (v *StateVariableDeclaration) IsConstant() bool

func (*StateVariableDeclaration) IsStateVariable added in v0.1.6

func (v *StateVariableDeclaration) IsStateVariable() bool

func (*StateVariableDeclaration) Parse added in v0.1.6

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

type StructDefinition added in v0.1.6

type StructDefinition struct {
	*ASTBuilder

	SourceUnitName        string                 `json:"-"`
	Id                    int64                  `json:"id"`
	NodeType              ast_pb.NodeType        `json:"node_type"`
	Src                   SrcNode                `json:"src"`
	Kind                  ast_pb.NodeType        `json:"kind,omitempty"`
	Name                  string                 `json:"name"`
	CanonicalName         string                 `json:"canonical_name"`
	ReferencedDeclaration int64                  `json:"referenced_declaration,omitempty"`
	TypeDescription       *TypeDescription       `json:"type_description"`
	Members               []Node[NodeType]       `json:"members"`
	Visibility            ast_pb.Visibility      `json:"visibility"`
	StorageLocation       ast_pb.StorageLocation `json:"storage_location"`
}

func NewStructDefinition added in v0.1.6

func NewStructDefinition(b *ASTBuilder) *StructDefinition

func (*StructDefinition) GetCanonicalName added in v0.1.6

func (s *StructDefinition) GetCanonicalName() string

func (*StructDefinition) GetId added in v0.1.6

func (s *StructDefinition) GetId() int64

func (*StructDefinition) GetKind added in v0.1.6

func (s *StructDefinition) GetKind() ast_pb.NodeType

func (*StructDefinition) GetMembers added in v0.1.6

func (s *StructDefinition) GetMembers() []*Parameter

func (*StructDefinition) GetName added in v0.1.6

func (s *StructDefinition) GetName() string

func (*StructDefinition) GetNodes added in v0.1.6

func (s *StructDefinition) GetNodes() []Node[NodeType]

func (*StructDefinition) GetReferencedDeclaration added in v0.1.6

func (s *StructDefinition) GetReferencedDeclaration() int64

func (*StructDefinition) GetSourceUnitName added in v0.1.6

func (s *StructDefinition) GetSourceUnitName() string

func (*StructDefinition) GetSrc added in v0.1.6

func (s *StructDefinition) GetSrc() SrcNode

func (*StructDefinition) GetStorageLocation added in v0.1.6

func (s *StructDefinition) GetStorageLocation() ast_pb.StorageLocation

func (*StructDefinition) GetType added in v0.1.6

func (s *StructDefinition) GetType() ast_pb.NodeType

func (*StructDefinition) GetTypeDescription added in v0.1.6

func (s *StructDefinition) GetTypeDescription() *TypeDescription

func (*StructDefinition) GetVisibility added in v0.1.6

func (s *StructDefinition) GetVisibility() ast_pb.Visibility

func (*StructDefinition) Parse added in v0.1.6

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

type Symbol added in v0.1.6

type Symbol struct {
	Id           int64  `json:"id"`
	Name         string `json:"name"`
	AbsolutePath string `json:"absolute_path"`
}

func NewSymbol added in v0.1.6

func NewSymbol(id int64, name string, absolutePath string) Symbol

func (Symbol) GetAbsolutePath added in v0.1.6

func (s Symbol) GetAbsolutePath() string

func (Symbol) GetId added in v0.1.6

func (s Symbol) GetId() int64

func (Symbol) GetName added in v0.1.6

func (s Symbol) GetName() string

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

func (t *Tree) GetById(id int64) Node[NodeType]

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

func (t *Tree) GetRoot() *RootNode

GetRoot returns the root node of the Abstract Syntax Tree (AST).

func (*Tree) SetRoot added in v0.1.6

func (t *Tree) SetRoot(root *RootNode)

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"`
	NodeType   ast_pb.NodeType  `json:"node_type"`
	Src        SrcNode          `json:"src"`
	Body       *BodyNode        `json:"body"`
	Kind       ast_pb.NodeType  `json:"kind"`
	Expression Node[NodeType]   `json:"expression"`
	Clauses    []Node[NodeType] `json:"clauses"`
}

func NewTryStatement added in v0.1.6

func NewTryStatement(b *ASTBuilder) *TryStatement

func (*TryStatement) GetBody added in v0.1.6

func (t *TryStatement) GetBody() *BodyNode

func (*TryStatement) GetClauses added in v0.1.6

func (t *TryStatement) GetClauses() []Node[NodeType]

func (*TryStatement) GetExpression added in v0.1.6

func (t *TryStatement) GetExpression() Node[NodeType]

func (*TryStatement) GetId added in v0.1.6

func (t *TryStatement) GetId() int64

func (*TryStatement) GetImplemented added in v0.1.6

func (t *TryStatement) GetImplemented() bool

func (*TryStatement) GetKind added in v0.1.6

func (t *TryStatement) GetKind() ast_pb.NodeType

func (*TryStatement) GetNodes added in v0.1.6

func (t *TryStatement) GetNodes() []Node[NodeType]

func (*TryStatement) GetSrc added in v0.1.6

func (t *TryStatement) GetSrc() SrcNode

func (*TryStatement) GetType added in v0.1.6

func (t *TryStatement) GetType() ast_pb.NodeType

func (*TryStatement) GetTypeDescription added in v0.1.6

func (t *TryStatement) GetTypeDescription() *TypeDescription

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]

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

type TupleExpression added in v0.1.6

type TupleExpression struct {
	// Embedding the ASTBuilder to provide common functionality
	*ASTBuilder

	// The unique identifier for the tuple expression
	Id int64 `json:"id"`

	// The type of the node, which is 'TUPLE_EXPRESSION' for a tuple expression
	NodeType ast_pb.NodeType `json:"node_type"`

	// The source information about the tuple expression, such as its line and column numbers in the source file
	Src SrcNode `json:"src"`

	// Whether the tuple expression is constant
	Constant bool `json:"is_constant"`

	// Whether the tuple expression is pure
	Pure bool `json:"is_pure"`

	// The components of the tuple expression
	Components []Node[NodeType] `json:"components"`

	// The referenced declaration of the tuple expression
	ReferencedDeclaration int64 `json:"referenced_declaration,omitempty"`

	// The type description of the tuple expression
	TypeDescription *TypeDescription `json:"type_description"`
}

The TupleExpression struct 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"`
}

func (*TypeDescription) GetIdentifier added in v0.1.7

func (td *TypeDescription) GetIdentifier() string

func (*TypeDescription) GetString added in v0.1.7

func (td *TypeDescription) GetString() string

func (TypeDescription) ToProto added in v0.1.6

func (td TypeDescription) ToProto() *ast_pb.TypeDescription

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"`
}

func NewTypeName added in v0.1.6

func NewTypeName(b *ASTBuilder) *TypeName

func (*TypeName) GetId added in v0.1.6

func (t *TypeName) GetId() int64

func (*TypeName) GetKeyType added in v0.1.6

func (t *TypeName) GetKeyType() *TypeName

func (*TypeName) GetName added in v0.1.6

func (t *TypeName) GetName() string

func (*TypeName) GetNodes added in v0.1.6

func (t *TypeName) GetNodes() []Node[NodeType]

func (*TypeName) GetPathNode added in v0.1.6

func (t *TypeName) GetPathNode() *PathNode

func (*TypeName) GetReferencedDeclaration added in v0.1.6

func (t *TypeName) GetReferencedDeclaration() int64

func (*TypeName) GetSrc added in v0.1.6

func (t *TypeName) GetSrc() SrcNode

func (*TypeName) GetStateMutability added in v0.1.6

func (t *TypeName) GetStateMutability() ast_pb.Mutability

func (*TypeName) GetType added in v0.1.6

func (t *TypeName) GetType() ast_pb.NodeType

func (*TypeName) GetTypeDescription added in v0.1.6

func (t *TypeName) GetTypeDescription() *TypeDescription

func (*TypeName) GetValueType added in v0.1.6

func (t *TypeName) GetValueType() *TypeName

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)

func (*TypeName) ParseElementary added in v0.1.7

func (t *TypeName) ParseElementary(unit *SourceUnit[Node[ast_pb.SourceUnit]], fnNode Node[NodeType], parentNodeId int64, ctx parser.IElementaryTypeNameContext)

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.

func (*TypeName) ToProto added in v0.1.6

func (t *TypeName) ToProto() NodeType

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"`
}

func NewUnaryPrefixExpression added in v0.1.6

func NewUnaryPrefixExpression(b *ASTBuilder) *UnaryPrefix

func (*UnaryPrefix) GetExpression added in v0.1.6

func (u *UnaryPrefix) GetExpression() Node[NodeType]

func (*UnaryPrefix) GetId added in v0.1.6

func (u *UnaryPrefix) GetId() int64

func (*UnaryPrefix) GetNodes added in v0.1.6

func (u *UnaryPrefix) GetNodes() []Node[NodeType]

func (*UnaryPrefix) GetOperator added in v0.1.6

func (u *UnaryPrefix) GetOperator() ast_pb.Operator

func (*UnaryPrefix) GetPrefix added in v0.1.6

func (u *UnaryPrefix) GetPrefix() bool

func (*UnaryPrefix) GetReferencedDeclaration added in v0.1.6

func (u *UnaryPrefix) GetReferencedDeclaration() int64

func (*UnaryPrefix) GetSrc added in v0.1.6

func (u *UnaryPrefix) GetSrc() SrcNode

func (*UnaryPrefix) GetType added in v0.1.6

func (u *UnaryPrefix) GetType() ast_pb.NodeType

func (*UnaryPrefix) GetTypeDescription added in v0.1.6

func (u *UnaryPrefix) GetTypeDescription() *TypeDescription

func (*UnaryPrefix) IsConstant added in v0.1.6

func (u *UnaryPrefix) IsConstant() bool

func (*UnaryPrefix) IsLValue added in v0.1.6

func (u *UnaryPrefix) IsLValue() bool

func (*UnaryPrefix) IsLValueRequested added in v0.1.6

func (u *UnaryPrefix) IsLValueRequested() bool

func (*UnaryPrefix) IsPure added in v0.1.6

func (u *UnaryPrefix) IsPure() bool

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]

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

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"`
}

func NewUnarySuffixExpression added in v0.1.6

func NewUnarySuffixExpression(b *ASTBuilder) *UnarySuffix

func (*UnarySuffix) GetExpression added in v0.1.6

func (u *UnarySuffix) GetExpression() Node[NodeType]

func (*UnarySuffix) GetId added in v0.1.6

func (u *UnarySuffix) GetId() int64

func (*UnarySuffix) GetNodes added in v0.1.6

func (u *UnarySuffix) GetNodes() []Node[NodeType]

func (*UnarySuffix) GetOperator added in v0.1.6

func (u *UnarySuffix) GetOperator() ast_pb.Operator

func (*UnarySuffix) GetPrefix added in v0.1.6

func (u *UnarySuffix) GetPrefix() bool

func (*UnarySuffix) GetReferencedDeclaration added in v0.1.6

func (u *UnarySuffix) GetReferencedDeclaration() int64

func (*UnarySuffix) GetSrc added in v0.1.6

func (u *UnarySuffix) GetSrc() SrcNode

func (*UnarySuffix) GetType added in v0.1.6

func (u *UnarySuffix) GetType() ast_pb.NodeType

func (*UnarySuffix) GetTypeDescription added in v0.1.6

func (u *UnarySuffix) GetTypeDescription() *TypeDescription

func (*UnarySuffix) IsConstant added in v0.1.6

func (u *UnarySuffix) IsConstant() bool

func (*UnarySuffix) IsLValue added in v0.1.6

func (u *UnarySuffix) IsLValue() bool

func (*UnarySuffix) IsLValueRequested added in v0.1.6

func (u *UnarySuffix) IsLValueRequested() bool

func (*UnarySuffix) IsPure added in v0.1.6

func (u *UnarySuffix) IsPure() bool

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]

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

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"`
}

func NewUsingDirective added in v0.1.6

func NewUsingDirective(b *ASTBuilder) *UsingDirective

func (*UsingDirective) GetId added in v0.1.6

func (u *UsingDirective) GetId() int64

func (*UsingDirective) GetLibraryName added in v0.1.6

func (u *UsingDirective) GetLibraryName() *LibraryName

func (*UsingDirective) GetNodes added in v0.1.6

func (u *UsingDirective) GetNodes() []Node[NodeType]

func (*UsingDirective) GetPathNode added in v0.1.6

func (u *UsingDirective) GetPathNode() *PathNode

func (*UsingDirective) GetReferencedDeclaration added in v0.1.6

func (u *UsingDirective) GetReferencedDeclaration() int64

func (*UsingDirective) GetSrc added in v0.1.6

func (u *UsingDirective) GetSrc() SrcNode

func (*UsingDirective) GetType added in v0.1.6

func (u *UsingDirective) GetType() ast_pb.NodeType

func (*UsingDirective) GetTypeDescription added in v0.1.6

func (u *UsingDirective) GetTypeDescription() *TypeDescription

func (*UsingDirective) GetTypeName added in v0.1.6

func (u *UsingDirective) GetTypeName() *TypeName

func (*UsingDirective) Parse added in v0.1.6

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

type VariableDeclaration added in v0.1.6

type VariableDeclaration struct {
	*ASTBuilder

	Id           int64           `json:"id"`
	NodeType     ast_pb.NodeType `json:"node_type"`
	Src          SrcNode         `json:"src"`
	Assignments  []int64         `json:"assignments"`
	Declarations []*Declaration  `json:"declarations"`
	InitialValue Node[NodeType]  `json:"initial_value,omitempty"`
}

func NewVariableDeclarationStatement added in v0.1.6

func NewVariableDeclarationStatement(b *ASTBuilder) *VariableDeclaration

func (*VariableDeclaration) GetAssignments added in v0.1.6

func (v *VariableDeclaration) GetAssignments() []int64

func (*VariableDeclaration) GetDeclarations added in v0.1.6

func (v *VariableDeclaration) GetDeclarations() []*Declaration

func (*VariableDeclaration) GetId added in v0.1.6

func (v *VariableDeclaration) GetId() int64

func (*VariableDeclaration) GetInitialValue added in v0.1.6

func (v *VariableDeclaration) GetInitialValue() Node[NodeType]

func (*VariableDeclaration) GetNodes added in v0.1.6

func (v *VariableDeclaration) GetNodes() []Node[NodeType]

func (*VariableDeclaration) GetSrc added in v0.1.6

func (v *VariableDeclaration) GetSrc() SrcNode

func (*VariableDeclaration) GetType added in v0.1.6

func (v *VariableDeclaration) GetType() ast_pb.NodeType

func (*VariableDeclaration) GetTypeDescription added in v0.1.6

func (v *VariableDeclaration) GetTypeDescription() *TypeDescription

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,
)

func (*VariableDeclaration) SetReferenceDescriptor added in v0.1.6

func (v *VariableDeclaration) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the VariableDeclaration node.

func (*VariableDeclaration) ToProto added in v0.1.6

func (v *VariableDeclaration) ToProto() NodeType

type WhileStatement added in v0.1.6

type WhileStatement struct {
	*ASTBuilder

	Id        int64           `json:"id"`
	NodeType  ast_pb.NodeType `json:"node_type"`
	Kind      ast_pb.NodeType `json:"kind"`
	Src       SrcNode         `json:"src"`
	Condition Node[NodeType]  `json:"condition"`
	Body      *BodyNode       `json:"body"`
}

func NewWhileStatement added in v0.1.6

func NewWhileStatement(b *ASTBuilder) *WhileStatement

func (*WhileStatement) GetBody added in v0.1.6

func (w *WhileStatement) GetBody() *BodyNode

func (*WhileStatement) GetCondition added in v0.1.6

func (w *WhileStatement) GetCondition() Node[NodeType]

func (*WhileStatement) GetId added in v0.1.6

func (w *WhileStatement) GetId() int64

func (*WhileStatement) GetKind added in v0.1.6

func (w *WhileStatement) GetKind() ast_pb.NodeType

func (*WhileStatement) GetNodes added in v0.1.6

func (w *WhileStatement) GetNodes() []Node[NodeType]

func (*WhileStatement) GetSrc added in v0.1.6

func (w *WhileStatement) GetSrc() SrcNode

func (*WhileStatement) GetType added in v0.1.6

func (w *WhileStatement) GetType() ast_pb.NodeType

func (*WhileStatement) GetTypeDescription added in v0.1.6

func (w *WhileStatement) GetTypeDescription() *TypeDescription

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]

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

type YulAssignment added in v0.1.6

type YulAssignment struct {
	*ASTBuilder

	Id            int64               `json:"id"`
	NodeType      ast_pb.NodeType     `json:"node_type"`
	Src           SrcNode             `json:"src"`
	VariableNames []*YulVariableNames `json:"variable_names"`
}

func NewYulAssignment added in v0.1.6

func NewYulAssignment(b *ASTBuilder) *YulAssignment

func (*YulAssignment) GetId added in v0.1.6

func (y *YulAssignment) GetId() int64

func (*YulAssignment) GetNodes added in v0.1.6

func (y *YulAssignment) GetNodes() []Node[NodeType]

func (*YulAssignment) GetSrc added in v0.1.6

func (y *YulAssignment) GetSrc() SrcNode

func (*YulAssignment) GetType added in v0.1.6

func (y *YulAssignment) GetType() ast_pb.NodeType

func (*YulAssignment) GetTypeDescription added in v0.1.6

func (y *YulAssignment) GetTypeDescription() *TypeDescription

func (*YulAssignment) Parse added in v0.1.6

func (y *YulAssignment) Parse(
	unit *SourceUnit[Node[ast_pb.SourceUnit]],
	contractNode Node[NodeType],
	fnNode Node[NodeType],
	bodyNode *BodyNode,
	assemblyNode *AssemblyStatement,
	statementNode *YulStatement,
	ctx *parser.YulAssignmentContext,
) Node[NodeType]

func (*YulAssignment) SetReferenceDescriptor added in v0.1.6

func (y *YulAssignment) SetReferenceDescriptor(refId int64, refDesc *TypeDescription) bool

SetReferenceDescriptor sets the reference descriptions of the YulAssignment node.

func (*YulAssignment) ToProto added in v0.1.6

func (y *YulAssignment) ToProto() NodeType

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

type YulVariableNames added in v0.1.6

type YulVariableNames struct {
	Id       int64           `json:"id"`
	Name     string          `json:"name"`
	NodeType ast_pb.NodeType `json:"node_type"`
	Src      SrcNode         `json:"src"`
}

Jump to

Keyboard shortcuts

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