From 954d7433bd8c10bce917326f70070077f0cfc165 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 9 Aug 2018 20:37:49 +0200 Subject: Disallow remappings with empty prefix. --- libsolidity/interface/CompilerStack.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'libsolidity/interface/CompilerStack.h') 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 const& _remappings); + // Parses a remapping of the format "context:prefix=target". + static boost::optional parseRemapping(std::string const& _remapping); + + /// Sets path remappings. + void setRemappings(std::vector 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; -- cgit v1.2.3