Browse Source

fixed extension of file json format

changed value for PUSH to hex
cl-refactor
Liana Husikyan 10 years ago
parent
commit
3482c4dfc2
  1. 10
      libevmcore/Assembly.cpp
  2. 3
      libevmcore/Assembly.h
  3. 2
      solc/CommandLineInterface.cpp

10
libevmcore/Assembly.cpp

@ -25,13 +25,10 @@
#include <libevmcore/CommonSubexpressionEliminator.h>
#include <libevmcore/ControlFlowGraph.h>
#include <json/json.h>
using namespace std;
using namespace dev;
using namespace dev::eth;
void Assembly::append(Assembly const& _a)
{
auto newDeposit = m_deposit + _a.deposit();
@ -170,7 +167,6 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con
Json::Value Assembly::createJsonValue(string _name, int _locationX, int _locationY, string _value, string _jumpType) const
{
Json::Value value;
assert(!_name.empty());
value["name"] = _name;
value["locationX"] = _locationX;
value["locationY"] = _locationY;
@ -196,8 +192,12 @@ Json::Value Assembly::streamAsmJson(ostream& _out, string const& _prefix, String
createJsonValue(instructionInfo(i.instruction()).name, i.getLocation().start, i.getLocation().end, i.getJumpTypeAsString()));
break;
case Push:
{
std::stringstream hexStr;
hexStr << hex << (unsigned)i.data();
currentCollection.push_back(
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string(i.data()), i.getJumpTypeAsString()));
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, hexStr.str(), i.getJumpTypeAsString()));
}
break;
case PushString:
currentCollection.push_back(

3
libevmcore/Assembly.h

@ -123,16 +123,13 @@ protected:
int m_totalDeposit = 0;
SourceLocation m_currentSourceLocation;
};
inline std::ostream& operator<<(std::ostream& _out, Assembly const& _a)
{
_a.stream(_out);
return _out;
}
}
}

2
solc/CommandLineInterface.cpp

@ -430,7 +430,7 @@ void CommandLineInterface::actOnInput()
if (outputToFile(choice))
{
ofstream outFile(contract + ".evm");
ofstream outFile(contract + (m_args.count(g_argAsmJsonStr) ? "_evm.json" : ".evm"));
m_compiler->streamAssembly(outFile, contract, m_sourceCodes, m_args.count(g_argAsmJsonStr));
outFile.close();
}

Loading…
Cancel
Save