AST - Abstract Syntax Tree
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
contract Counter {
uint256 public number;
function setNumber(uint256 newNumber) public {
number = newNumber;
}
function increment() public {
number++;
}
}{
"type": "SourceUnit",
"children": [
{
"type": "PragmaDirective",
...
},
{
"type": "ContractDefinition",
"name": "Counter",
"subNodes": [
{
"type": "StateVariableDeclaration",
"variables": [
{
"type": "VariableDeclaration",
"name": "number",
...
}
],
...
},
{
"type": "FunctionDefinition",
"name": "setNumber",
"body": {
... // Deeper nodes that describe the function body
},
...
},
{
"type": "FunctionDefinition",
"name": "increment",
"body": {
... // Deeper nodes that describe the function body
},
...
}
],
...
}
],
...
}Level 0 - SourceUnit
SourceUnitLevel 1 - ContractDefinition
ContractDefinitionExplore more about AST.
Last updated