Merge pull request #4663 from ethereum/dropConstantAST

[BREAKING] Drop constant field from JSON AST
This commit is contained in:
chriseth 2018-08-06 18:55:12 +02:00 committed by GitHub
commit 276724dedc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 1 additions and 54 deletions

View File

@ -33,6 +33,7 @@ Breaking Changes:
* General: Remove assembly instruction aliases ``sha3`` and ``suicide``
* General: C99-style scoping rules are enforced now. This was already the case in the experimental 0.5.0 mode.
* General: Disallow combining hex numbers with unit denominations (e.g. ``0x1e wei``). This was already the case in the experimental 0.5.0 mode.
* JSON AST: Remove ``constant`` and ``payable`` fields (the information is encoded in the ``stateMutability`` field).
* Name Resolver: Do not exclude public state variables when looking for conflicting declarations.
* Optimizer: Remove the no-op ``PUSH1 0 NOT AND`` sequence.
* Parser: Disallow trailing dots that are not followed by a number.

View File

@ -325,9 +325,6 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
std::vector<pair<string, Json::Value>> attributes = {
make_pair("name", _node.name()),
make_pair("documentation", _node.documentation() ? Json::Value(*_node.documentation()) : Json::nullValue),
// FIXME: remove with next breaking release
make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() <= StateMutability::View),
make_pair("payable", _node.isPayable()),
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
make_pair("superFunction", idOrNull(_node.annotation().superFunction)),
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
@ -418,11 +415,8 @@ bool ASTJsonConverter::visit(UserDefinedTypeName const& _node)
bool ASTJsonConverter::visit(FunctionTypeName const& _node)
{
setJsonNode(_node, "FunctionTypeName", {
make_pair("payable", _node.isPayable()),
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
// FIXME: remove with next breaking release
make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() <= StateMutability::View),
make_pair("parameterTypes", toJson(*_node.parameterTypeList())),
make_pair("returnParameterTypes", toJson(*_node.returnParameterTypeList())),
make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true))

View File

@ -148,7 +148,6 @@
"id" : 14,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "fn",
"nodeType" : "FunctionDefinition",
@ -159,7 +158,6 @@
"parameters" : [],
"src" : "145:2:3"
},
"payable" : false,
"returnParameters" :
{
"id" : 12,

View File

@ -105,7 +105,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : "Some comment on fn.",
"implemented" : true,
"isConstructor" : false,
@ -114,7 +113,6 @@
null
],
"name" : "fn",
"payable" : false,
"scope" : 15,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -38,7 +38,6 @@
"id" : 16,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -65,7 +64,6 @@
"typeName" :
{
"id" : 5,
"isDeclaredConst" : false,
"nodeType" : "FunctionTypeName",
"parameterTypes" :
{
@ -74,7 +72,6 @@
"parameters" : [],
"src" : "32:2:1"
},
"payable" : true,
"returnParameterTypes" :
{
"id" : 4,
@ -128,7 +125,6 @@
],
"src" : "23:46:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 14,
@ -152,7 +148,6 @@
"typeName" :
{
"id" : 12,
"isDeclaredConst" : true,
"nodeType" : "FunctionTypeName",
"parameterTypes" :
{
@ -161,7 +156,6 @@
"parameters" : [],
"src" : "87:2:1"
},
"payable" : false,
"returnParameterTypes" :
{
"id" : 11,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 17,
"stateMutability" : "nonpayable",
"superFunction" : null,
@ -75,8 +73,6 @@
{
"attributes" :
{
"constant" : false,
"payable" : true,
"stateMutability" : "payable",
"type" : "function () payable external returns (uint256)",
"visibility" : "external"
@ -168,8 +164,6 @@
{
"attributes" :
{
"constant" : true,
"payable" : false,
"stateMutability" : "view",
"type" : "function () view external returns (uint256)",
"visibility" : "external"

View File

@ -143,7 +143,6 @@
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -154,7 +153,6 @@
"parameters" : [],
"src" : "23:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 2,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 11,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -149,7 +149,6 @@
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -160,7 +159,6 @@
"parameters" : [],
"src" : "33:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 5,

View File

@ -80,7 +80,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -89,7 +88,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 14,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -98,7 +98,6 @@
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" :
[
{
@ -153,7 +152,6 @@
"parameters" : [],
"src" : "49:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 11,

View File

@ -102,12 +102,10 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"name" : "F",
"payable" : false,
"scope" : 14,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -98,7 +98,6 @@
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" :
[
{
@ -153,7 +152,6 @@
"parameters" : [],
"src" : "49:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 11,

View File

@ -102,12 +102,10 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"name" : "F",
"payable" : false,
"scope" : 14,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -90,7 +90,6 @@
"id" : 7,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -101,7 +100,6 @@
"parameters" : [],
"src" : "23:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 2,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 8,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -94,7 +94,6 @@
"id" : 9,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -105,7 +104,6 @@
"parameters" : [],
"src" : "23:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 2,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 10,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -106,7 +106,6 @@
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -117,7 +116,6 @@
"parameters" : [],
"src" : "23:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 2,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 11,
"stateMutability" : "nonpayable",
"superFunction" : null,

View File

@ -128,7 +128,6 @@
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"isDeclaredConst" : false,
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@ -139,7 +138,6 @@
"parameters" : [],
"src" : "23:2:1"
},
"payable" : false,
"returnParameters" :
{
"id" : 2,

View File

@ -38,7 +38,6 @@
{
"attributes" :
{
"constant" : false,
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
@ -47,7 +46,6 @@
null
],
"name" : "f",
"payable" : false,
"scope" : 11,
"stateMutability" : "nonpayable",
"superFunction" : null,