From b1b202124c943b4eb1480f92b6c72b29a0c91a4d Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Wed, 14 Oct 2020 19:25:40 +0330 Subject: Shell: Use Node::kind() instead of Node::class_name() in formatter --- Shell/Formatter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Shell/Formatter.cpp b/Shell/Formatter.cpp index 314dbbb85e..4d5b732e1d 100644 --- a/Shell/Formatter.cpp +++ b/Shell/Formatter.cpp @@ -140,7 +140,7 @@ void Formatter::visit(const AST::And* node) { will_visit(node); test_and_update_output_cursor(node); - auto should_indent = m_parent_node && m_parent_node->class_name() != "And"; + auto should_indent = m_parent_node && m_parent_node->kind() != AST::Node::Kind::And; TemporaryChange parent { m_parent_node, node }; with_added_indent(should_indent ? 1 : 0, [&] { @@ -370,7 +370,7 @@ void Formatter::visit(const AST::IfCond* node) if (node->false_branch()) { current_builder().append(" else "); - if (node->false_branch()->class_name() != "IfCond") { + if (node->false_branch()->kind() != AST::Node::Kind::IfCond) { in_new_block([&] { node->false_branch()->visit(*this); }); @@ -446,7 +446,7 @@ void Formatter::visit(const AST::Or* node) { will_visit(node); test_and_update_output_cursor(node); - auto should_indent = m_parent_node && m_parent_node->class_name() != "Or"; + auto should_indent = m_parent_node && m_parent_node->kind() != AST::Node::Kind::Or; TemporaryChange parent { m_parent_node, node }; with_added_indent(should_indent ? 1 : 0, [&] { @@ -465,7 +465,7 @@ void Formatter::visit(const AST::Pipe* node) { will_visit(node); test_and_update_output_cursor(node); - auto should_indent = m_parent_node && m_parent_node->class_name() != "Pipe"; + auto should_indent = m_parent_node && m_parent_node->kind() != AST::Node::Kind::Pipe; TemporaryChange parent { m_parent_node, node }; node->left()->visit(*this); -- cgit v1.2.3