mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7900 from ethereum/replaceSuperFunctionAnnotation
Replace ``superFunction`` with ``baseFunctions`` in AST annotations and ASTJSON.
This commit is contained in:
commit
6230d8f515
@ -22,6 +22,7 @@ Breaking changes:
|
||||
* Natspec JSON Interface: Properly support multiple ``@return`` statements in ``@dev`` documentation and enforce named return parameters to be mentioned documentation.
|
||||
* Source mappings: Add "modifier depth" as a fifth field in the source mappings.
|
||||
* AST: Inline assembly is exported as structured JSON instead of plain string.
|
||||
* JSON AST: Replace ``superFunction`` attribute by ``baseFunctions``.
|
||||
* General: ``private`` cannot be used together with ``virtual``.
|
||||
* Inheritance: State variable shadowing is now disallowed.
|
||||
|
||||
|
@ -290,8 +290,7 @@ bool ContractLevelChecker::checkFunctionOverride(FunctionDefinition const& _func
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (!_function.annotation().superFunction)
|
||||
_function.annotation().superFunction = &_super;
|
||||
_function.annotation().baseFunctions.emplace(&_super);
|
||||
|
||||
if (_function.visibility() != _super.visibility())
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ void ViewPureChecker::endVisit(FunctionDefinition const& _funDef)
|
||||
!_funDef.isConstructor() &&
|
||||
!_funDef.isFallback() &&
|
||||
!_funDef.isReceive() &&
|
||||
!_funDef.annotation().superFunction
|
||||
!_funDef.overrides()
|
||||
)
|
||||
m_errorReporter.warning(
|
||||
_funDef.location(),
|
||||
|
@ -106,9 +106,8 @@ struct ContractDefinitionAnnotation: TypeDeclarationAnnotation, DocumentedAnnota
|
||||
|
||||
struct FunctionDefinitionAnnotation: ASTAnnotation, DocumentedAnnotation
|
||||
{
|
||||
/// The function this function overrides, if any. This is always the closest
|
||||
/// in the linearized inheritance hierarchy.
|
||||
FunctionDefinition const* superFunction = nullptr;
|
||||
/// The set of functions this function overrides.
|
||||
std::set<FunctionDefinition const*> baseFunctions;
|
||||
/// Pointer to the contract this function is defined in
|
||||
ContractDefinition const* contract = nullptr;
|
||||
};
|
||||
|
@ -344,7 +344,6 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
|
||||
make_pair("documentation", _node.documentation() ? Json::Value(*_node.documentation()) : Json::nullValue),
|
||||
make_pair("kind", TokenTraits::toString(_node.kind())),
|
||||
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
|
||||
make_pair("superFunction", idOrNull(_node.annotation().superFunction)),
|
||||
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
|
||||
make_pair("overrides", _node.overrides() ? toJson(_node.overrides()->overrides()) : Json::nullValue),
|
||||
make_pair("parameters", toJson(_node.parameterList())),
|
||||
@ -354,6 +353,8 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
|
||||
make_pair("implemented", _node.isImplemented()),
|
||||
make_pair("scope", idOrNull(_node.scope()))
|
||||
};
|
||||
if (!_node.annotation().baseFunctions.empty())
|
||||
attributes.emplace_back(make_pair("baseFunctions", getContainerIds(_node.annotation().baseFunctions, true)));
|
||||
if (m_legacy)
|
||||
attributes.emplace_back("isConstructor", _node.isConstructor());
|
||||
setJsonNode(_node, "FunctionDefinition", std::move(attributes));
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 5,
|
||||
"src": "23:25:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -557,7 +557,6 @@
|
||||
"scope": 39,
|
||||
"src": "67:189:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -104,7 +104,6 @@
|
||||
"overrides": null,
|
||||
"scope": 39,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -156,7 +156,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:79:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -143,7 +143,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:93:1",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -93,7 +93,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:71:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -156,7 +156,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:99:1",
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "view",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -224,7 +224,6 @@
|
||||
"scope": 11,
|
||||
"src": "51:95:1",
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -128,7 +128,6 @@
|
||||
"overrides": null,
|
||||
"scope": 11,
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -97,7 +97,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:63:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -189,7 +189,6 @@
|
||||
"scope": 6,
|
||||
"src": "17:179:1",
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 6,
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -148,7 +148,6 @@
|
||||
"scope": 9,
|
||||
"src": "17:76:1",
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 9,
|
||||
"stateMutability": "pure",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 5,
|
||||
"src": "14:25:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -172,7 +172,6 @@
|
||||
"scope": 15,
|
||||
"src": "134:23:3",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -118,7 +118,6 @@
|
||||
"overrides": null,
|
||||
"scope": 15,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 5,
|
||||
"src": "15:33:1",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 9,
|
||||
"src": "15:32:1",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
{
|
||||
@ -96,7 +95,6 @@
|
||||
"scope": 9,
|
||||
"src": "50:33:1",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 9,
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
"children":
|
||||
@ -115,7 +114,6 @@
|
||||
"overrides": null,
|
||||
"scope": 9,
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
"children":
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
"children":
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 5,
|
||||
"src": "14:22:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
"children":
|
||||
|
@ -218,7 +218,6 @@
|
||||
"scope": 17,
|
||||
"src": "13:109:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 17,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -166,7 +166,6 @@
|
||||
"scope": 11,
|
||||
"src": "13:39:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 11,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -173,7 +173,6 @@
|
||||
"scope": 15,
|
||||
"src": "23:45:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -94,7 +94,6 @@
|
||||
"overrides": null,
|
||||
"scope": 15,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -165,7 +165,6 @@
|
||||
"scope": 14,
|
||||
"src": "39:27:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -112,7 +112,6 @@
|
||||
"overrides": null,
|
||||
"scope": 14,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -165,7 +165,6 @@
|
||||
"scope": 14,
|
||||
"src": "39:27:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -112,7 +112,6 @@
|
||||
"overrides": null,
|
||||
"scope": 14,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -113,7 +113,6 @@
|
||||
"scope": 8,
|
||||
"src": "13:40:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 8,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -68,7 +68,6 @@
|
||||
"scope": 5,
|
||||
"src": "14:24:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
@ -144,10 +143,13 @@
|
||||
"scope": 16,
|
||||
"src": "60:22:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
4
|
||||
],
|
||||
"body":
|
||||
{
|
||||
"id": 14,
|
||||
@ -180,7 +182,6 @@
|
||||
"scope": 16,
|
||||
"src": "84:33:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 4,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
@ -232,6 +233,10 @@
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
10
|
||||
],
|
||||
"body":
|
||||
{
|
||||
"id": 22,
|
||||
@ -264,10 +269,13 @@
|
||||
"scope": 31,
|
||||
"src": "139:34:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 10,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
15
|
||||
],
|
||||
"body":
|
||||
{
|
||||
"id": 29,
|
||||
@ -328,7 +336,6 @@
|
||||
"scope": 31,
|
||||
"src": "175:39:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 15,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -59,7 +59,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
@ -174,7 +173,6 @@
|
||||
"overrides": null,
|
||||
"scope": 16,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
@ -213,6 +211,10 @@
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
4
|
||||
],
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
@ -228,7 +230,6 @@
|
||||
],
|
||||
"scope": 16,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 4,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
@ -332,6 +333,10 @@
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
10
|
||||
],
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
@ -347,7 +352,6 @@
|
||||
],
|
||||
"scope": 31,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 10,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
@ -399,6 +403,10 @@
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
15
|
||||
],
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
@ -410,7 +418,6 @@
|
||||
"name": "faa",
|
||||
"scope": 31,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": 15,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -60,7 +60,6 @@
|
||||
"scope": 5,
|
||||
"src": "15:32:1",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
},
|
||||
"children":
|
||||
|
@ -117,7 +117,6 @@
|
||||
"scope": 11,
|
||||
"src": "13:40:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 11,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -129,7 +129,6 @@
|
||||
"scope": 12,
|
||||
"src": "13:45:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 12,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
@ -151,7 +151,6 @@
|
||||
"scope": 11,
|
||||
"src": "13:32:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
|
@ -51,7 +51,6 @@
|
||||
"overrides": null,
|
||||
"scope": 11,
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
|
270
test/libsolidity/ASTJSON/two_base_functions.json
Normal file
270
test/libsolidity/ASTJSON/two_base_functions.json
Normal file
@ -0,0 +1,270 @@
|
||||
{
|
||||
"absolutePath": "a",
|
||||
"exportedSymbols":
|
||||
{
|
||||
"A":
|
||||
[
|
||||
5
|
||||
],
|
||||
"B":
|
||||
[
|
||||
10
|
||||
],
|
||||
"C":
|
||||
[
|
||||
22
|
||||
]
|
||||
},
|
||||
"id": 23,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 5,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
5
|
||||
],
|
||||
"name": "A",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 3,
|
||||
"nodeType": "Block",
|
||||
"src": "45:2:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 4,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "f",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"overrides": null,
|
||||
"parameters":
|
||||
{
|
||||
"id": 1,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "27:2:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 2,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "45:0:1"
|
||||
},
|
||||
"scope": 5,
|
||||
"src": "17:30:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 23,
|
||||
"src": "0:49:1"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 10,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
10
|
||||
],
|
||||
"name": "B",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 8,
|
||||
"nodeType": "Block",
|
||||
"src": "95:2:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 9,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "f",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"overrides": null,
|
||||
"parameters":
|
||||
{
|
||||
"id": 6,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "77:2:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 7,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "95:0:1"
|
||||
},
|
||||
"scope": 10,
|
||||
"src": "67:30:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 23,
|
||||
"src": "50:49:1"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts":
|
||||
[
|
||||
{
|
||||
"arguments": null,
|
||||
"baseName":
|
||||
{
|
||||
"contractScope": null,
|
||||
"id": 11,
|
||||
"name": "A",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 5,
|
||||
"src": "114:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_contract$_A_$5",
|
||||
"typeString": "contract A"
|
||||
}
|
||||
},
|
||||
"id": 12,
|
||||
"nodeType": "InheritanceSpecifier",
|
||||
"src": "114:1:1"
|
||||
},
|
||||
{
|
||||
"arguments": null,
|
||||
"baseName":
|
||||
{
|
||||
"contractScope": null,
|
||||
"id": 13,
|
||||
"name": "B",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 10,
|
||||
"src": "117:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_contract$_B_$10",
|
||||
"typeString": "contract B"
|
||||
}
|
||||
},
|
||||
"id": 14,
|
||||
"nodeType": "InheritanceSpecifier",
|
||||
"src": "117:1:1"
|
||||
}
|
||||
],
|
||||
"contractDependencies":
|
||||
[
|
||||
5,
|
||||
10
|
||||
],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 22,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
22,
|
||||
10,
|
||||
5
|
||||
],
|
||||
"name": "C",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
4,
|
||||
9
|
||||
],
|
||||
"body":
|
||||
{
|
||||
"id": 20,
|
||||
"nodeType": "Block",
|
||||
"src": "160:2:1",
|
||||
"statements": []
|
||||
},
|
||||
"documentation": null,
|
||||
"id": 21,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "f",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"overrides":
|
||||
[
|
||||
{
|
||||
"contractScope": null,
|
||||
"id": 16,
|
||||
"name": "A",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 5,
|
||||
"src": "154:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_contract$_A_$5",
|
||||
"typeString": "contract A"
|
||||
}
|
||||
},
|
||||
{
|
||||
"contractScope": null,
|
||||
"id": 17,
|
||||
"name": "B",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 10,
|
||||
"src": "157:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_contract$_B_$10",
|
||||
"typeString": "contract B"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters":
|
||||
{
|
||||
"id": 15,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "135:2:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 19,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "160:0:1"
|
||||
},
|
||||
"scope": 22,
|
||||
"src": "125:37:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 23,
|
||||
"src": "100:64:1"
|
||||
}
|
||||
],
|
||||
"src": "0:165:1"
|
||||
}
|
11
test/libsolidity/ASTJSON/two_base_functions.sol
Normal file
11
test/libsolidity/ASTJSON/two_base_functions.sol
Normal file
@ -0,0 +1,11 @@
|
||||
contract A {
|
||||
function f() public virtual {}
|
||||
}
|
||||
contract B {
|
||||
function f() public virtual {}
|
||||
}
|
||||
contract C is A, B {
|
||||
function f() public override(A, B) {}
|
||||
}
|
||||
|
||||
// ----
|
378
test/libsolidity/ASTJSON/two_base_functions_legacy.json
Normal file
378
test/libsolidity/ASTJSON/two_base_functions_legacy.json
Normal file
@ -0,0 +1,378 @@
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"absolutePath": "a",
|
||||
"exportedSymbols":
|
||||
{
|
||||
"A":
|
||||
[
|
||||
5
|
||||
],
|
||||
"B":
|
||||
[
|
||||
10
|
||||
],
|
||||
"C":
|
||||
[
|
||||
22
|
||||
]
|
||||
}
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts":
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractDependencies":
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
5
|
||||
],
|
||||
"name": "A",
|
||||
"scope": 23
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"kind": "function",
|
||||
"modifiers":
|
||||
[
|
||||
null
|
||||
],
|
||||
"name": "f",
|
||||
"overrides": null,
|
||||
"scope": 5,
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 1,
|
||||
"name": "ParameterList",
|
||||
"src": "27:2:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 2,
|
||||
"name": "ParameterList",
|
||||
"src": "45:0:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"statements":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 3,
|
||||
"name": "Block",
|
||||
"src": "45:2:1"
|
||||
}
|
||||
],
|
||||
"id": 4,
|
||||
"name": "FunctionDefinition",
|
||||
"src": "17:30:1"
|
||||
}
|
||||
],
|
||||
"id": 5,
|
||||
"name": "ContractDefinition",
|
||||
"src": "0:49:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts":
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractDependencies":
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
10
|
||||
],
|
||||
"name": "B",
|
||||
"scope": 23
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"kind": "function",
|
||||
"modifiers":
|
||||
[
|
||||
null
|
||||
],
|
||||
"name": "f",
|
||||
"overrides": null,
|
||||
"scope": 10,
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 6,
|
||||
"name": "ParameterList",
|
||||
"src": "77:2:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 7,
|
||||
"name": "ParameterList",
|
||||
"src": "95:0:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"statements":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 8,
|
||||
"name": "Block",
|
||||
"src": "95:2:1"
|
||||
}
|
||||
],
|
||||
"id": 9,
|
||||
"name": "FunctionDefinition",
|
||||
"src": "67:30:1"
|
||||
}
|
||||
],
|
||||
"id": 10,
|
||||
"name": "ContractDefinition",
|
||||
"src": "50:49:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"abstract": false,
|
||||
"contractDependencies":
|
||||
[
|
||||
5,
|
||||
10
|
||||
],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
22,
|
||||
10,
|
||||
5
|
||||
],
|
||||
"name": "C",
|
||||
"scope": 23
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"arguments": null
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"contractScope": null,
|
||||
"name": "A",
|
||||
"referencedDeclaration": 5,
|
||||
"type": "contract A"
|
||||
},
|
||||
"id": 11,
|
||||
"name": "UserDefinedTypeName",
|
||||
"src": "114:1:1"
|
||||
}
|
||||
],
|
||||
"id": 12,
|
||||
"name": "InheritanceSpecifier",
|
||||
"src": "114:1:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"arguments": null
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"contractScope": null,
|
||||
"name": "B",
|
||||
"referencedDeclaration": 10,
|
||||
"type": "contract B"
|
||||
},
|
||||
"id": 13,
|
||||
"name": "UserDefinedTypeName",
|
||||
"src": "117:1:1"
|
||||
}
|
||||
],
|
||||
"id": 14,
|
||||
"name": "InheritanceSpecifier",
|
||||
"src": "117:1:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"baseFunctions":
|
||||
[
|
||||
4,
|
||||
9
|
||||
],
|
||||
"documentation": null,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"kind": "function",
|
||||
"modifiers":
|
||||
[
|
||||
null
|
||||
],
|
||||
"name": "f",
|
||||
"scope": 22,
|
||||
"stateMutability": "nonpayable",
|
||||
"visibility": "public"
|
||||
},
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"contractScope": null,
|
||||
"name": "A",
|
||||
"referencedDeclaration": 5,
|
||||
"type": "contract A"
|
||||
},
|
||||
"id": 16,
|
||||
"name": "UserDefinedTypeName",
|
||||
"src": "154:1:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"contractScope": null,
|
||||
"name": "B",
|
||||
"referencedDeclaration": 10,
|
||||
"type": "contract B"
|
||||
},
|
||||
"id": 17,
|
||||
"name": "UserDefinedTypeName",
|
||||
"src": "157:1:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 15,
|
||||
"name": "ParameterList",
|
||||
"src": "135:2:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"parameters":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 19,
|
||||
"name": "ParameterList",
|
||||
"src": "160:0:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"statements":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"children": [],
|
||||
"id": 20,
|
||||
"name": "Block",
|
||||
"src": "160:2:1"
|
||||
}
|
||||
],
|
||||
"id": 21,
|
||||
"name": "FunctionDefinition",
|
||||
"src": "125:37:1"
|
||||
}
|
||||
],
|
||||
"id": 22,
|
||||
"name": "ContractDefinition",
|
||||
"src": "100:64:1"
|
||||
}
|
||||
],
|
||||
"id": 23,
|
||||
"name": "SourceUnit",
|
||||
"src": "0:165:1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user