mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Multi-source and multi-contract compiler.
This commit is contained in:
parent
5b6a211b8a
commit
445ba10d3b
@ -48,10 +48,11 @@ bytes compileContract(const string& _sourceCode)
|
||||
Parser parser;
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared<Scanner>(CharStream(_sourceCode))));
|
||||
NameAndTypeResolver resolver({});
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
NameAndTypeResolver resolver({});
|
||||
BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract));
|
||||
|
||||
Compiler compiler;
|
||||
|
@ -88,10 +88,11 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _
|
||||
Parser parser;
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared<Scanner>(CharStream(_sourceCode))));
|
||||
NameAndTypeResolver resolver({});
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
NameAndTypeResolver resolver({});
|
||||
BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract));
|
||||
FirstExpressionExtractor extractor(*contract);
|
||||
BOOST_REQUIRE(extractor.getExpression() != nullptr);
|
||||
|
@ -42,10 +42,11 @@ void parseTextAndResolveNames(std::string const& _source)
|
||||
{
|
||||
Parser parser;
|
||||
ASTPointer<SourceUnit> sourceUnit = parser.parse(std::make_shared<Scanner>(CharStream(_source)));
|
||||
NameAndTypeResolver resolver({});
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
NameAndTypeResolver resolver({});
|
||||
resolver.resolveNamesAndTypes(*contract);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user