aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-06-20 22:59:35 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-06-20 23:01:17 +0800
commitdcee8e11adba5382d40a25b4e61b5b364d27ecb2 (patch)
treeee7625c5ac46dc2bbb1c5e40a3fe7926f42b6f28 /libsolidity/interface
parentba7fbf11e72a4f9da149ac3c9b4c908e4f215250 (diff)
downloaddexon-solidity-dcee8e11adba5382d40a25b4e61b5b364d27ecb2.tar.gz
dexon-solidity-dcee8e11adba5382d40a25b4e61b5b364d27ecb2.tar.zst
dexon-solidity-dcee8e11adba5382d40a25b4e61b5b364d27ecb2.zip
Reorder some of the flow in CompilerStack::compileContract for readability
Diffstat (limited to 'libsolidity/interface')
-rw-r--r--libsolidity/interface/CompilerStack.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 47dc30cf..a3646a3d 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -711,9 +711,15 @@ void CompilerStack::compileContract(
for (auto const* dependency: _contract.annotation().contractDependencies)
compileContract(*dependency, _compiledContracts);
- shared_ptr<Compiler> compiler = make_shared<Compiler>(m_evmVersion, m_optimize, m_optimizeRuns);
Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
+
+ shared_ptr<Compiler> compiler = make_shared<Compiler>(m_evmVersion, m_optimize, m_optimizeRuns);
+ compiledContract.compiler = compiler;
+
string metadata = createMetadata(compiledContract);
+ compiledContract.metadata = metadata;
+
+ // Prepare CBOR metadata for the bytecode
bytes cborEncodedHash =
// CBOR-encoding of the key "bzzr0"
bytes{0x65, 'b', 'z', 'z', 'r', '0'}+
@@ -734,8 +740,9 @@ void CompilerStack::compileContract(
solAssert(cborEncodedMetadata.size() <= 0xffff, "Metadata too large");
// 16-bit big endian length
cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2);
+
+ // Run optimiser and compile the contract.
compiler->compileContract(_contract, _compiledContracts, cborEncodedMetadata);
- compiledContract.compiler = compiler;
try
{
@@ -763,7 +770,6 @@ void CompilerStack::compileContract(
solAssert(false, "Assembly exception for deployed bytecode");
}
- compiledContract.metadata = metadata;
_compiledContracts[compiledContract.contract] = &compiler->assembly();
try