Test
contract Ballot {
struct Voter {
uint weight;
bool voted;
}
function abstain() returns (bool) {
return false;
}
Voter you = Voter(1, true);
Voter me = Voter({
weight: 2,
voted: abstain()
});
}
AST for:
Voter you = Voter(1, true);
{
"type": "StateVariableDeclaration",
"name": "you",
"literal": {
"type": "Type",
"literal": "Voter",
"members": [],
"array_parts": [],
"start": 8709,
"end": 8714
},
"visibility": null,
"is_constant": false,
"value": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "Voter",
"start": 8721,
"end": 8726
},
"arguments": [
{
"type": "Literal",
"value": 1,
"start": 8727,
"end": 8728
},
{
"type": "Literal",
"value": true,
"start": 8730,
"end": 8734
}
],
"start": 8721,
"end": 8735
},
"start": 8709,
"end": 8736
},
AST for:
Voter me = Voter({
weight: 2,
voted: abstain()
});
{
"type": "StateVariableDeclaration",
"name": "me",
"literal": {
"type": "Type",
"literal": "Voter",
"members": [],
"array_parts": [],
"start": 8746,
"end": 8751
},
"visibility": null,
"is_constant": false,
"value": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "Voter",
"start": 8757,
"end": 8762
},
"arguments": [
{
"type": "NameValueAssignment",
"id": "weight",
"value": {
"type": "Literal",
"value": 2,
"start": 8781,
"end": 8782
},
"start": 8773,
"end": 8782
},
{
"type": "NameValueAssignment",
"id": "voted",
"value": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "abstained",
"start": 8800,
"end": 8809
},
"arguments": [],
"start": 8800,
"end": 8811
},
"start": 8793,
"end": 8816
}
],
"start": 8757,
"end": 8818
},
"start": 8746,
"end": 8819
}