Skip to content

Commit a5db93d

Browse files
committed
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.
1 parent a12fc3f commit a5db93d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/syntax_tree/formatter.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ def initialize(
4343
end
4444

4545
def self.format(source, node)
46-
formatter = new(source, [])
47-
node.format(formatter)
48-
formatter.flush
49-
formatter.output.join
46+
q = new(source, [])
47+
q.format(node)
48+
q.flush
49+
q.output.join
5050
end
5151

5252
def format(node, stackable: true)

0 commit comments

Comments
 (0)