diff options
author | chriseth <chris@ethereum.org> | 2018-02-23 18:42:53 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-03-02 00:19:35 +0800 |
commit | dc317a44e031d45ebf745b47248bf06bc92d58bf (patch) | |
tree | d03753c0d0ff0672669e0e8ecb70db84f73f6a7f /solc | |
parent | a53d6b499d5cc5c45fc096cea6393dc285581f90 (diff) | |
download | dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar.gz dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar.bz2 dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar.lz dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar.xz dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.tar.zst dexon-solidity-dc317a44e031d45ebf745b47248bf06bc92d58bf.zip |
Provide EVM version to assembly analysis.
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 31 | ||||
-rw-r--r-- | solc/CommandLineInterface.h | 2 |
2 files changed, 17 insertions, 16 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 04d6d1a8..8ccb04ee 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -748,6 +748,19 @@ bool CommandLineInterface::processInput() if (!parseLibraryOption(library)) return false; + EVMVersion evmVersion; + if (m_args.count(g_strEVMVersion)) + { + string versionOptionStr = m_args[g_strEVMVersion].as<string>(); + boost::optional<EVMVersion> versionOption = EVMVersion::fromString(versionOptionStr); + if (!versionOption) + { + cerr << "Invalid option for --evm-version: " << versionOptionStr << endl; + return false; + } + evmVersion = *versionOption; + } + if (m_args.count(g_argAssemble) || m_args.count(g_argStrictAssembly) || m_args.count(g_argJulia)) { // switch to assembly mode @@ -771,7 +784,7 @@ bool CommandLineInterface::processInput() return false; } } - return assemble(inputLanguage, targetMachine); + return assemble(evmVersion, inputLanguage, targetMachine); } if (m_args.count(g_argLink)) { @@ -782,19 +795,6 @@ bool CommandLineInterface::processInput() m_compiler.reset(new CompilerStack(fileReader)); - EVMVersion evmVersion; - if (m_args.count(g_strEVMVersion)) - { - string versionOptionStr = m_args[g_strEVMVersion].as<string>(); - boost::optional<EVMVersion> versionOption = EVMVersion::fromString(versionOptionStr); - if (!versionOption) - { - cerr << "Invalid option for --evm-version: " << versionOptionStr << endl; - return false; - } - evmVersion = *versionOption; - } - auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); }; SourceReferenceFormatter formatter(cerr, scannerFromSourceName); @@ -1081,6 +1081,7 @@ void CommandLineInterface::writeLinkedFiles() } bool CommandLineInterface::assemble( + EVMVersion _evmVersion, AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine ) @@ -1089,7 +1090,7 @@ bool CommandLineInterface::assemble( map<string, AssemblyStack> assemblyStacks; for (auto const& src: m_sourceCodes) { - auto& stack = assemblyStacks[src.first] = AssemblyStack(_language); + auto& stack = assemblyStacks[src.first] = AssemblyStack(_evmVersion, _language); try { if (!stack.parseAndAnalyze(src.first, src.second)) diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 4768c9d8..81117fdc 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -54,7 +54,7 @@ private: bool link(); void writeLinkedFiles(); - bool assemble(AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine); + bool assemble(EVMVersion _evmVersion, AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine); void outputCompilationResults(); |