tree-tostring is free of compiler errors
This commit is contained in:
parent
cd9de16338
commit
26f887dfcc
@ -66,66 +66,12 @@ func (identifier Identifier) ToString () (output string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (values ObjectDefaultValues) ToString (
|
|
||||||
indent int,
|
|
||||||
breakLine bool,
|
|
||||||
) (
|
|
||||||
output string,
|
|
||||||
) {
|
|
||||||
if !breakLine { indent = 0 }
|
|
||||||
output += doIndent(indent, "(")
|
|
||||||
if breakLine { output += "\n" }
|
|
||||||
|
|
||||||
for index, name := range sortMapKeysAlphabetically(values) {
|
|
||||||
if index > 0 && !breakLine { output += " " }
|
|
||||||
|
|
||||||
value := values[name]
|
|
||||||
|
|
||||||
output += doIndent(indent, "." + name + ":")
|
|
||||||
|
|
||||||
isComplexDefaultValue :=
|
|
||||||
value.kind == ArgumentKindObjectDefaultValues ||
|
|
||||||
value.kind == ArgumentKindArrayDefaultValues
|
|
||||||
|
|
||||||
if isComplexDefaultValue {
|
|
||||||
if breakLine { output += "\n" }
|
|
||||||
output += value.ToString(indent + 1, breakLine)
|
|
||||||
} else {
|
|
||||||
output += "<"
|
|
||||||
output += value.ToString(indent + 1, false)
|
|
||||||
output += ">"
|
|
||||||
}
|
|
||||||
if breakLine { output += "\n" }
|
|
||||||
}
|
|
||||||
output += doIndent(indent, ")")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (values ArrayDefaultValues) ToString (
|
|
||||||
indent int,
|
|
||||||
breakLine bool,
|
|
||||||
) (
|
|
||||||
output string,
|
|
||||||
) {
|
|
||||||
if !breakLine { indent = 0 }
|
|
||||||
output += doIndent(indent, "<")
|
|
||||||
if breakLine { output += "\n" }
|
|
||||||
|
|
||||||
for index, value := range values {
|
|
||||||
if index > 0 && !breakLine { output += " " }
|
|
||||||
output += value.ToString(indent, breakLine)
|
|
||||||
}
|
|
||||||
|
|
||||||
output += doIndent(indent, ">")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (member TypeMember) ToString (indent int, breakLine bool) (output string) {
|
func (member TypeMember) ToString (indent int, breakLine bool) (output string) {
|
||||||
output += doIndent(indent, ".")
|
output += doIndent(indent, ".")
|
||||||
|
|
||||||
output += member.permission.ToString() + " "
|
output += member.permission.ToString() + " "
|
||||||
output += member.name + ":"
|
output += member.name + ":"
|
||||||
output += member.what.ToString(indent + 1, breakLine)
|
output += member.what.ToString()
|
||||||
|
|
||||||
if member.bitWidth > 0 {
|
if member.bitWidth > 0 {
|
||||||
output += fmt.Sprint(" & ", member.bitWidth)
|
output += fmt.Sprint(" & ", member.bitWidth)
|
||||||