aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-04 00:45:12 +0800
committerChristian <c@ethdev.com>2014-12-04 01:51:59 +0800
commit445ba10d3b9fc41591b9fb7a52e0fe862a10e7e7 (patch)
tree53ff62210fac5ed642427d8156790da093bf8df8
parent5b6a211b8aea80fc857e043fe5eb33f43c3f7df4 (diff)
downloaddexon-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.cpp3
-rw-r--r--solidityExpressionCompiler.cpp3
-rw-r--r--solidityNameAndTypeResolution.cpp3
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);
}
}