diff options
author | Christian <c@ethdev.com> | 2014-12-04 00:45:12 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-04 01:51:59 +0800 |
commit | 445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7 (patch) | |
tree | 53ff62210fac5ed642427d8156790da093bf8df8 | |
parent | 5b6a211b8aea80fc857e043fe5eb33f43c3f7df4 (diff) | |
download | dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar.gz dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar.bz2 dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar.lz dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar.xz dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.tar.zst dexon-solidity-445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7.zip |
Multi-source and multi-contract compiler.
-rw-r--r-- | solidityCompiler.cpp | 3 | ||||
-rw-r--r-- | solidityExpressionCompiler.cpp | 3 | ||||
-rw-r--r-- | solidityNameAndTypeResolution.cpp | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/solidityCompiler.cpp b/solidityCompiler.cpp index 883cecf2..9862cba8 100644 --- a/solidityCompiler.cpp +++ b/solidityCompiler.cpp @@ -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; diff --git a/solidityExpressionCompiler.cpp b/solidityExpressionCompiler.cpp index b077e262..cb22d512 100644 --- a/solidityExpressionCompiler.cpp +++ b/solidityExpressionCompiler.cpp @@ -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); diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp index 219fa259..74af19b8 100644 --- a/solidityNameAndTypeResolution.cpp +++ b/solidityNameAndTypeResolution.cpp @@ -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); } } |