mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove the ability to produce an AST in presence of errors in --error-recovery mode
This reverts commit 7fd7cc1e76.
This commit is contained in:
@@ -9,6 +9,3 @@ Warning: Recovered in Statement at ';'.
|
||||
|
|
||||
6 | balances[tx.origin] = ; // missing RHS.
|
||||
| ^
|
||||
|
||||
|
||||
Compilation halted after AST generation due to errors.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -6,12 +6,7 @@ contract Error1 {
|
||||
balances[tx.origin] = ; // missing RHS.
|
||||
}
|
||||
|
||||
// Without error recovery we stop due to the above error.
|
||||
// Error recovery however recovers at the above ';'
|
||||
// There should be an AST for the above, albeit with error
|
||||
// nodes.
|
||||
|
||||
// This function parses properly and should give AST info.
|
||||
// This function parses properly
|
||||
function five() public view returns(uint) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
JSON AST (compact format):
|
||||
|
||||
|
||||
======= recovery_ast_constructor/input.sol =======
|
||||
{
|
||||
"absolutePath": "recovery_ast_constructor/input.sol",
|
||||
"exportedSymbols":
|
||||
{
|
||||
"Error1":
|
||||
[
|
||||
18
|
||||
]
|
||||
},
|
||||
"id": 19,
|
||||
"license": "GPL-3.0",
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"literals":
|
||||
[
|
||||
"solidity",
|
||||
">=",
|
||||
"0.0",
|
||||
".0"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "36:24:0"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"canonicalName": "Error1",
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"fullyImplemented": true,
|
||||
"id": 18,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
18
|
||||
],
|
||||
"name": "Error1",
|
||||
"nameLocation": "71:6:0",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 8,
|
||||
"nodeType": "Block",
|
||||
"src": "96:49:0",
|
||||
"statements":
|
||||
[
|
||||
null
|
||||
]
|
||||
},
|
||||
"id": 9,
|
||||
"implemented": true,
|
||||
"kind": "constructor",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nameLocation": "-1:-1:-1",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 2,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "93:2:0"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 3,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "96:0:0"
|
||||
},
|
||||
"scope": 18,
|
||||
"src": "82:63:0",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 16,
|
||||
"nodeType": "Block",
|
||||
"src": "440:19:0",
|
||||
"statements":
|
||||
[
|
||||
{
|
||||
"expression":
|
||||
{
|
||||
"hexValue": "35",
|
||||
"id": 14,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "453:1:0",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_rational_5_by_1",
|
||||
"typeString": "int_const 5"
|
||||
},
|
||||
"value": "5"
|
||||
},
|
||||
"functionReturnParameters": 13,
|
||||
"id": 15,
|
||||
"nodeType": "Return",
|
||||
"src": "446:8:0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functionSelector": "af11c34c",
|
||||
"id": 17,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
"name": "five",
|
||||
"nameLocation": "407:4:0",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters":
|
||||
{
|
||||
"id": 10,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "411:2:0"
|
||||
},
|
||||
"returnParameters":
|
||||
{
|
||||
"id": 13,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 12,
|
||||
"mutability": "mutable",
|
||||
"name": "",
|
||||
"nameLocation": "-1:-1:-1",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "434:4:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName":
|
||||
{
|
||||
"id": 11,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "434:4:0",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "433:6:0"
|
||||
},
|
||||
"scope": 18,
|
||||
"src": "398:61:0",
|
||||
"stateMutability": "view",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 19,
|
||||
"src": "62:399:0",
|
||||
"usedErrors": [],
|
||||
"usedEvents": []
|
||||
}
|
||||
],
|
||||
"src": "36:426:0"
|
||||
}
|
||||
@@ -3,6 +3,3 @@ Error: Expected pragma, import directive or contract/interface/library/struct/en
|
||||
|
|
||||
3 | c
|
||||
| ^
|
||||
|
||||
|
||||
Compilation halted after AST generation due to errors.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -42,61 +42,5 @@
|
||||
"type": "Warning"
|
||||
}
|
||||
],
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"ast":
|
||||
{
|
||||
"absolutePath": "A",
|
||||
"exportedSymbols":
|
||||
{
|
||||
"Errort6":
|
||||
[
|
||||
3
|
||||
]
|
||||
},
|
||||
"id": 4,
|
||||
"license": "GPL-3.0",
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"literals":
|
||||
[
|
||||
"solidity",
|
||||
">=",
|
||||
"0.0"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "36:22:0"
|
||||
},
|
||||
{
|
||||
"abstract": false,
|
||||
"baseContracts": [],
|
||||
"canonicalName": "Errort6",
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"fullyImplemented": true,
|
||||
"id": 3,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
3
|
||||
],
|
||||
"name": "Errort6",
|
||||
"nameLocation": "68:7:0",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [],
|
||||
"scope": 4,
|
||||
"src": "59:35:0",
|
||||
"usedErrors": [],
|
||||
"usedEvents": []
|
||||
}
|
||||
],
|
||||
"src": "36:84:0"
|
||||
},
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
"sources": {}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ string compilerStateToString(CompilerStack::State _state)
|
||||
case CompilerStack::State::SourcesSet: return "SourcesSet";
|
||||
case CompilerStack::State::Parsed: return "Parsed";
|
||||
case CompilerStack::State::ParsedAndImported: return "ParsedAndImported";
|
||||
case CompilerStack::State::AnalysisPerformed: return "AnalysisPerformed";
|
||||
case CompilerStack::State::AnalysisSuccessful: return "AnalysisSuccessful";
|
||||
case CompilerStack::State::CompilationSuccessful: return "CompilationSuccessful";
|
||||
}
|
||||
soltestAssert(false, "Unexpected value of state parameter");
|
||||
@@ -102,7 +102,7 @@ void ASTJSONTest::generateTestVariants(string const& _filename)
|
||||
|
||||
const std::vector<CompilerStack::State> variantCompileStates = {
|
||||
CompilerStack::State::Parsed,
|
||||
CompilerStack::State::AnalysisPerformed
|
||||
CompilerStack::State::AnalysisSuccessful,
|
||||
};
|
||||
|
||||
for (const auto state: variantCompileStates)
|
||||
|
||||
@@ -102,7 +102,7 @@ EdgeNames edgeNames(EdgeMap const& _edgeMap)
|
||||
|
||||
tuple<CallGraphMap, CallGraphMap> collectGraphs(CompilerStack const& _compilerStack)
|
||||
{
|
||||
soltestAssert(!_compilerStack.hasError(), "");
|
||||
soltestAssert(_compilerStack.state() >= CompilerStack::State::AnalysisSuccessful);
|
||||
|
||||
tuple<CallGraphMap, CallGraphMap> graphs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user