mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1620 from ethereum/refactorEntry
Refactor NameAndTypeResolver and SyntaxChecker to allow other entry points.
This commit is contained in:
@@ -53,7 +53,8 @@ eth::AssemblyItems compileContract(const string& _sourceCode)
|
||||
BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared<Scanner>(CharStream(_sourceCode))));
|
||||
BOOST_CHECK(!!sourceUnit);
|
||||
|
||||
NameAndTypeResolver resolver({}, errors);
|
||||
map<ASTNode const*, shared_ptr<DeclarationContainer>> scopes;
|
||||
NameAndTypeResolver resolver({}, scopes, errors);
|
||||
solAssert(Error::containsOnlyWarnings(errors), "");
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
|
||||
|
||||
@@ -114,7 +114,8 @@ bytes compileFirstExpression(
|
||||
declarations.push_back(variable.get());
|
||||
|
||||
ErrorList errors;
|
||||
NameAndTypeResolver resolver(declarations, errors);
|
||||
map<ASTNode const*, shared_ptr<DeclarationContainer>> scopes;
|
||||
NameAndTypeResolver resolver(declarations, scopes, errors);
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
|
||||
vector<ContractDefinition const*> inheritanceHierarchy;
|
||||
|
||||
@@ -66,7 +66,8 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false,
|
||||
return make_pair(sourceUnit, errors.at(0));
|
||||
|
||||
std::shared_ptr<GlobalContext> globalContext = make_shared<GlobalContext>();
|
||||
NameAndTypeResolver resolver(globalContext->declarations(), errors);
|
||||
map<ASTNode const*, shared_ptr<DeclarationContainer>> scopes;
|
||||
NameAndTypeResolver resolver(globalContext->declarations(), scopes, errors);
|
||||
solAssert(Error::containsOnlyWarnings(errors), "");
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
|
||||
@@ -1080,7 +1081,7 @@ BOOST_AUTO_TEST_CASE(modifier_returns_value)
|
||||
modifier mod(uint a) { _; return 7; }
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "");
|
||||
CHECK_ERROR(text, TypeError, "Return arguments not allowed.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(state_variable_accessors)
|
||||
|
||||
Reference in New Issue
Block a user