Fixed ToString of type nodes

This commit is contained in:
Sasha Koshka 2022-08-19 03:03:36 -04:00
parent 2296765e81
commit 9b4279c052
1 changed files with 6 additions and 4 deletions

View File

@ -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"