Set phrase initialization values ToString correctly

This commit is contained in:
Sasha Koshka 2022-09-03 19:24:09 -04:00
parent bf2839508d
commit 16e06aacb8
1 changed files with 13 additions and 1 deletions

View File

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