ABI and AST tests.

This commit is contained in:
Daniel Kirchner 2019-09-02 12:23:21 +02:00
parent c5eedc9e0b
commit 467d420f7e
7 changed files with 259 additions and 0 deletions

View File

@ -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"
// }
// ]

View File

@ -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"
}

View File

@ -0,0 +1,3 @@
enum E { A }
// ----

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1,3 @@
struct S { uint256 a; }
// ----

View File

@ -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"
}