diff --git a/lib/syntax_tree.rb b/lib/syntax_tree.rb index 6bcf710f..4d76ccac 100644 --- a/lib/syntax_tree.rb +++ b/lib/syntax_tree.rb @@ -3698,7 +3698,11 @@ def initialize(constant:, superclass:, bodystmt:, location:, comments: []) end def child_nodes - [constant, superclass, bodystmt] + [].tap do |nodes| + nodes << constant + nodes << superclass if superclass + nodes << bodystmt + end end def format(q)