EVMVersion in langutil namespace instead of solidity

This commit is contained in:
Leonardo Alt
2019-02-25 15:29:57 +01:00
parent 52ee955fba
commit 2405b2151a
30 changed files with 72 additions and 75 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ class TypeChecker: private ASTConstVisitor
{
public:
/// @param _errorReporter provides the error logging functionality.
TypeChecker(EVMVersion _evmVersion, langutil::ErrorReporter& _errorReporter):
TypeChecker(langutil::EVMVersion _evmVersion, langutil::ErrorReporter& _errorReporter):
m_evmVersion(_evmVersion),
m_errorReporter(_errorReporter)
{}
@@ -156,7 +156,7 @@ private:
ContractDefinition const* m_scope = nullptr;
EVMVersion m_evmVersion;
langutil::EVMVersion m_evmVersion;
/// Flag indicating whether we are currently inside an EmitStatement.
bool m_insideEmitStatement = false;
+2 -2
View File
@@ -50,7 +50,7 @@ using TypePointers = std::vector<TypePointer>;
class ABIFunctions
{
public:
explicit ABIFunctions(EVMVersion _evmVersion = EVMVersion{}) : m_evmVersion(_evmVersion) {}
explicit ABIFunctions(langutil::EVMVersion _evmVersion = langutil::EVMVersion{}) : m_evmVersion(_evmVersion) {}
/// @returns name of an assembly function to ABI-encode values of @a _givenTypes
/// into memory, converting the types to @a _targetTypes on the fly.
@@ -286,7 +286,7 @@ private:
/// Map from function name to code for a multi-use function.
std::map<std::string, std::string> m_requestedFunctions;
std::set<std::string> m_externallyUsedFunctions;
EVMVersion m_evmVersion;
langutil::EVMVersion m_evmVersion;
};
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace solidity {
class Compiler
{
public:
explicit Compiler(EVMVersion _evmVersion = EVMVersion{}, bool _optimize = false, unsigned _runs = 200):
explicit Compiler(langutil::EVMVersion _evmVersion = langutil::EVMVersion{}, bool _optimize = false, unsigned _runs = 200):
m_optimize(_optimize),
m_optimizeRuns(_runs),
m_runtimeContext(_evmVersion),
+3 -3
View File
@@ -50,7 +50,7 @@ class Compiler;
class CompilerContext
{
public:
explicit CompilerContext(EVMVersion _evmVersion = EVMVersion{}, CompilerContext* _runtimeContext = nullptr):
explicit CompilerContext(langutil::EVMVersion _evmVersion = langutil::EVMVersion{}, CompilerContext* _runtimeContext = nullptr):
m_asm(std::make_shared<eth::Assembly>()),
m_evmVersion(_evmVersion),
m_runtimeContext(_runtimeContext),
@@ -60,7 +60,7 @@ public:
m_runtimeSub = size_t(m_asm->newSub(m_runtimeContext->m_asm).data());
}
EVMVersion const& evmVersion() const { return m_evmVersion; }
langutil::EVMVersion const& evmVersion() const { return m_evmVersion; }
/// Update currently enabled set of experimental features.
void setExperimentalFeatures(std::set<ExperimentalFeature> const& _features) { m_experimentalFeatures = _features; }
@@ -305,7 +305,7 @@ private:
eth::AssemblyPointer m_asm;
/// Version of the EVM to compile against.
EVMVersion m_evmVersion;
langutil::EVMVersion m_evmVersion;
/// Activated experimental features.
std::set<ExperimentalFeature> m_experimentalFeatures;
/// Other already compiled contracts to be used in contract creation calls.
+2 -2
View File
@@ -91,7 +91,7 @@ void CompilerStack::setRemappings(vector<Remapping> const& _remappings)
m_remappings = _remappings;
}
void CompilerStack::setEVMVersion(EVMVersion _version)
void CompilerStack::setEVMVersion(langutil::EVMVersion _version)
{
solAssert(m_stackState < State::ParsingSuccessful, "Set EVM version after parsing.");
m_evmVersion = _version;
@@ -113,7 +113,7 @@ void CompilerStack::reset(bool _keepSources)
m_smtlib2Responses.clear();
m_unhandledSMTLib2Queries.clear();
m_libraries.clear();
m_evmVersion = EVMVersion();
m_evmVersion = langutil::EVMVersion();
m_optimize = false;
m_optimizeRuns = 200;
m_globalContext.reset();
+2 -2
View File
@@ -136,7 +136,7 @@ public:
/// Set the EVM version used before running compile.
/// When called without an argument it will revert to the default version.
void setEVMVersion(EVMVersion _version = EVMVersion{});
void setEVMVersion(langutil::EVMVersion _version = langutil::EVMVersion{});
/// Sets the list of requested contract names. If empty, no filtering is performed and every contract
/// found in the supplied sources is compiled. Names are cleared iff @a _contractNames is missing.
@@ -348,7 +348,7 @@ private:
ReadCallback::Callback m_readFile;
bool m_optimize = false;
unsigned m_optimizeRuns = 200;
EVMVersion m_evmVersion;
langutil::EVMVersion m_evmVersion;
std::set<std::string> m_requestedContractNames;
std::map<std::string, h160> m_libraries;
/// list of path prefix remappings, e.g. mylibrary: github.com/ethereum = /usr/local/ethereum
+2 -2
View File
@@ -47,7 +47,7 @@ public:
using ASTGasConsumptionSelfAccumulated =
std::map<ASTNode const*, std::array<GasConsumption, 2>>;
explicit GasEstimator(EVMVersion _evmVersion): m_evmVersion(_evmVersion) {}
explicit GasEstimator(langutil::EVMVersion _evmVersion): m_evmVersion(_evmVersion) {}
/// Estimates the gas consumption for every assembly item in the given assembly and stores
/// it by source location.
@@ -84,7 +84,7 @@ public:
private:
/// @returns the set of AST nodes which are the finest nodes at their location.
static std::set<ASTNode const*> finestNodesAtLocation(std::vector<ASTNode const*> const& _roots);
EVMVersion m_evmVersion;
langutil::EVMVersion m_evmVersion;
};
}
+1 -1
View File
@@ -490,7 +490,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
{
if (!settings["evmVersion"].isString())
return formatFatalError("JSONError", "evmVersion must be a string.");
boost::optional<EVMVersion> version = EVMVersion::fromString(settings["evmVersion"].asString());
boost::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(settings["evmVersion"].asString());
if (!version)
return formatFatalError("JSONError", "Invalid EVM version requested.");
m_compilerStack.setEVMVersion(*version);