LibJS: Include the operator in BinaryExpression dumps

This commit is contained in:
Andreas Kling 2020-03-07 23:16:34 +01:00
parent 1611071ac7
commit 0c7058aaa0
Notes: sideshowbarker 2024-07-19 08:51:02 +09:00

View file

@ -111,8 +111,21 @@ void ScopeNode::dump(int indent) const
void BinaryExpression::dump(int indent) const
{
ASTNode::dump(indent);
const char* op_string = nullptr;
switch (m_op) {
case BinaryOp::Plus:
op_string = "+";
break;
case BinaryOp::Minus:
op_string = "-";
break;
}
print_indent(indent);
printf("%s\n", class_name());
m_lhs->dump(indent + 1);
print_indent(indent + 1);
printf("%s\n", op_string);
m_rhs->dump(indent + 1);
}