aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-07 21:49:05 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-09-11 20:47:25 +0800
commit395ab9a872bd8fafc0da7ec166176715ce18eae9 (patch)
treeee8fea8f180df6599cf9ecb9ee581cbcafceed5d
parent7d5c13981623f5f931444d227b163d9b0d995fd8 (diff)
downloaddexon-solidity-395ab9a872bd8fafc0da7ec166176715ce18eae9.tar.gz
dexon-solidity-395ab9a872bd8fafc0da7ec166176715ce18eae9.tar.zst
dexon-solidity-395ab9a872bd8fafc0da7ec166176715ce18eae9.zip
Replace ``isConstructor`` field in the JSON AST by a ``kind`` field.
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/ast/ASTJsonConverter.cpp2
-rw-r--r--test/libsolidity/ASTJSON/documentation.json2
-rw-r--r--test/libsolidity/ASTJSON/documentation_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/function_type.json2
-rw-r--r--test/libsolidity/ASTJSON/function_type_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/long_type_name_binary_operation.json2
-rw-r--r--test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/long_type_name_identifier.json2
-rw-r--r--test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/modifier_definition.json2
-rw-r--r--test/libsolidity/ASTJSON/modifier_definition_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/modifier_invocation.json2
-rw-r--r--test/libsolidity/ASTJSON/modifier_invocation_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/non_utf8.json2
-rw-r--r--test/libsolidity/ASTJSON/non_utf8_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/short_type_name.json2
-rw-r--r--test/libsolidity/ASTJSON/short_type_name_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/short_type_name_ref.json2
-rw-r--r--test/libsolidity/ASTJSON/short_type_name_ref_legacy.json2
-rw-r--r--test/libsolidity/ASTJSON/source_location.json2
-rw-r--r--test/libsolidity/ASTJSON/source_location_legacy.json2
22 files changed, 22 insertions, 21 deletions
diff --git a/Changelog.md b/Changelog.md
index 997c4069..507c3ce1 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -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.
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp
index beab356c..56a7ed06 100644
--- a/libsolidity/ast/ASTJsonConverter.cpp
+++ b/libsolidity/ast/ASTJsonConverter.cpp
@@ -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),
diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json
index 403d4e72..ce1e0b57 100644
--- a/test/libsolidity/ASTJSON/documentation.json
+++ b/test/libsolidity/ASTJSON/documentation.json
@@ -147,7 +147,7 @@
"documentation" : "Some comment on fn.",
"id" : 14,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "fn",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/documentation_legacy.json b/test/libsolidity/ASTJSON/documentation_legacy.json
index 5a890e50..7c9e7e20 100644
--- a/test/libsolidity/ASTJSON/documentation_legacy.json
+++ b/test/libsolidity/ASTJSON/documentation_legacy.json
@@ -107,7 +107,7 @@
{
"documentation" : "Some comment on fn.",
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/function_type.json b/test/libsolidity/ASTJSON/function_type.json
index 5dbc5b80..b78d8446 100644
--- a/test/libsolidity/ASTJSON/function_type.json
+++ b/test/libsolidity/ASTJSON/function_type.json
@@ -37,7 +37,7 @@
"documentation" : null,
"id" : 16,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/function_type_legacy.json b/test/libsolidity/ASTJSON/function_type_legacy.json
index af0c42dd..6c49a92f 100644
--- a/test/libsolidity/ASTJSON/function_type_legacy.json
+++ b/test/libsolidity/ASTJSON/function_type_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json
index fe3e73d2..c6d40af2 100644
--- a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json
+++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json
@@ -142,7 +142,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json
index d78d01ff..f6c32855 100644
--- a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json
+++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier.json b/test/libsolidity/ASTJSON/long_type_name_identifier.json
index 0579967c..505d260c 100644
--- a/test/libsolidity/ASTJSON/long_type_name_identifier.json
+++ b/test/libsolidity/ASTJSON/long_type_name_identifier.json
@@ -148,7 +148,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json
index a96ccef3..96363141 100644
--- a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json
+++ b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json
@@ -82,7 +82,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/modifier_definition.json b/test/libsolidity/ASTJSON/modifier_definition.json
index 95554f03..66359453 100644
--- a/test/libsolidity/ASTJSON/modifier_definition.json
+++ b/test/libsolidity/ASTJSON/modifier_definition.json
@@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
{
diff --git a/test/libsolidity/ASTJSON/modifier_definition_legacy.json b/test/libsolidity/ASTJSON/modifier_definition_legacy.json
index e1e797ba..1b384fe2 100644
--- a/test/libsolidity/ASTJSON/modifier_definition_legacy.json
+++ b/test/libsolidity/ASTJSON/modifier_definition_legacy.json
@@ -104,7 +104,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",
diff --git a/test/libsolidity/ASTJSON/modifier_invocation.json b/test/libsolidity/ASTJSON/modifier_invocation.json
index 95554f03..66359453 100644
--- a/test/libsolidity/ASTJSON/modifier_invocation.json
+++ b/test/libsolidity/ASTJSON/modifier_invocation.json
@@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
{
diff --git a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json
index e1e797ba..1b384fe2 100644
--- a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json
+++ b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json
@@ -104,7 +104,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",
diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json
index 307259e9..1852bd38 100644
--- a/test/libsolidity/ASTJSON/non_utf8.json
+++ b/test/libsolidity/ASTJSON/non_utf8.json
@@ -89,7 +89,7 @@
"documentation" : null,
"id" : 7,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/non_utf8_legacy.json b/test/libsolidity/ASTJSON/non_utf8_legacy.json
index b1f847f7..c20057e7 100644
--- a/test/libsolidity/ASTJSON/non_utf8_legacy.json
+++ b/test/libsolidity/ASTJSON/non_utf8_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/short_type_name.json b/test/libsolidity/ASTJSON/short_type_name.json
index 502c1e31..acb46157 100644
--- a/test/libsolidity/ASTJSON/short_type_name.json
+++ b/test/libsolidity/ASTJSON/short_type_name.json
@@ -93,7 +93,7 @@
"documentation" : null,
"id" : 9,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/short_type_name_legacy.json b/test/libsolidity/ASTJSON/short_type_name_legacy.json
index 761bcd3b..87b078b9 100644
--- a/test/libsolidity/ASTJSON/short_type_name_legacy.json
+++ b/test/libsolidity/ASTJSON/short_type_name_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/short_type_name_ref.json b/test/libsolidity/ASTJSON/short_type_name_ref.json
index b0c3ad97..b6b7bca5 100644
--- a/test/libsolidity/ASTJSON/short_type_name_ref.json
+++ b/test/libsolidity/ASTJSON/short_type_name_ref.json
@@ -105,7 +105,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json
index d426a384..406dc8d8 100644
--- a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json
+++ b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null
diff --git a/test/libsolidity/ASTJSON/source_location.json b/test/libsolidity/ASTJSON/source_location.json
index 8d8acb0f..f0ed216d 100644
--- a/test/libsolidity/ASTJSON/source_location.json
+++ b/test/libsolidity/ASTJSON/source_location.json
@@ -127,7 +127,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
diff --git a/test/libsolidity/ASTJSON/source_location_legacy.json b/test/libsolidity/ASTJSON/source_location_legacy.json
index 327cd6da..ee4e9841 100644
--- a/test/libsolidity/ASTJSON/source_location_legacy.json
+++ b/test/libsolidity/ASTJSON/source_location_legacy.json
@@ -40,7 +40,7 @@
{
"documentation" : null,
"implemented" : true,
- "isConstructor" : false,
+ "kind" : "function",
"modifiers" :
[
null