aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-19 19:43:17 +0800
committerGitHub <noreply@github.com>2017-10-19 19:43:17 +0800
commit4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4 (patch)
treef4983ffe53f5c63478c682219f6cfae221493cd6 /test
parentb96602122c2380b1759a8f657a9b97e30c5978b0 (diff)
parent8d3cfa8cff85b1aed7c1b77a0886a58b09144a36 (diff)
downloaddexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar.gz
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar.bz2
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar.lz
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar.xz
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.tar.zst
dexon-solidity-4e7d1440ab84ba0566c7c75ff61b2f9e70738ef4.zip
Merge pull request #3101 from ethereum/compilerstack-header
Remove the reliance on empty contract name equals "last contract" in CompilerStack
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/AnalysisFramework.cpp2
-rw-r--r--test/libsolidity/GasMeter.cpp14
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp2
-rw-r--r--test/libsolidity/SolidityExecutionFramework.h2
-rw-r--r--test/libsolidity/SolidityNatspecJSON.cpp4
5 files changed, 12 insertions, 12 deletions
diff --git a/test/libsolidity/AnalysisFramework.cpp b/test/libsolidity/AnalysisFramework.cpp
index 3bdc40a0..ea9703ea 100644
--- a/test/libsolidity/AnalysisFramework.cpp
+++ b/test/libsolidity/AnalysisFramework.cpp
@@ -81,7 +81,7 @@ AnalysisFramework::parseAnalyseAndReturnError(
}
}
- return make_pair(&m_compiler.ast(), firstError);
+ return make_pair(&m_compiler.ast(""), firstError);
}
SourceUnit const* AnalysisFramework::parseAndAnalyse(string const& _source)
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index c2886f5b..86e8201b 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -51,8 +51,8 @@ public:
m_compiler.setOptimiserSettings(dev::test::Options::get().optimize);
BOOST_REQUIRE_MESSAGE(m_compiler.compile(), "Compiling contract failed");
- AssemblyItems const* items = m_compiler.runtimeAssemblyItems("");
- ASTNode const& sourceUnit = m_compiler.ast();
+ AssemblyItems const* items = m_compiler.runtimeAssemblyItems(m_compiler.lastContractName());
+ ASTNode const& sourceUnit = m_compiler.ast("");
BOOST_REQUIRE(items != nullptr);
m_gasCosts = GasEstimator::breakToStatementLevel(
GasEstimator::structuralEstimation(*items, vector<ASTNode const*>({&sourceUnit})),
@@ -64,13 +64,13 @@ public:
{
compileAndRun(_sourceCode);
auto state = make_shared<KnownState>();
- PathGasMeter meter(*m_compiler.assemblyItems());
+ PathGasMeter meter(*m_compiler.assemblyItems(m_compiler.lastContractName()));
GasMeter::GasConsumption gas = meter.estimateMax(0, state);
- u256 bytecodeSize(m_compiler.runtimeObject().bytecode.size());
+ u256 bytecodeSize(m_compiler.runtimeObject(m_compiler.lastContractName()).bytecode.size());
// costs for deployment
gas += bytecodeSize * GasCosts::createDataGas;
// costs for transaction
- gas += gasForTransaction(m_compiler.object().bytecode, true);
+ gas += gasForTransaction(m_compiler.object(m_compiler.lastContractName()).bytecode, true);
BOOST_REQUIRE(!gas.isInfinite);
BOOST_CHECK(gas.value == m_gasUsed);
@@ -91,7 +91,7 @@ public:
}
gas += GasEstimator::functionalEstimation(
- *m_compiler.runtimeAssemblyItems(),
+ *m_compiler.runtimeAssemblyItems(m_compiler.lastContractName()),
_sig
);
BOOST_REQUIRE(!gas.isInfinite);
@@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(non_overlapping_filtered_costs)
if (first->first->location().intersects(second->first->location()))
{
BOOST_CHECK_MESSAGE(false, "Source locations should not overlap!");
- auto scannerFromSource = [&](string const&) -> Scanner const& { return m_compiler.scanner(); };
+ auto scannerFromSource = [&](string const& _sourceName) -> Scanner const& { return m_compiler.scanner(_sourceName); };
SourceReferenceFormatter::printSourceLocation(cout, &first->first->location(), scannerFromSource);
SourceReferenceFormatter::printSourceLocation(cout, &second->first->location(), scannerFromSource);
}
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index 42f7525f..33962730 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -46,7 +46,7 @@ public:
m_compilerStack.addSource("", "pragma solidity >=0.0;\n" + _code);
BOOST_REQUIRE_MESSAGE(m_compilerStack.parseAndAnalyze(), "Parsing contract failed");
- Json::Value generatedInterface = m_compilerStack.contractABI("");
+ Json::Value generatedInterface = m_compilerStack.contractABI(m_compilerStack.lastContractName());
Json::Value expectedInterface;
BOOST_REQUIRE(m_reader.parse(_expectedInterfaceString, expectedInterface));
BOOST_CHECK_MESSAGE(
diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h
index 342d0875..b0daaba9 100644
--- a/test/libsolidity/SolidityExecutionFramework.h
+++ b/test/libsolidity/SolidityExecutionFramework.h
@@ -69,7 +69,7 @@ public:
);
BOOST_ERROR("Compiling contract failed");
}
- eth::LinkerObject obj = m_compiler.object(_contractName);
+ eth::LinkerObject obj = m_compiler.object(_contractName.empty() ? m_compiler.lastContractName() : _contractName);
BOOST_REQUIRE(obj.linkReferences.empty());
sendMessage(obj.bytecode + _arguments, true, _value);
return m_output;
diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp
index d83773bc..fb09451f 100644
--- a/test/libsolidity/SolidityNatspecJSON.cpp
+++ b/test/libsolidity/SolidityNatspecJSON.cpp
@@ -51,9 +51,9 @@ public:
Json::Value generatedDocumentation;
if (_userDocumentation)
- generatedDocumentation = m_compilerStack.natspecUser("");
+ generatedDocumentation = m_compilerStack.natspecUser(m_compilerStack.lastContractName());
else
- generatedDocumentation = m_compilerStack.natspecDev("");
+ generatedDocumentation = m_compilerStack.natspecDev(m_compilerStack.lastContractName());
Json::Value expectedDocumentation;
m_reader.parse(_expectedDocumentationString, expectedDocumentation);
BOOST_CHECK_MESSAGE(