1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:57:35 +00:00

LibJS: Rename {Abstract,Typed => Loosely,Strictly}{Equals,Inequals}

This affects the AST's BinaryOp enum as well as the Bytecode's
ENUMERATE_BYTECODE_OPS and JS_ENUMERATE_COMMON_BINARY_OPS macros.
This commit is contained in:
Linus Groh 2021-09-24 00:06:10 +02:00
parent facbe32fcd
commit 32932f83be
6 changed files with 33 additions and 33 deletions

View file

@ -655,13 +655,13 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o
return mod(global_object, lhs_result, rhs_result); return mod(global_object, lhs_result, rhs_result);
case BinaryOp::Exponentiation: case BinaryOp::Exponentiation:
return exp(global_object, lhs_result, rhs_result); return exp(global_object, lhs_result, rhs_result);
case BinaryOp::TypedEquals: case BinaryOp::StrictlyEquals:
return Value(is_strictly_equal(lhs_result, rhs_result)); return Value(is_strictly_equal(lhs_result, rhs_result));
case BinaryOp::TypedInequals: case BinaryOp::StrictlyInequals:
return Value(!is_strictly_equal(lhs_result, rhs_result)); return Value(!is_strictly_equal(lhs_result, rhs_result));
case BinaryOp::AbstractEquals: case BinaryOp::LooselyEquals:
return Value(is_loosely_equal(global_object, lhs_result, rhs_result)); return Value(is_loosely_equal(global_object, lhs_result, rhs_result));
case BinaryOp::AbstractInequals: case BinaryOp::LooselyInequals:
return Value(!is_loosely_equal(global_object, lhs_result, rhs_result)); return Value(!is_loosely_equal(global_object, lhs_result, rhs_result));
case BinaryOp::GreaterThan: case BinaryOp::GreaterThan:
return greater_than(global_object, lhs_result, rhs_result); return greater_than(global_object, lhs_result, rhs_result);
@ -1053,16 +1053,16 @@ void BinaryExpression::dump(int indent) const
case BinaryOp::Exponentiation: case BinaryOp::Exponentiation:
op_string = "**"; op_string = "**";
break; break;
case BinaryOp::TypedEquals: case BinaryOp::StrictlyEquals:
op_string = "==="; op_string = "===";
break; break;
case BinaryOp::TypedInequals: case BinaryOp::StrictlyInequals:
op_string = "!=="; op_string = "!==";
break; break;
case BinaryOp::AbstractEquals: case BinaryOp::LooselyEquals:
op_string = "=="; op_string = "==";
break; break;
case BinaryOp::AbstractInequals: case BinaryOp::LooselyInequals:
op_string = "!="; op_string = "!=";
break; break;
case BinaryOp::GreaterThan: case BinaryOp::GreaterThan:

View file

@ -654,10 +654,10 @@ enum class BinaryOp {
Division, Division,
Modulo, Modulo,
Exponentiation, Exponentiation,
TypedEquals, StrictlyEquals,
TypedInequals, StrictlyInequals,
AbstractEquals, LooselyEquals,
AbstractInequals, LooselyInequals,
GreaterThan, GreaterThan,
GreaterThanEquals, GreaterThanEquals,
LessThan, LessThan,

View file

@ -121,17 +121,17 @@ void BinaryExpression::generate_bytecode(Bytecode::Generator& generator) const
case BinaryOp::LessThanEquals: case BinaryOp::LessThanEquals:
generator.emit<Bytecode::Op::LessThanEquals>(lhs_reg); generator.emit<Bytecode::Op::LessThanEquals>(lhs_reg);
break; break;
case BinaryOp::AbstractInequals: case BinaryOp::LooselyInequals:
generator.emit<Bytecode::Op::AbstractInequals>(lhs_reg); generator.emit<Bytecode::Op::LooselyInequals>(lhs_reg);
break; break;
case BinaryOp::AbstractEquals: case BinaryOp::LooselyEquals:
generator.emit<Bytecode::Op::AbstractEquals>(lhs_reg); generator.emit<Bytecode::Op::LooselyEquals>(lhs_reg);
break; break;
case BinaryOp::TypedInequals: case BinaryOp::StrictlyInequals:
generator.emit<Bytecode::Op::TypedInequals>(lhs_reg); generator.emit<Bytecode::Op::StrictlyInequals>(lhs_reg);
break; break;
case BinaryOp::TypedEquals: case BinaryOp::StrictlyEquals:
generator.emit<Bytecode::Op::TypedEquals>(lhs_reg); generator.emit<Bytecode::Op::StrictlyEquals>(lhs_reg);
break; break;
case BinaryOp::BitwiseAnd: case BinaryOp::BitwiseAnd:
generator.emit<Bytecode::Op::BitwiseAnd>(lhs_reg); generator.emit<Bytecode::Op::BitwiseAnd>(lhs_reg);
@ -1268,7 +1268,7 @@ void SwitchStatement::generate_bytecode(Bytecode::Generator& generator) const
if (switch_case.test()) { if (switch_case.test()) {
generator.switch_to_basic_block(*next_test_block); generator.switch_to_basic_block(*next_test_block);
switch_case.test()->generate_bytecode(generator); switch_case.test()->generate_bytecode(generator);
generator.emit<Bytecode::Op::TypedEquals>(discriminant_reg); generator.emit<Bytecode::Op::StrictlyEquals>(discriminant_reg);
next_test_block = &generator.make_block(); next_test_block = &generator.make_block();
generator.emit<Bytecode::Op::JumpConditional>().set_targets(Bytecode::Label { case_block }, Bytecode::Label { *next_test_block }); generator.emit<Bytecode::Op::JumpConditional>().set_targets(Bytecode::Label { case_block }, Bytecode::Label { *next_test_block });
} else { } else {

View file

@ -23,10 +23,10 @@
O(GreaterThanEquals) \ O(GreaterThanEquals) \
O(LessThan) \ O(LessThan) \
O(LessThanEquals) \ O(LessThanEquals) \
O(AbstractInequals) \ O(LooselyInequals) \
O(AbstractEquals) \ O(LooselyEquals) \
O(TypedInequals) \ O(StrictlyInequals) \
O(TypedEquals) \ O(StrictlyEquals) \
O(NewBigInt) \ O(NewBigInt) \
O(NewArray) \ O(NewArray) \
O(IteratorToArray) \ O(IteratorToArray) \

View file

@ -80,10 +80,10 @@ private:
O(GreaterThanEquals, greater_than_equals) \ O(GreaterThanEquals, greater_than_equals) \
O(LessThan, less_than) \ O(LessThan, less_than) \
O(LessThanEquals, less_than_equals) \ O(LessThanEquals, less_than_equals) \
O(AbstractInequals, abstract_inequals) \ O(LooselyInequals, abstract_inequals) \
O(AbstractEquals, abstract_equals) \ O(LooselyEquals, abstract_equals) \
O(TypedInequals, typed_inequals) \ O(StrictlyInequals, typed_inequals) \
O(TypedEquals, typed_equals) \ O(StrictlyEquals, typed_equals) \
O(BitwiseAnd, bitwise_and) \ O(BitwiseAnd, bitwise_and) \
O(BitwiseOr, bitwise_or) \ O(BitwiseOr, bitwise_or) \
O(BitwiseXor, bitwise_xor) \ O(BitwiseXor, bitwise_xor) \

View file

@ -1424,16 +1424,16 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::LessThanEquals, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::LessThanEquals, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::EqualsEqualsEquals: case TokenType::EqualsEqualsEquals:
consume(); consume();
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::TypedEquals, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::StrictlyEquals, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::ExclamationMarkEqualsEquals: case TokenType::ExclamationMarkEqualsEquals:
consume(); consume();
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::TypedInequals, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::StrictlyInequals, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::EqualsEquals: case TokenType::EqualsEquals:
consume(); consume();
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::AbstractEquals, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::LooselyEquals, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::ExclamationMarkEquals: case TokenType::ExclamationMarkEquals:
consume(); consume();
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::AbstractInequals, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::LooselyInequals, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::In: case TokenType::In:
consume(); consume();
return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::In, move(lhs), parse_expression(min_precedence, associativity)); return create_ast_node<BinaryExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, BinaryOp::In, move(lhs), parse_expression(min_precedence, associativity));