diff --git a/test/libsolidity/ABIJson/global_struct.sol b/test/libsolidity/ABIJson/global_struct.sol new file mode 100644 index 000000000..74c8fba64 --- /dev/null +++ b/test/libsolidity/ABIJson/global_struct.sol @@ -0,0 +1,58 @@ +pragma experimental ABIEncoderV2; +struct S { uint a; } +contract C { + function f(S calldata s) external view {} + function g(S memory s) public view {} +} +// ---- +// :C +// [ +// { +// "constant": true, +// "inputs": +// [ +// { +// "components": +// [ +// { +// "internalType": "uint256", +// "name": "a", +// "type": "uint256" +// } +// ], +// "internalType": "struct S", +// "name": "s", +// "type": "tuple" +// } +// ], +// "name": "g", +// "outputs": [], +// "payable": false, +// "stateMutability": "view", +// "type": "function" +// }, +// { +// "constant": true, +// "inputs": +// [ +// { +// "components": +// [ +// { +// "internalType": "uint256", +// "name": "a", +// "type": "uint256" +// } +// ], +// "internalType": "struct S", +// "name": "s", +// "type": "tuple" +// } +// ], +// "name": "f", +// "outputs": [], +// "payable": false, +// "stateMutability": "view", +// "type": "function" +// } +// ] diff --git a/test/libsolidity/ASTJSON/global_enum.json b/test/libsolidity/ASTJSON/global_enum.json new file mode 100644 index 000000000..ccf3760ff --- /dev/null +++ b/test/libsolidity/ASTJSON/global_enum.json @@ -0,0 +1,32 @@ +{ + "absolutePath" : "a", + "exportedSymbols" : + { + "E" : + [ + 2 + ] + }, + "id" : 3, + "nodeType" : "SourceUnit", + "nodes" : + [ + { + "canonicalName" : "E", + "id" : 2, + "members" : + [ + { + "id" : 1, + "name" : "A", + "nodeType" : "EnumValue", + "src" : "9:1:1" + } + ], + "name" : "E", + "nodeType" : "EnumDefinition", + "src" : "0:12:1" + } + ], + "src" : "0:13:1" +} diff --git a/test/libsolidity/ASTJSON/global_enum.sol b/test/libsolidity/ASTJSON/global_enum.sol new file mode 100644 index 000000000..a9c72e0c0 --- /dev/null +++ b/test/libsolidity/ASTJSON/global_enum.sol @@ -0,0 +1,3 @@ +enum E { A } + +// ---- diff --git a/test/libsolidity/ASTJSON/global_enum_legacy.json b/test/libsolidity/ASTJSON/global_enum_legacy.json new file mode 100644 index 000000000..fc49b6cbe --- /dev/null +++ b/test/libsolidity/ASTJSON/global_enum_legacy.json @@ -0,0 +1,41 @@ +{ + "attributes" : + { + "absolutePath" : "a", + "exportedSymbols" : + { + "E" : + [ + 2 + ] + } + }, + "children" : + [ + { + "attributes" : + { + "canonicalName" : "E", + "name" : "E" + }, + "children" : + [ + { + "attributes" : + { + "name" : "A" + }, + "id" : 1, + "name" : "EnumValue", + "src" : "9:1:1" + } + ], + "id" : 2, + "name" : "EnumDefinition", + "src" : "0:12:1" + } + ], + "id" : 3, + "name" : "SourceUnit", + "src" : "0:13:1" +} diff --git a/test/libsolidity/ASTJSON/global_struct.json b/test/libsolidity/ASTJSON/global_struct.json new file mode 100644 index 000000000..63c4e463e --- /dev/null +++ b/test/libsolidity/ASTJSON/global_struct.json @@ -0,0 +1,58 @@ +{ + "absolutePath" : "a", + "exportedSymbols" : + { + "S" : + [ + 3 + ] + }, + "id" : 4, + "nodeType" : "SourceUnit", + "nodes" : + [ + { + "canonicalName" : "S", + "id" : 3, + "members" : + [ + { + "constant" : false, + "id" : 2, + "name" : "a", + "nodeType" : "VariableDeclaration", + "overrides" : null, + "scope" : 3, + "src" : "11:9:1", + "stateVariable" : false, + "storageLocation" : "default", + "typeDescriptions" : + { + "typeIdentifier" : "t_uint256", + "typeString" : "uint256" + }, + "typeName" : + { + "id" : 1, + "name" : "uint256", + "nodeType" : "ElementaryTypeName", + "src" : "11:7:1", + "typeDescriptions" : + { + "typeIdentifier" : "t_uint256", + "typeString" : "uint256" + } + }, + "value" : null, + "visibility" : "internal" + } + ], + "name" : "S", + "nodeType" : "StructDefinition", + "scope" : 4, + "src" : "0:23:1", + "visibility" : "public" + } + ], + "src" : "0:24:1" +} diff --git a/test/libsolidity/ASTJSON/global_struct.sol b/test/libsolidity/ASTJSON/global_struct.sol new file mode 100644 index 000000000..4c2d002a4 --- /dev/null +++ b/test/libsolidity/ASTJSON/global_struct.sol @@ -0,0 +1,3 @@ +struct S { uint256 a; } + +// ---- diff --git a/test/libsolidity/ASTJSON/global_struct_legacy.json b/test/libsolidity/ASTJSON/global_struct_legacy.json new file mode 100644 index 000000000..b54a31c0d --- /dev/null +++ b/test/libsolidity/ASTJSON/global_struct_legacy.json @@ -0,0 +1,64 @@ +{ + "attributes" : + { + "absolutePath" : "a", + "exportedSymbols" : + { + "S" : + [ + 3 + ] + } + }, + "children" : + [ + { + "attributes" : + { + "canonicalName" : "S", + "name" : "S", + "scope" : 4, + "visibility" : "public" + }, + "children" : + [ + { + "attributes" : + { + "constant" : false, + "name" : "a", + "overrides" : null, + "scope" : 3, + "stateVariable" : false, + "storageLocation" : "default", + "type" : "uint256", + "value" : null, + "visibility" : "internal" + }, + "children" : + [ + { + "attributes" : + { + "name" : "uint256", + "type" : "uint256" + }, + "id" : 1, + "name" : "ElementaryTypeName", + "src" : "11:7:1" + } + ], + "id" : 2, + "name" : "VariableDeclaration", + "src" : "11:9:1" + } + ], + "id" : 3, + "name" : "StructDefinition", + "src" : "0:23:1" + } + ], + "id" : 4, + "name" : "SourceUnit", + "src" : "0:24:1" +}