diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-10 02:37:49 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-11 01:26:48 +0800 |
commit | 954d7433bd8c10bce917326f70070077f0cfc165 (patch) | |
tree | f73a2699f3fc369fd9ae3783b271e9a11171fe80 /libsolidity/interface/CompilerStack.h | |
parent | 43db88b8363d73ee2f5ffa094ff506414261bd11 (diff) | |
download | dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.gz dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.zst dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.zip |
Disallow remappings with empty prefix.
Diffstat (limited to 'libsolidity/interface/CompilerStack.h')
-rw-r--r-- | libsolidity/interface/CompilerStack.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 2234a8c9..9a15fbf0 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -84,6 +84,13 @@ public: CompilationSuccessful }; + struct Remapping + { + std::string context; + std::string prefix; + std::string target; + }; + /// Creates a new compiler stack. /// @param _readFile callback to used to read files for import statements. Must return /// and must not emit exceptions. @@ -103,8 +110,11 @@ public: /// All settings, with the exception of remappings, are reset. void reset(bool _keepSources = false); - /// Sets path remappings in the format "context:prefix=target" - void setRemappings(std::vector<std::string> const& _remappings); + // Parses a remapping of the format "context:prefix=target". + static boost::optional<Remapping> parseRemapping(std::string const& _remapping); + + /// Sets path remappings. + void setRemappings(std::vector<Remapping> const& _remappings); /// Sets library addresses. Addresses are cleared iff @a _libraries is missing. /// Will not take effect before running compile. @@ -319,13 +329,6 @@ private: FunctionDefinition const& _function ) const; - struct Remapping - { - std::string context; - std::string prefix; - std::string target; - }; - ReadCallback::Callback m_readFile; ReadCallback::Callback m_smtQuery; bool m_optimize = false; |