Merge pull request #4734 from ethereum/astUpdate

JSON AST: replace ``isConstructor`` by ``kind`` which also supports fallbacks
This commit is contained in:
chriseth
2018-10-08 21:47:27 +02:00
committed by GitHub
31 changed files with 575 additions and 11 deletions
+70
View File
@@ -0,0 +1,70 @@
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
},
"id" : 6,
"nodeType" : "SourceUnit",
"nodes" :
[
{
"baseContracts" : [],
"contractDependencies" : [],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"id" : 5,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"nodeType" : "ContractDefinition",
"nodes" :
[
{
"body" :
{
"id" : 3,
"nodeType" : "Block",
"src" : "35:4:1",
"statements" : []
},
"documentation" : null,
"id" : 4,
"implemented" : true,
"kind" : "constructor",
"modifiers" : [],
"name" : "",
"nodeType" : "FunctionDefinition",
"parameters" :
{
"id" : 1,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "25:2:1"
},
"returnParameters" :
{
"id" : 2,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "35:0:1"
},
"scope" : 5,
"src" : "14:25:1",
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "public"
}
],
"scope" : 6,
"src" : "0:41:1"
}
],
"src" : "0:42:1"
}
+4
View File
@@ -0,0 +1,4 @@
contract C {
constructor() public {
}
}
@@ -0,0 +1,110 @@
{
"attributes" :
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
}
},
"children" :
[
{
"attributes" :
{
"baseContracts" :
[
null
],
"contractDependencies" :
[
null
],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"scope" : 6
},
"children" :
[
{
"attributes" :
{
"documentation" : null,
"implemented" : true,
"isConstructor" : true,
"kind" : "constructor",
"modifiers" :
[
null
],
"name" : "",
"scope" : 5,
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "public"
},
"children" :
[
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 1,
"name" : "ParameterList",
"src" : "25:2:1"
},
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 2,
"name" : "ParameterList",
"src" : "35:0:1"
},
{
"attributes" :
{
"statements" :
[
null
]
},
"children" : [],
"id" : 3,
"name" : "Block",
"src" : "35:4:1"
}
],
"id" : 4,
"name" : "FunctionDefinition",
"src" : "14:25:1"
}
],
"id" : 5,
"name" : "ContractDefinition",
"src" : "0:41:1"
}
],
"id" : 6,
"name" : "SourceUnit",
"src" : "0:42:1"
}
+1 -1
View File
@@ -147,7 +147,7 @@
"documentation" : "Some comment on fn.",
"id" : 14,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "fn",
"nodeType" : "FunctionDefinition",
@@ -108,6 +108,7 @@
"documentation" : "Some comment on fn.",
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
+70
View File
@@ -0,0 +1,70 @@
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
},
"id" : 6,
"nodeType" : "SourceUnit",
"nodes" :
[
{
"baseContracts" : [],
"contractDependencies" : [],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"id" : 5,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"nodeType" : "ContractDefinition",
"nodes" :
[
{
"body" :
{
"id" : 3,
"nodeType" : "Block",
"src" : "43:5:1",
"statements" : []
},
"documentation" : null,
"id" : 4,
"implemented" : true,
"kind" : "fallback",
"modifiers" : [],
"name" : "",
"nodeType" : "FunctionDefinition",
"parameters" :
{
"id" : 1,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "23:2:1"
},
"returnParameters" :
{
"id" : 2,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "43:0:1"
},
"scope" : 5,
"src" : "15:33:1",
"stateMutability" : "payable",
"superFunction" : null,
"visibility" : "external"
}
],
"scope" : 6,
"src" : "0:50:1"
}
],
"src" : "0:51:1"
}
+4
View File
@@ -0,0 +1,4 @@
contract C {
function() external payable {
}
}
@@ -0,0 +1,110 @@
{
"attributes" :
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
}
},
"children" :
[
{
"attributes" :
{
"baseContracts" :
[
null
],
"contractDependencies" :
[
null
],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"scope" : 6
},
"children" :
[
{
"attributes" :
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "fallback",
"modifiers" :
[
null
],
"name" : "",
"scope" : 5,
"stateMutability" : "payable",
"superFunction" : null,
"visibility" : "external"
},
"children" :
[
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 1,
"name" : "ParameterList",
"src" : "23:2:1"
},
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 2,
"name" : "ParameterList",
"src" : "43:0:1"
},
{
"attributes" :
{
"statements" :
[
null
]
},
"children" : [],
"id" : 3,
"name" : "Block",
"src" : "43:5:1"
}
],
"id" : 4,
"name" : "FunctionDefinition",
"src" : "15:33:1"
}
],
"id" : 5,
"name" : "ContractDefinition",
"src" : "0:50:1"
}
],
"id" : 6,
"name" : "SourceUnit",
"src" : "0:51:1"
}
@@ -0,0 +1,70 @@
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
},
"id" : 6,
"nodeType" : "SourceUnit",
"nodes" :
[
{
"baseContracts" : [],
"contractDependencies" : [],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"id" : 5,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"nodeType" : "ContractDefinition",
"nodes" :
[
{
"body" :
{
"id" : 3,
"nodeType" : "Block",
"src" : "34:2:1",
"statements" : []
},
"documentation" : null,
"id" : 4,
"implemented" : true,
"kind" : "fallback",
"modifiers" : [],
"name" : "",
"nodeType" : "FunctionDefinition",
"parameters" :
{
"id" : 1,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "22:2:1"
},
"returnParameters" :
{
"id" : 2,
"nodeType" : "ParameterList",
"parameters" : [],
"src" : "34:0:1"
},
"scope" : 5,
"src" : "14:22:1",
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "external"
}
],
"scope" : 6,
"src" : "0:38:1"
}
],
"src" : "0:39:1"
}
@@ -0,0 +1,3 @@
contract C {
function() external {}
}
@@ -0,0 +1,110 @@
{
"attributes" :
{
"absolutePath" : "a",
"exportedSymbols" :
{
"C" :
[
5
]
}
},
"children" :
[
{
"attributes" :
{
"baseContracts" :
[
null
],
"contractDependencies" :
[
null
],
"contractKind" : "contract",
"documentation" : null,
"fullyImplemented" : true,
"linearizedBaseContracts" :
[
5
],
"name" : "C",
"scope" : 6
},
"children" :
[
{
"attributes" :
{
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "fallback",
"modifiers" :
[
null
],
"name" : "",
"scope" : 5,
"stateMutability" : "nonpayable",
"superFunction" : null,
"visibility" : "external"
},
"children" :
[
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 1,
"name" : "ParameterList",
"src" : "22:2:1"
},
{
"attributes" :
{
"parameters" :
[
null
]
},
"children" : [],
"id" : 2,
"name" : "ParameterList",
"src" : "34:0:1"
},
{
"attributes" :
{
"statements" :
[
null
]
},
"children" : [],
"id" : 3,
"name" : "Block",
"src" : "34:2:1"
}
],
"id" : 4,
"name" : "FunctionDefinition",
"src" : "14:22:1"
}
],
"id" : 5,
"name" : "ContractDefinition",
"src" : "0:38:1"
}
],
"id" : 6,
"name" : "SourceUnit",
"src" : "0:39:1"
}
+1 -1
View File
@@ -37,7 +37,7 @@
"documentation" : null,
"id" : 16,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -142,7 +142,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -148,7 +148,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -83,6 +83,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
{
@@ -105,6 +105,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",
@@ -97,7 +97,7 @@
"documentation" : null,
"id" : 13,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
{
@@ -105,6 +105,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"name" : "F",
"scope" : 14,
"stateMutability" : "nonpayable",
+1 -1
View File
@@ -89,7 +89,7 @@
"documentation" : null,
"id" : 7,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -93,7 +93,7 @@
"documentation" : null,
"id" : 9,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -105,7 +105,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null
@@ -127,7 +127,7 @@
"documentation" : null,
"id" : 10,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" : [],
"name" : "f",
"nodeType" : "FunctionDefinition",
@@ -41,6 +41,7 @@
"documentation" : null,
"implemented" : true,
"isConstructor" : false,
"kind" : "function",
"modifiers" :
[
null