mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename FunctionalAssignment to Assignment
This commit is contained in:
parent
f15d6ea45f
commit
187fa50751
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<Instruction, Literal, Label, StackAssignment, Identifier, FunctionalAssignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>;
|
||||
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>;
|
||||
|
||||
struct AsmAnalysisInfo
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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<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
|
||||
using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Block>;
|
||||
/// 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<Statement> value; };
|
||||
struct Assignment { SourceLocation location; Identifier variableName; std::shared_ptr<Statement> value; };
|
||||
/// Functional instruction, e.g. "mul(mload(20:u256), add(2:u256, x))"
|
||||
struct FunctionalInstruction { SourceLocation location; Instruction instruction; std::vector<Statement> arguments; };
|
||||
struct FunctionCall { SourceLocation location; Identifier functionName; std::vector<Statement> arguments; };
|
||||
|
@ -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<FunctionalAssignment>(identifier.location);
|
||||
assembly::Assignment assignment = createWithLocation<assembly::Assignment>(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
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
Loading…
Reference in New Issue
Block a user