From a5db93d2f8541024ae2027fe3551eec7b796bc79 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 19 Aug 2022 12:06:25 -0400 Subject: [PATCH] Use q.format for Formatter.format When you're formatting an individual node, it's useful to push it onto the parent stack to make sure every child node can format properly. --- lib/syntax_tree/formatter.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/syntax_tree/formatter.rb b/lib/syntax_tree/formatter.rb index 6efad8d8..c52e45ad 100644 --- a/lib/syntax_tree/formatter.rb +++ b/lib/syntax_tree/formatter.rb @@ -43,10 +43,10 @@ def initialize( end def self.format(source, node) - formatter = new(source, []) - node.format(formatter) - formatter.flush - formatter.output.join + q = new(source, []) + q.format(node) + q.flush + q.output.join end def format(node, stackable: true)