aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-19 01:23:27 +0800
committerGitHub <noreply@github.com>2018-12-19 01:23:27 +0800
commitf5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d (patch)
tree90b947fbfd14ede59c3f98c2f3fabc8c4c632035 /libsolidity/interface/CompilerStack.h
parent34be592e533ad72087a3a32d2466404e6ca0d442 (diff)
parentbd52beedfff7196070880abbd396f5c7469314d0 (diff)
downloaddexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar.gz
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar.bz2
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar.lz
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar.xz
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.tar.zst
dexon-solidity-f5e52ef3c00fe1e988ca7071f7d6b03ab349ff4d.zip
Merge pull request #5679 from ethereum/hashCache
Cache hash computations.
Diffstat (limited to 'libsolidity/interface/CompilerStack.h')
-rw-r--r--libsolidity/interface/CompilerStack.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index 74033170..81d5009f 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -261,7 +261,11 @@ private:
std::shared_ptr<langutil::Scanner> scanner;
std::shared_ptr<SourceUnit> ast;
bool isLibrary = false;
- void reset() { scanner.reset(); ast.reset(); }
+ h256 mutable keccak256HashCached;
+ h256 mutable swarmHashCached;
+ void reset() { *this = Source(); }
+ h256 const& keccak256() const;
+ h256 const& swarmHash() const;
};
/// The state per contract. Filled gradually during compilation.
@@ -315,7 +319,7 @@ private:
std::string createMetadata(Contract const& _contract) const;
/// @returns the metadata CBOR for the given serialised metadata JSON.
- static bytes createCBORMetadata(std::string _metadata, bool _experimentalMode);
+ static bytes createCBORMetadata(std::string const& _metadata, bool _experimentalMode);
/// @returns the computer source mapping string.
std::string computeSourceMapping(eth::AssemblyItems const& _items) const;