From 187fa5075105008578fa2af467eda44bfa444144 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 24 May 2017 01:07:00 +0100 Subject: [PATCH] Rename FunctionalAssignment to Assignment --- libsolidity/inlineasm/AsmAnalysis.cpp | 2 +- libsolidity/inlineasm/AsmAnalysis.h | 4 ++-- libsolidity/inlineasm/AsmAnalysisInfo.h | 4 ++-- libsolidity/inlineasm/AsmCodeGen.cpp | 2 +- libsolidity/inlineasm/AsmData.h | 8 ++++---- libsolidity/inlineasm/AsmParser.cpp | 11 +++++------ libsolidity/inlineasm/AsmPrinter.cpp | 4 ++-- libsolidity/inlineasm/AsmPrinter.h | 4 ++-- libsolidity/inlineasm/AsmScopeFiller.h | 4 ++-- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp index ed0211d43..babb93b48 100644 --- a/libsolidity/inlineasm/AsmAnalysis.cpp +++ b/libsolidity/inlineasm/AsmAnalysis.cpp @@ -168,7 +168,7 @@ bool AsmAnalyzer::operator()(assembly::StackAssignment const& _assignment) } -bool AsmAnalyzer::operator()(FunctionalAssignment const& _assignment) +bool AsmAnalyzer::operator()(assembly::Assignment const& _assignment) { int const stackHeight = m_stackHeight; bool success = boost::apply_visitor(*this, *_assignment.value); diff --git a/libsolidity/inlineasm/AsmAnalysis.h b/libsolidity/inlineasm/AsmAnalysis.h index 4f2a9d9ea..f09e4b592 100644 --- a/libsolidity/inlineasm/AsmAnalysis.h +++ b/libsolidity/inlineasm/AsmAnalysis.h @@ -40,7 +40,7 @@ struct Literal; struct Block; struct Label; struct FunctionalInstruction; -struct FunctionalAssignment; +struct Assignment; struct VariableDeclaration; struct Instruction; struct Identifier; @@ -74,7 +74,7 @@ public: bool operator()(assembly::FunctionalInstruction const& _functionalInstruction); bool operator()(assembly::Label const& _label); bool operator()(assembly::StackAssignment const&); - bool operator()(assembly::FunctionalAssignment const& _functionalAssignment); + bool operator()(assembly::Assignment const& _assignment); bool operator()(assembly::VariableDeclaration const& _variableDeclaration); bool operator()(assembly::FunctionDefinition const& _functionDefinition); bool operator()(assembly::FunctionCall const& _functionCall); diff --git a/libsolidity/inlineasm/AsmAnalysisInfo.h b/libsolidity/inlineasm/AsmAnalysisInfo.h index 6f5b1159e..d2253c78e 100644 --- a/libsolidity/inlineasm/AsmAnalysisInfo.h +++ b/libsolidity/inlineasm/AsmAnalysisInfo.h @@ -36,7 +36,7 @@ struct Literal; struct Block; struct Label; struct FunctionalInstruction; -struct FunctionalAssignment; +struct Assignment; struct VariableDeclaration; struct Instruction; struct Identifier; @@ -46,7 +46,7 @@ struct FunctionCall; struct Scope; -using Statement = boost::variant; +using Statement = boost::variant; struct AsmAnalysisInfo { diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp index 708073e18..53eafc96d 100644 --- a/libsolidity/inlineasm/AsmCodeGen.cpp +++ b/libsolidity/inlineasm/AsmCodeGen.cpp @@ -239,7 +239,7 @@ public: generateAssignment(_assignment.variableName, _assignment.location); checkStackHeight(&_assignment); } - void operator()(FunctionalAssignment const& _assignment) + void operator()(assembly::Assignment const& _assignment) { int height = m_assembly.stackHeight(); boost::apply_visitor(*this, *_assignment.value); diff --git a/libsolidity/inlineasm/AsmData.h b/libsolidity/inlineasm/AsmData.h index 9d8610cff..3d2c8cade 100644 --- a/libsolidity/inlineasm/AsmData.h +++ b/libsolidity/inlineasm/AsmData.h @@ -52,15 +52,15 @@ struct FunctionalInstruction; struct Label { SourceLocation location; std::string name; }; /// Assignment from stack (":= x", moves stack top into x, potentially multiple slots) struct StackAssignment { SourceLocation location; Identifier variableName; }; -struct FunctionalAssignment; +struct Assignment; struct VariableDeclaration; struct FunctionDefinition; struct FunctionCall; struct Block; -using Statement = boost::variant; -/// Functional assignment ("x := mload(20:u256)", expects push-1-expression on the right hand +using Statement = boost::variant; +/// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand /// side and requires x to occupy exactly one stack slot. -struct FunctionalAssignment { SourceLocation location; Identifier variableName; std::shared_ptr value; }; +struct Assignment { SourceLocation location; Identifier variableName; std::shared_ptr value; }; /// Functional instruction, e.g. "mul(mload(20:u256), add(2:u256, x))" struct FunctionalInstruction { SourceLocation location; Instruction instruction; std::vector arguments; }; struct FunctionCall { SourceLocation location; Identifier functionName; std::vector arguments; }; diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 7c23e6b46..ffd9f6e25 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -107,15 +107,14 @@ assembly::Statement Parser::parseStatement() // while identifier:= (being followed by a non-colon) as identifier := (assignment). if (m_scanner->currentToken() == Token::Assign && m_scanner->peekNextToken() != Token::Colon) { - // functional assignment - FunctionalAssignment funAss = createWithLocation(identifier.location); + assembly::Assignment assignment = createWithLocation(identifier.location); if (!m_julia && instructions().count(identifier.name)) fatalParserError("Cannot use instruction names for identifier names."); m_scanner->next(); - funAss.variableName = identifier; - funAss.value.reset(new Statement(parseExpression())); - funAss.location.end = locationOf(*funAss.value).end; - return funAss; + assignment.variableName = identifier; + assignment.value.reset(new Statement(parseExpression())); + assignment.location.end = locationOf(*assignment.value).end; + return assignment; } else { diff --git a/libsolidity/inlineasm/AsmPrinter.cpp b/libsolidity/inlineasm/AsmPrinter.cpp index 8001f361d..92b12423a 100644 --- a/libsolidity/inlineasm/AsmPrinter.cpp +++ b/libsolidity/inlineasm/AsmPrinter.cpp @@ -114,9 +114,9 @@ string AsmPrinter::operator()(assembly::StackAssignment const& _assignment) return "=: " + (*this)(_assignment.variableName); } -string AsmPrinter::operator()(assembly::FunctionalAssignment const& _functionalAssignment) +string AsmPrinter::operator()(assembly::Assignment const& _assignment) { - return (*this)(_functionalAssignment.variableName) + " := " + boost::apply_visitor(*this, *_functionalAssignment.value); + return (*this)(_assignment.variableName) + " := " + boost::apply_visitor(*this, *_assignment.value); } string AsmPrinter::operator()(assembly::VariableDeclaration const& _variableDeclaration) diff --git a/libsolidity/inlineasm/AsmPrinter.h b/libsolidity/inlineasm/AsmPrinter.h index c608f8cb3..423eeefa2 100644 --- a/libsolidity/inlineasm/AsmPrinter.h +++ b/libsolidity/inlineasm/AsmPrinter.h @@ -36,7 +36,7 @@ struct Identifier; struct FunctionalInstruction; struct Label; struct StackAssignment; -struct FunctionalAssignment; +struct Assignment; struct VariableDeclaration; struct FunctionDefinition; struct FunctionCall; @@ -53,7 +53,7 @@ public: std::string operator()(assembly::FunctionalInstruction const& _functionalInstruction); std::string operator()(assembly::Label const& _label); std::string operator()(assembly::StackAssignment const& _assignment); - std::string operator()(assembly::FunctionalAssignment const& _functionalAssignment); + std::string operator()(assembly::Assignment const& _assignment); std::string operator()(assembly::VariableDeclaration const& _variableDeclaration); std::string operator()(assembly::FunctionDefinition const& _functionDefinition); std::string operator()(assembly::FunctionCall const& _functionCall); diff --git a/libsolidity/inlineasm/AsmScopeFiller.h b/libsolidity/inlineasm/AsmScopeFiller.h index 8aa962083..b1b0833b8 100644 --- a/libsolidity/inlineasm/AsmScopeFiller.h +++ b/libsolidity/inlineasm/AsmScopeFiller.h @@ -39,7 +39,7 @@ struct Literal; struct Block; struct Label; struct FunctionalInstruction; -struct FunctionalAssignment; +struct Assignment; struct VariableDeclaration; struct Instruction; struct Identifier; @@ -65,7 +65,7 @@ public: bool operator()(assembly::FunctionalInstruction const&) { return true; } bool operator()(assembly::Label const& _label); bool operator()(assembly::StackAssignment const&) { return true; } - bool operator()(assembly::FunctionalAssignment const&) { return true; } + bool operator()(assembly::Assignment const&) { return true; } bool operator()(assembly::VariableDeclaration const& _variableDeclaration); bool operator()(assembly::FunctionDefinition const& _functionDefinition); bool operator()(assembly::FunctionCall const&) { return true; }