diff options
author | Linus Groh <mail@linusgroh.de> | 2020-04-05 12:56:53 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-05 15:31:12 +0200 |
commit | eafd3dbaf88461ba7fb99ce8c5c6e7a295bed9b4 (patch) | |
tree | e469717edac85eefd7367369b42f15018a128298 /Libraries | |
parent | a4f6f8e0e7019fcf8e3f894cca0cda0ede04ba42 (diff) | |
download | serenity-eafd3dbaf88461ba7fb99ce8c5c6e7a295bed9b4.zip |
LibJS: Rename BinaryOp::{Plus,Minus,Asterisk,Slash}
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 16 | ||||
-rw-r--r-- | Libraries/LibJS/AST.h | 8 | ||||
-rw-r--r-- | Libraries/LibJS/Parser.cpp | 8 |
3 files changed, 16 insertions, 16 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 5305ae7bf1..5a7f8cc152 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -273,13 +273,13 @@ Value BinaryExpression::execute(Interpreter& interpreter) const return {}; switch (m_op) { - case BinaryOp::Plus: + case BinaryOp::Addition: return add(lhs_result, rhs_result); - case BinaryOp::Minus: + case BinaryOp::Subtraction: return sub(lhs_result, rhs_result); - case BinaryOp::Asterisk: + case BinaryOp::Multiplication: return mul(lhs_result, rhs_result); - case BinaryOp::Slash: + case BinaryOp::Division: return div(lhs_result, rhs_result); case BinaryOp::Modulo: return mod(lhs_result, rhs_result); @@ -406,16 +406,16 @@ void BinaryExpression::dump(int indent) const { const char* op_string = nullptr; switch (m_op) { - case BinaryOp::Plus: + case BinaryOp::Addition: op_string = "+"; break; - case BinaryOp::Minus: + case BinaryOp::Subtraction: op_string = "-"; break; - case BinaryOp::Asterisk: + case BinaryOp::Multiplication: op_string = "*"; break; - case BinaryOp::Slash: + case BinaryOp::Division: op_string = "/"; break; case BinaryOp::Modulo: diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 96ded13ea0..af6b13bced 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -309,10 +309,10 @@ private: }; enum class BinaryOp { - Plus, - Minus, - Asterisk, - Slash, + Addition, + Subtraction, + Multiplication, + Division, Modulo, TypedEquals, TypedInequals, diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp index 3f91503421..780b953121 100644 --- a/Libraries/LibJS/Parser.cpp +++ b/Libraries/LibJS/Parser.cpp @@ -445,25 +445,25 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre switch (m_parser_state.m_current_token.type()) { case TokenType::Plus: consume(); - return create_ast_node<BinaryExpression>(BinaryOp::Plus, move(lhs), parse_expression(min_precedence, associativity)); + return create_ast_node<BinaryExpression>(BinaryOp::Addition, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::PlusEquals: consume(); return create_ast_node<AssignmentExpression>(AssignmentOp::AdditionAssignment, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::Minus: consume(); - return create_ast_node<BinaryExpression>(BinaryOp::Minus, move(lhs), parse_expression(min_precedence, associativity)); + return create_ast_node<BinaryExpression>(BinaryOp::Subtraction, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::MinusEquals: consume(); return create_ast_node<AssignmentExpression>(AssignmentOp::SubtractionAssignment, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::Asterisk: consume(); - return create_ast_node<BinaryExpression>(BinaryOp::Asterisk, move(lhs), parse_expression(min_precedence, associativity)); + return create_ast_node<BinaryExpression>(BinaryOp::Multiplication, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::AsteriskEquals: consume(); return create_ast_node<AssignmentExpression>(AssignmentOp::MultiplicationAssignment, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::Slash: consume(); - return create_ast_node<BinaryExpression>(BinaryOp::Slash, move(lhs), parse_expression(min_precedence, associativity)); + return create_ast_node<BinaryExpression>(BinaryOp::Division, move(lhs), parse_expression(min_precedence, associativity)); case TokenType::SlashEquals: consume(); return create_ast_node<AssignmentExpression>(AssignmentOp::DivisionAssignment, move(lhs), parse_expression(min_precedence, associativity)); |