Fixed ToString of type nodes

This commit is contained in:
Sasha Koshka 2022-08-19 03:03:36 -04:00
parent 2296765e81
commit 9b4279c052

View File

@ -258,7 +258,7 @@ func (section *TypeSection) ToString (indent int) (output string) {
} }
func (node TypeNode) ToString (indent int, isRoot bool) (output string) { func (node TypeNode) ToString (indent int, isRoot bool) (output string) {
doIndent(indent) output += doIndent(indent)
if isRoot { if isRoot {
output += "type " output += "type "
} }
@ -272,10 +272,12 @@ func (node TypeNode) ToString (indent int, isRoot bool) (output string) {
node.defaultValue.kind == ArgumentKindArrayInitializationValues node.defaultValue.kind == ArgumentKindArrayInitializationValues
if node.defaultValue.value == nil { if node.defaultValue.value == nil {
output += "\n"
if len(node.children) > 0 { if len(node.children) > 0 {
// TODO: print out members for _, name := range sortMapKeysAlphabetically(node.children) {
} else { child := node.children[name]
output += "\n" output += child.ToString(indent + 1, false)
}
} }
} else if isComplexInitialization { } else if isComplexInitialization {
output += "\n" output += "\n"