Replace `isConstructor field in the JSON AST by a kind` field.

This commit is contained in:
Daniel Kirchner 2018-08-07 15:49:05 +02:00
parent 7d5c139816
commit 395ab9a872
22 changed files with 22 additions and 21 deletions

View File

@ -35,6 +35,7 @@ Breaking Changes:
* 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).
* JSON AST: Replace the ``isConstructor`` field by a new ``kind`` field, which can be ``constructor``, ``fallback`` or ``function``.
* Interface: Remove "clone contract" feature. The ``--clone-bin`` and ``--combined-json clone-bin`` commandline options are not available anymore.
* Name Resolver: Do not exclude public state variables when looking for conflicting declarations.
* Optimizer: Remove the no-op ``PUSH1 0 NOT AND`` sequence.

View File

@ -325,11 +325,11 @@ 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),
make_pair("kind", _node.isConstructor() ? "constructor" : (_node.isFallback() ? "fallback" : "function")),
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
make_pair("superFunction", idOrNull(_node.annotation().superFunction)),
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
make_pair("parameters", toJson(_node.parameterList())),
make_pair("isConstructor", _node.isConstructor()),
make_pair("returnParameters", toJson(*_node.returnParameterList())),
make_pair("modifiers", toJson(_node.modifiers())),
make_pair("body", _node.isImplemented() ? toJson(_node.body()) : Json::nullValue),

View File

@ -147,7 +147,7 @@
"documentation" : "Some comment on fn.",
"id" : 14,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "fn",
"nodeType" : "FunctionDefinition",

View File

@ -107,7 +107,7 @@
{
"documentation" : "Some comment on fn.",
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -37,7 +37,7 @@
"documentation" : null,
"id" : 16,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -142,7 +142,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -148,7 +148,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -82,7 +82,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
{

View File

@ -104,7 +104,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",

View File

@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
{

View File

@ -104,7 +104,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",

View File

@ -89,7 +89,7 @@
"documentation" : null,
"id" : 7,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -93,7 +93,7 @@
"documentation" : null,
"id" : 9,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -105,7 +105,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null

View File

@ -127,7 +127,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",

View File

@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null