mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add "fail after parsing" scenario to ASTJSON tests
This commit is contained in:
parent
f431c6f058
commit
371a531381
310
test/libsolidity/ASTJSON/fail_after_parsing.json
Normal file
310
test/libsolidity/ASTJSON/fail_after_parsing.json
Normal file
@ -0,0 +1,310 @@
|
||||
{
|
||||
"absolutePath": "a",
|
||||
"exportedSymbols":
|
||||
{
|
||||
"I":
|
||||
[
|
||||
29
|
||||
],
|
||||
"g":
|
||||
[
|
||||
3
|
||||
]
|
||||
},
|
||||
"id": 30,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"id": 3,
|
||||
"implemented": false,
|
||||
"kind": "freeFunction",
|
||||
"modifiers": [],
|
||||
"name": "g",
|
||||
"nameLocation": "9:1:1",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 1,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "10:2:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 2,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "19:0:1"
|
||||
},
|
||||
"scope": 30,
|
||||
"src": "0:20:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"canonicalName": "I",
|
||||
"contractDependencies": [],
|
||||
"contractKind": "interface",
|
||||
"id": 29,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
29
|
||||
],
|
||||
"name": "I",
|
||||
"nameLocation": "31:1:1",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"canonicalName": "I.S",
|
||||
"id": 7,
|
||||
"members":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 6,
|
||||
"mutability": "mutable",
|
||||
"name": "s",
|
||||
"nameLocation": "52:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 7,
|
||||
"src": "50:3:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 5,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 4,
|
||||
"name": "S",
|
||||
"nodeType": "IdentifierPath",
|
||||
"referencedDeclaration": 7,
|
||||
"src": "50:1:1"
|
||||
},
|
||||
"referencedDeclaration": 7,
|
||||
"src": "50:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"name": "S",
|
||||
"nameLocation": "46:1:1",
|
||||
"nodeType": "StructDefinition",
|
||||
"scope": 29,
|
||||
"src": "39:17:1",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 27,
|
||||
"nodeType": "Block",
|
||||
"src": "85:74:1",
|
||||
"statements":
|
||||
[
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
15
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 15,
|
||||
"mutability": "mutable",
|
||||
"name": "E",
|
||||
"nameLocation": "101:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 27,
|
||||
"src": "95:7:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 14,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 13,
|
||||
"name": "error",
|
||||
"nodeType": "IdentifierPath",
|
||||
"src": "95:5:1"
|
||||
},
|
||||
"src": "95:5:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 16,
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "95:7:1"
|
||||
},
|
||||
{
|
||||
"eventCall":
|
||||
{
|
||||
"arguments": [],
|
||||
"expression":
|
||||
{
|
||||
"id": 17,
|
||||
"name": "E",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"src": "110:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 18,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "110:3:1",
|
||||
"tryCall": false,
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 19,
|
||||
"nodeType": "EmitStatement",
|
||||
"src": "105:8:1"
|
||||
},
|
||||
{
|
||||
"expression":
|
||||
{
|
||||
"id": 21,
|
||||
"nodeType": "UnaryOperation",
|
||||
"operator": "++",
|
||||
"prefix": true,
|
||||
"src": "123:3:1",
|
||||
"subExpression":
|
||||
{
|
||||
"id": 20,
|
||||
"name": "c",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"src": "125:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 22,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "123:3:1"
|
||||
},
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
24
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 24,
|
||||
"mutability": "mutable",
|
||||
"name": "c",
|
||||
"nameLocation": "143:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 27,
|
||||
"src": "129:15:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "calldata",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 23,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "129:4:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 26,
|
||||
"initialValue":
|
||||
{
|
||||
"hexValue": "3132332e34",
|
||||
"id": 25,
|
||||
"kind": "number",
|
||||
"nodeType": "Literal",
|
||||
"src": "147:5:1",
|
||||
"typeDescriptions": {},
|
||||
"value": "123.4"
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "129:23:1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 28,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "f",
|
||||
"nameLocation": "70:1:1",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 11,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 10,
|
||||
"mutability": "mutable",
|
||||
"name": "e",
|
||||
"nameLocation": "82:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 28,
|
||||
"src": "72:11:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "storage",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 9,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 8,
|
||||
"name": "E",
|
||||
"nodeType": "IdentifierPath",
|
||||
"src": "72:1:1"
|
||||
},
|
||||
"src": "72:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "71:13:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 12,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "85:0:1"
|
||||
},
|
||||
"scope": 29,
|
||||
"src": "61:98:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 30,
|
||||
"src": "21:140:1",
|
||||
"usedErrors": []
|
||||
}
|
||||
],
|
||||
"src": "0:162:1"
|
||||
}
|
16
test/libsolidity/ASTJSON/fail_after_parsing.sol
Normal file
16
test/libsolidity/ASTJSON/fail_after_parsing.sol
Normal file
@ -0,0 +1,16 @@
|
||||
function g() public;
|
||||
|
||||
interface I {
|
||||
struct S { S s; }
|
||||
|
||||
function f(E storage e) {
|
||||
error E;
|
||||
emit E();
|
||||
|
||||
++c;
|
||||
uint calldata c = 123.4;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// failAfter: Parsed
|
283
test/libsolidity/ASTJSON/fail_after_parsing_parseOnly.json
Normal file
283
test/libsolidity/ASTJSON/fail_after_parsing_parseOnly.json
Normal file
@ -0,0 +1,283 @@
|
||||
{
|
||||
"absolutePath": "a",
|
||||
"id": 30,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"id": 3,
|
||||
"implemented": false,
|
||||
"kind": "freeFunction",
|
||||
"modifiers": [],
|
||||
"name": "g",
|
||||
"nameLocation": "9:1:1",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 1,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "10:2:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 2,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "19:0:1"
|
||||
},
|
||||
"src": "0:20:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "interface",
|
||||
"id": 29,
|
||||
"name": "I",
|
||||
"nameLocation": "31:1:1",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"id": 7,
|
||||
"members":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 6,
|
||||
"mutability": "mutable",
|
||||
"name": "s",
|
||||
"nameLocation": "52:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"src": "50:3:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 5,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 4,
|
||||
"name": "S",
|
||||
"nodeType": "IdentifierPath",
|
||||
"src": "50:1:1"
|
||||
},
|
||||
"src": "50:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"name": "S",
|
||||
"nameLocation": "46:1:1",
|
||||
"nodeType": "StructDefinition",
|
||||
"src": "39:17:1",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 27,
|
||||
"nodeType": "Block",
|
||||
"src": "85:88:1",
|
||||
"statements":
|
||||
[
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
15
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 15,
|
||||
"mutability": "mutable",
|
||||
"name": "E",
|
||||
"nameLocation": "101:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"src": "95:7:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 14,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 13,
|
||||
"name": "error",
|
||||
"nodeType": "IdentifierPath",
|
||||
"src": "95:5:1"
|
||||
},
|
||||
"src": "95:5:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 16,
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "95:7:1"
|
||||
},
|
||||
{
|
||||
"eventCall":
|
||||
{
|
||||
"arguments": [],
|
||||
"expression":
|
||||
{
|
||||
"id": 17,
|
||||
"name": "E",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"src": "117:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 18,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "117:3:1",
|
||||
"tryCall": false,
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 19,
|
||||
"nodeType": "EmitStatement",
|
||||
"src": "112:8:1"
|
||||
},
|
||||
{
|
||||
"expression":
|
||||
{
|
||||
"id": 21,
|
||||
"nodeType": "UnaryOperation",
|
||||
"operator": "++",
|
||||
"prefix": true,
|
||||
"src": "130:3:1",
|
||||
"subExpression":
|
||||
{
|
||||
"id": 20,
|
||||
"name": "c",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"src": "132:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"id": 22,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "130:3:1"
|
||||
},
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
24
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 24,
|
||||
"mutability": "mutable",
|
||||
"name": "c",
|
||||
"nameLocation": "157:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"src": "143:15:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "calldata",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 23,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "143:4:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 26,
|
||||
"initialValue":
|
||||
{
|
||||
"hexValue": "3132332e34",
|
||||
"id": 25,
|
||||
"kind": "number",
|
||||
"nodeType": "Literal",
|
||||
"src": "161:5:1",
|
||||
"typeDescriptions": {},
|
||||
"value": "123.4"
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "143:23:1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 28,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "f",
|
||||
"nameLocation": "70:1:1",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 11,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 10,
|
||||
"mutability": "mutable",
|
||||
"name": "e",
|
||||
"nameLocation": "82:1:1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"src": "72:11:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "storage",
|
||||
"typeDescriptions": {},
|
||||
"typeName":
|
||||
{
|
||||
"id": 9,
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"pathNode":
|
||||
{
|
||||
"id": 8,
|
||||
"name": "E",
|
||||
"nodeType": "IdentifierPath",
|
||||
"src": "72:1:1"
|
||||
},
|
||||
"src": "72:1:1",
|
||||
"typeDescriptions": {}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "71:13:1"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 12,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "85:0:1"
|
||||
},
|
||||
"src": "61:112:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"src": "21:154:1",
|
||||
"usedErrors": []
|
||||
}
|
||||
],
|
||||
"src": "0:176:1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user