diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index a4443d9..f25b619 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -428,10 +428,19 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) { if ownLine { output += doIndent(indent) } + + var initializationValues Argument output += "[" + phrase.command.ToString(0, false) for _, argument := range phrase.arguments { - output += " " + argument.ToString(0, false) + isInitializationValue := + argument.kind == ArgumentKindObjectInitializationValues || + argument.kind == ArgumentKindArrayInitializationValues + if isInitializationValue { + initializationValues = argument + } else { + output += " " + argument.ToString(0, false) + } } output += "]" @@ -444,6 +453,9 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) { if ownLine { output += "\n" + if initializationValues.kind != ArgumentKindNil { + output += initializationValues.ToString(indent + 1, true) + } output += phrase.block.ToString(indent + 1) } return