From fa5a7efb45de72d0a83e2e0bdb9b967f76f0c070 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 17 Jul 2017 11:43:56 +0100 Subject: Remove unused interfaces from CompilerStack --- libsolidity/interface/CompilerStack.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'libsolidity/interface/CompilerStack.h') diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 6b8fb538..1bfb193d 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -97,32 +97,23 @@ public: void setRemappings(std::vector const& _remappings); /// Resets the compiler to a state where the sources are not parsed or even removed. + /// Sets the state to SourcesSet if @a _keepSources is true, otherwise to Empty. + /// All settings, with the exception of remappings, are reset. void reset(bool _keepSources = false); /// Adds a source object (e.g. file) to the parser. After this, parse has to be called again. /// @returns true if a source object by the name already existed and was replaced. - void addSources(StringMap const& _nameContents, bool _isLibrary = false) - { - for (auto const& i: _nameContents) addSource(i.first, i.second, _isLibrary); - } bool addSource(std::string const& _name, std::string const& _content, bool _isLibrary = false); - void setSource(std::string const& _sourceCode); /// Parses all source units that were added /// @returns false on error. bool parse(); - /// Sets the given source code as the only source unit apart from standard sources and parses it. - /// @returns false on error. - bool parse(std::string const& _sourceCode); - /// performs the analyisis steps (imports, scopesetting, syntaxCheck, referenceResolving, + /// Performs the analysis steps (imports, scopesetting, syntaxCheck, referenceResolving, /// typechecking, staticAnalysis) on previously set sources /// @returns false on error. bool analyze(); /// Parses and analyzes all source units that were added /// @returns false on error. bool parseAndAnalyze(); - /// Sets the given source code as the only source unit apart from standard sources and parses and analyzes it. - /// @returns false on error. - bool parseAndAnalyze(std::string const& _sourceCode); /// @returns a list of the contract names in the sources. std::vector contractNames() const; @@ -133,9 +124,6 @@ public: unsigned _runs = 200, std::map const& _libraries = std::map{} ); - /// Parses and compiles the given source code. - /// @returns false on error. - bool compile(std::string const& _sourceCode, bool _optimize = false, unsigned _runs = 200); /// @returns the assembled object for a contract. eth::LinkerObject const& object(std::string const& _contractName = "") const; @@ -202,6 +190,7 @@ public: /// @returns the list of errors that occured during parsing and type checking. ErrorList const& errors() { return m_errorReporter.errors(); } + /// @returns the current state. State state() const { return m_stackState; } private: -- cgit v1.2.3 From 6848199b66d9cadae901f71dcf944fe9aa927eeb Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 17 Jul 2017 11:49:45 +0100 Subject: Add CompilerStack::setLibraries --- libsolidity/interface/CompilerStack.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libsolidity/interface/CompilerStack.h') diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 1bfb193d..39875c32 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -96,6 +96,13 @@ public: /// Sets path remappings in the format "context:prefix=target" void setRemappings(std::vector const& _remappings); + /// Sets library addresses. Addresses are cleared iff @a _libraries is missing. + /// Will not take effect before running compile. + void setLibraries(std::map const& _libraries = std::map{}) + { + m_libraries = _libraries; + } + /// Resets the compiler to a state where the sources are not parsed or even removed. /// Sets the state to SourcesSet if @a _keepSources is true, otherwise to Empty. /// All settings, with the exception of remappings, are reset. @@ -121,8 +128,7 @@ public: /// @returns false on error. bool compile( bool _optimize = false, - unsigned _runs = 200, - std::map const& _libraries = std::map{} + unsigned _runs = 200 ); /// @returns the assembled object for a contract. -- cgit v1.2.3 From 30012db396793efad5dba9a2bbb64d34994709ce Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 17 Jul 2017 11:54:02 +0100 Subject: Add CompilerStack::setOptimiserSettings --- libsolidity/interface/CompilerStack.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libsolidity/interface/CompilerStack.h') diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 39875c32..356389db 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -103,6 +103,14 @@ public: m_libraries = _libraries; } + /// Changes the optimiser settings. + /// Will not take effect before running compile. + void setOptimiserSettings(bool _optimize, unsigned _runs = 200) + { + m_optimize = _optimize; + m_optimizeRuns = _runs; + } + /// Resets the compiler to a state where the sources are not parsed or even removed. /// Sets the state to SourcesSet if @a _keepSources is true, otherwise to Empty. /// All settings, with the exception of remappings, are reset. @@ -126,10 +134,7 @@ public: /// Compiles the source units that were previously added and parsed. /// @returns false on error. - bool compile( - bool _optimize = false, - unsigned _runs = 200 - ); + bool compile(); /// @returns the assembled object for a contract. eth::LinkerObject const& object(std::string const& _contractName = "") const; -- cgit v1.2.3