Module ast

Source
Expand description

Bindings for the Solidity and Yul ASTs.

The Yul AST bindings are available in the yul module.

To gain an overview of the AST, it might be helpful to start at the entry point of a complete Solidity AST: the SourceUnit node.

§Version Support

These types should be compatible with at least Solidity 0.5.x and above, but may also support 0.4.x-0.5.x in most cases.

The legacy Solidity AST is not supported.

Modules§

util
visitor
yul
Types for the Yul AST.

Structs§

ArrayTypeName
An array type name.
Assignment
An assignment expression.
Ast
Represents the AST field in the solc output
BinaryOperation
A binary operation.
Block
A block of statements.
Break
The break keyword.
Conditional
A conditional expression.
Continue
The continue keyword.
ContractDefinition
A contract definition.
DoWhileStatement
A do while statement.
ElementaryTypeName
ElementaryTypeNameExpression
EmitStatement
An emit statement.
EnumDefinition
An enum definition.
EnumValue
An enum value.
ErrorDefinition
A custom error definition.
EventDefinition
An event definition.
ExpressionStatement
An expression statement.
ExternalInlineAssemblyReference
A reference to an external variable or slot in an inline assembly block.
ForStatement
A for statement.
FunctionCall
A function call expression.
FunctionCallOptions
A function call options expression (e.g. x.f{gas: 1}).
FunctionDefinition
A function definition.
FunctionIdentifierPath
A wrapper around IdentifierPath for the UsingForDirective.
FunctionTypeName
A function type name.
Identifier
An identifier.
IdentifierPath
An identifier path.
IfStatement
An if statement.
ImportDirective
An import directive.
IndexAccess
An index access.
IndexRangeAccess
An index range access.
InheritanceSpecifier
An inheritance specifier.
InlineAssembly
A block of inline assembly.
Literal
A literal value.
LowFidelitySourceLocation
Represents the source location of a node: <start byte>:<length>:<source index>.
Mapping
A mapping type.
MemberAccess
Member access.
ModifierDefinition
A modifier definition.
ModifierInvocation
A modifier or base constructor invocation.
NewExpression
A new expression.
Node
OverrideSpecifier
An override specifier.
ParameterList
A parameter list.
PlaceholderStatement
A placeholder statement (_)
PragmaDirective
A pragma directive.
Return
A return statement.
RevertStatement
A revert statement.
SourceLocation
Represents the source location of a node: <start byte>:<length>:<source index>.
SourceUnit
The root node of a Solidity AST.
StructDefinition
A struct definition.
SymbolAlias
A symbol alias.
TryCatchClause
A try/catch clause.
TryStatement
A try/catch statement.
TupleExpression
A tuple expression.
TypeDescriptions
A type description.
UnaryOperation
A unary operation.
UncheckedBlock
An unchecked block.
UserDefinedTypeName
A user defined type name.
UserDefinedValueTypeDefinition
A user defined value type definition.
UsingForDirective
A using for directive.
VariableDeclaration
A variable declaration.
VariableDeclarationStatement
A variable declaration statement.
WhileStatement
A while statement.

Enums§

AssemblyReferenceSuffix
An assembly reference suffix.
AssignmentOperator
Assignment operators.
BinaryOperator
Binary operators.
BlockOrStatement
ContractDefinitionPart
ContractKind
All Solidity contract kinds.
ElementaryOrRawTypeName
Expression
ExpressionOrVariableDeclarationStatement
FunctionCallKind
Function call kinds.
FunctionKind
Function kinds.
IdentifierOrIdentifierPath
InlineAssemblyFlag
Inline assembly flags.
LiteralKind
Literal kinds.
ModifierInvocationKind
Modifier invocation kinds.
Mutability
Variable mutability specifier.
NodeType
SourceUnitPart
StateMutability
Function mutability specifier.
Statement
StorageLocation
Storage location specifier.
StructuredDocumentation
Structured documentation (NatSpec).
TypeName
UnaryOperator
Unary operators.
UserDefinedTypeNameOrIdentifierPath
Visibility
Visibility specifier.