From 9b4279c052ea57c6c84de54929d7d81f2bfcd07e Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Fri, 19 Aug 2022 03:03:36 -0400 Subject: [PATCH] Fixed ToString of type nodes --- parser/tree-tostring.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index 4ce2df8..6dcb2ca 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -258,7 +258,7 @@ func (section *TypeSection) ToString (indent int) (output string) { } func (node TypeNode) ToString (indent int, isRoot bool) (output string) { - doIndent(indent) + output += doIndent(indent) if isRoot { output += "type " } @@ -272,10 +272,12 @@ func (node TypeNode) ToString (indent int, isRoot bool) (output string) { node.defaultValue.kind == ArgumentKindArrayInitializationValues if node.defaultValue.value == nil { + output += "\n" if len(node.children) > 0 { - // TODO: print out members - } else { - output += "\n" + for _, name := range sortMapKeysAlphabetically(node.children) { + child := node.children[name] + output += child.ToString(indent + 1, false) + } } } else if isComplexInitialization { output += "\n"