Browse Source

style fixes

cl-refactor
Liana Husikyan 10 years ago
parent
commit
95e161bfc9
  1. 16
      libevmcore/Assembly.cpp
  2. 18
      libevmcore/Assembly.h

16
libevmcore/Assembly.cpp

@ -189,35 +189,35 @@ Json::Value Assembly::streamAsmJson(ostream& _out, string const& _prefix, String
{ {
case Operation: case Operation:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(instructionInfo(i.instruction()).name, i.getLocation().start, i.getLocation().end, i.getJumpTypeAsString())); createJsonValue(instructionInfo(i.instruction()).name, i.getLocation().start, i.getLocation().end, i.getJumpTypeAsString()));
break; break;
case Push: case Push:
{ {
std::stringstream hexStr; std::stringstream hexStr;
hexStr << hex << (unsigned)i.data(); hexStr << hex << i.data();
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, hexStr.str(), i.getJumpTypeAsString())); createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, hexStr.str(), i.getJumpTypeAsString()));
} }
break; break;
case PushString: case PushString:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSH tag"), i.getLocation().start, i.getLocation().end, m_strings.at((h256)i.data()))); createJsonValue(string("PUSH tag"), i.getLocation().start, i.getLocation().end, m_strings.at((h256)i.data())));
break; break;
case PushTag: case PushTag:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSH [tag]"), i.getLocation().start, i.getLocation().end, string(i.data()))); createJsonValue(string("PUSH [tag]"), i.getLocation().start, i.getLocation().end, string(i.data())));
break; break;
case PushSub: case PushSub:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string("[$]" + string(h256(i.data()).abridged())))); createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string("[$]" + dev::toString(h256(i.data())))));
break; break;
case PushSubSize: case PushSubSize:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string("#[$]" + string(h256(i.data()).abridged())))); createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string("#[$]" + dev::toString(h256(i.data())))));
break; break;
case PushProgramSize: case PushProgramSize:
currentCollection.push_back( currentCollection.push_back(
createJsonValue(string("PUSHSIZE"), i.getLocation().start, i.getLocation().end)); createJsonValue(string("PUSHSIZE"), i.getLocation().start, i.getLocation().end));
break; break;
case Tag: case Tag:
{ {

18
libevmcore/Assembly.h

@ -92,10 +92,11 @@ public:
bytes assemble() const; bytes assemble() const;
Assembly& optimise(bool _enable); Assembly& optimise(bool _enable);
Json::Value stream( Json::Value stream(
std::ostream& _out, std::ostream& _out,
std::string const& _prefix = "", std::string const& _prefix = "",
const StringMap &_sourceCodes = StringMap(), const StringMap &_sourceCodes = StringMap(),
bool _inJsonFormat = false) const; bool _inJsonFormat = false
) const;
protected: protected:
std::string getLocationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) const; std::string getLocationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) const;
@ -104,10 +105,11 @@ protected:
private: private:
Json::Value streamAsmJson( Json::Value streamAsmJson(
std::ostream& _out, std::ostream& _out,
const std::string &_prefix, const std::string &_prefix,
const StringMap &_sourceCodes, const StringMap &_sourceCodes,
bool _inJsonFormat) const; bool _inJsonFormat
) const;
std::ostream& streamAsm(std::ostream& _out, std::string const& _prefix, StringMap const& _sourceCodes) const; std::ostream& streamAsm(std::ostream& _out, std::string const& _prefix, StringMap const& _sourceCodes) const;
Json::Value createJsonValue(std::string _name, int _locationX, int _locationY, std::string _value = std::string(), std::string _jumpType = std::string()) const; Json::Value createJsonValue(std::string _name, int _locationX, int _locationY, std::string _value = std::string(), std::string _jumpType = std::string()) const;

Loading…
Cancel
Save