From 19d0b3f45530f7689ae33d5587d5a25275992785 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Fri, 19 Aug 2022 02:36:56 -0400 Subject: [PATCH] Complex default values of type nodes now ToString properly --- parser/tree-tostring.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index ebdac69..4ce2df8 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -267,12 +267,19 @@ func (node TypeNode) ToString (indent int, isRoot bool) (output string) { output += node.name + ":" output += node.what.ToString() + isComplexInitialization := + node.defaultValue.kind == ArgumentKindObjectInitializationValues || + node.defaultValue.kind == ArgumentKindArrayInitializationValues + if node.defaultValue.value == nil { if len(node.children) > 0 { // TODO: print out members } else { output += "\n" } + } else if isComplexInitialization { + output += "\n" + output += node.defaultValue.ToString(indent + 1, true) } else { output += " " + node.defaultValue.ToString(0, false) output += "\n"