Rename Assignment to StackAssignment

This commit is contained in:
Alex Beregszaszi 2017-05-24 01:02:11 +01:00
parent e9b106cd0e
commit f15d6ea45f
9 changed files with 15 additions and 15 deletions

View File

@ -160,7 +160,7 @@ bool AsmAnalyzer::operator()(FunctionalInstruction const& _instr)
return success; return success;
} }
bool AsmAnalyzer::operator()(assembly::Assignment const& _assignment) bool AsmAnalyzer::operator()(assembly::StackAssignment const& _assignment)
{ {
bool success = checkAssignment(_assignment.variableName, size_t(-1)); bool success = checkAssignment(_assignment.variableName, size_t(-1));
m_info.stackHeightInfo[&_assignment] = m_stackHeight; m_info.stackHeightInfo[&_assignment] = m_stackHeight;

View File

@ -44,7 +44,7 @@ struct FunctionalAssignment;
struct VariableDeclaration; struct VariableDeclaration;
struct Instruction; struct Instruction;
struct Identifier; struct Identifier;
struct Assignment; struct StackAssignment;
struct FunctionDefinition; struct FunctionDefinition;
struct FunctionCall; struct FunctionCall;
@ -73,7 +73,7 @@ public:
bool operator()(assembly::Identifier const&); bool operator()(assembly::Identifier const&);
bool operator()(assembly::FunctionalInstruction const& _functionalInstruction); bool operator()(assembly::FunctionalInstruction const& _functionalInstruction);
bool operator()(assembly::Label const& _label); bool operator()(assembly::Label const& _label);
bool operator()(assembly::Assignment const&); bool operator()(assembly::StackAssignment const&);
bool operator()(assembly::FunctionalAssignment const& _functionalAssignment); bool operator()(assembly::FunctionalAssignment const& _functionalAssignment);
bool operator()(assembly::VariableDeclaration const& _variableDeclaration); bool operator()(assembly::VariableDeclaration const& _variableDeclaration);
bool operator()(assembly::FunctionDefinition const& _functionDefinition); bool operator()(assembly::FunctionDefinition const& _functionDefinition);

View File

@ -40,13 +40,13 @@ struct FunctionalAssignment;
struct VariableDeclaration; struct VariableDeclaration;
struct Instruction; struct Instruction;
struct Identifier; struct Identifier;
struct Assignment; struct StackAssignment;
struct FunctionDefinition; struct FunctionDefinition;
struct FunctionCall; struct FunctionCall;
struct Scope; struct Scope;
using Statement = boost::variant<Instruction, Literal, Label, Assignment, Identifier, FunctionalAssignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>; using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, FunctionalAssignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>;
struct AsmAnalysisInfo struct AsmAnalysisInfo
{ {

View File

@ -233,7 +233,7 @@ public:
m_assembly.appendLabel(*label.id); m_assembly.appendLabel(*label.id);
checkStackHeight(&_label); checkStackHeight(&_label);
} }
void operator()(assembly::Assignment const& _assignment) void operator()(assembly::StackAssignment const& _assignment)
{ {
m_assembly.setSourceLocation(_assignment.location); m_assembly.setSourceLocation(_assignment.location);
generateAssignment(_assignment.variableName, _assignment.location); generateAssignment(_assignment.variableName, _assignment.location);

View File

@ -50,14 +50,14 @@ struct Identifier { SourceLocation location; std::string name; };
struct FunctionalInstruction; struct FunctionalInstruction;
/// Jump label ("name:") /// Jump label ("name:")
struct Label { SourceLocation location; std::string name; }; struct Label { SourceLocation location; std::string name; };
/// Assignemnt (":= x", moves stack top into x, potentially multiple slots) /// Assignment from stack (":= x", moves stack top into x, potentially multiple slots)
struct Assignment { SourceLocation location; Identifier variableName; }; struct StackAssignment { SourceLocation location; Identifier variableName; };
struct FunctionalAssignment; struct FunctionalAssignment;
struct VariableDeclaration; struct VariableDeclaration;
struct FunctionDefinition; struct FunctionDefinition;
struct FunctionCall; struct FunctionCall;
struct Block; struct Block;
using Statement = boost::variant<Instruction, Literal, Label, Assignment, Identifier, FunctionalAssignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>; using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, FunctionalAssignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>;
/// Functional assignment ("x := mload(20:u256)", expects push-1-expression on the right hand /// Functional assignment ("x := mload(20:u256)", expects push-1-expression on the right hand
/// side and requires x to occupy exactly one stack slot. /// side and requires x to occupy exactly one stack slot.
struct FunctionalAssignment { SourceLocation location; Identifier variableName; std::shared_ptr<Statement> value; }; struct FunctionalAssignment { SourceLocation location; Identifier variableName; std::shared_ptr<Statement> value; };

View File

@ -71,7 +71,7 @@ assembly::Statement Parser::parseStatement()
{ {
if (m_julia) if (m_julia)
break; break;
assembly::Assignment assignment = createWithLocation<assembly::Assignment>(); assembly::StackAssignment assignment = createWithLocation<assembly::StackAssignment>();
m_scanner->next(); m_scanner->next();
expectToken(Token::Colon); expectToken(Token::Colon);
assignment.variableName.location = location(); assignment.variableName.location = location();

View File

@ -108,7 +108,7 @@ string AsmPrinter::operator()(assembly::Label const& _label)
return _label.name + ":"; return _label.name + ":";
} }
string AsmPrinter::operator()(assembly::Assignment const& _assignment) string AsmPrinter::operator()(assembly::StackAssignment const& _assignment)
{ {
solAssert(!m_julia, ""); solAssert(!m_julia, "");
return "=: " + (*this)(_assignment.variableName); return "=: " + (*this)(_assignment.variableName);

View File

@ -35,7 +35,7 @@ struct Literal;
struct Identifier; struct Identifier;
struct FunctionalInstruction; struct FunctionalInstruction;
struct Label; struct Label;
struct Assignment; struct StackAssignment;
struct FunctionalAssignment; struct FunctionalAssignment;
struct VariableDeclaration; struct VariableDeclaration;
struct FunctionDefinition; struct FunctionDefinition;
@ -52,7 +52,7 @@ public:
std::string operator()(assembly::Identifier const& _identifier); std::string operator()(assembly::Identifier const& _identifier);
std::string operator()(assembly::FunctionalInstruction const& _functionalInstruction); std::string operator()(assembly::FunctionalInstruction const& _functionalInstruction);
std::string operator()(assembly::Label const& _label); std::string operator()(assembly::Label const& _label);
std::string operator()(assembly::Assignment const& _assignment); std::string operator()(assembly::StackAssignment const& _assignment);
std::string operator()(assembly::FunctionalAssignment const& _functionalAssignment); std::string operator()(assembly::FunctionalAssignment const& _functionalAssignment);
std::string operator()(assembly::VariableDeclaration const& _variableDeclaration); std::string operator()(assembly::VariableDeclaration const& _variableDeclaration);
std::string operator()(assembly::FunctionDefinition const& _functionDefinition); std::string operator()(assembly::FunctionDefinition const& _functionDefinition);

View File

@ -43,7 +43,7 @@ struct FunctionalAssignment;
struct VariableDeclaration; struct VariableDeclaration;
struct Instruction; struct Instruction;
struct Identifier; struct Identifier;
struct Assignment; struct StackAssignment;
struct FunctionDefinition; struct FunctionDefinition;
struct FunctionCall; struct FunctionCall;
@ -64,7 +64,7 @@ public:
bool operator()(assembly::Identifier const&) { return true; } bool operator()(assembly::Identifier const&) { return true; }
bool operator()(assembly::FunctionalInstruction const&) { return true; } bool operator()(assembly::FunctionalInstruction const&) { return true; }
bool operator()(assembly::Label const& _label); bool operator()(assembly::Label const& _label);
bool operator()(assembly::Assignment const&) { return true; } bool operator()(assembly::StackAssignment const&) { return true; }
bool operator()(assembly::FunctionalAssignment const&) { return true; } bool operator()(assembly::FunctionalAssignment const&) { return true; }
bool operator()(assembly::VariableDeclaration const& _variableDeclaration); bool operator()(assembly::VariableDeclaration const& _variableDeclaration);
bool operator()(assembly::FunctionDefinition const& _functionDefinition); bool operator()(assembly::FunctionDefinition const& _functionDefinition);