Removed FuncOutput from the tree

This commit is contained in:
Sasha Koshka 2022-09-17 12:12:04 -04:00
parent a492622e30
commit 49eb7f9b9d
4 changed files with 5 additions and 22 deletions

View File

@ -247,12 +247,6 @@ func (section FuncSection) OutputsLength () (length int) {
return
}
// Output returns the output at index.
func (section FuncSection) Output (index int) (output FuncOutput) {
output = section.outputs[index]
return
}
// Root returns the root block of the section.
func (section FuncSection) Root () (root Block) {
root = section.root

View File

@ -171,7 +171,7 @@ func (parser *ParsingOperation) parseFuncArguments (
if err != nil { return }
case lexer.TokenKindLessThan:
output := FuncOutput { }
output := Declaration { }
output.location = parser.token.Location()
// get name
@ -186,6 +186,8 @@ func (parser *ParsingOperation) parseFuncArguments (
if err != nil { return }
output.what, err = parser.parseType()
if err != nil { return }
into.outputs = append(into.outputs, output)
parser.expect(lexer.TokenKindNewline)
if err != nil { return }

View File

@ -438,13 +438,6 @@ func (block Block) ToString (indent int) (output string) {
return
}
func (funcOutput FuncOutput) ToString (indent int) (output string) {
output += doIndent (
indent + 1,
"< ", funcOutput.Declaration.ToString(indent), "\n")
return
}
func (section FuncSection) ToString (indent int) (output string) {
output += doIndent (
indent,
@ -463,7 +456,7 @@ func (section FuncSection) ToString (indent int) (output string) {
}
for _, outputItem := range section.outputs {
output += outputItem.ToString(indent + 1)
output += doIndent(indent + 1, "< ", outputItem.ToString(indent), "\n")
}
output += doIndent(indent + 1, "---\n")

View File

@ -260,12 +260,6 @@ type Phrase struct {
// Block represents a scoped/indented block of code.
type Block []Phrase
// FuncOutput represents an input a function section. It is unlike an input in
// that it can have a default value.
type FuncOutput struct {
Declaration
}
// FuncSection represents a function section.
type FuncSection struct {
locatable
@ -274,7 +268,7 @@ type FuncSection struct {
receiver *Declaration
inputs []Declaration
outputs []FuncOutput
outputs []Declaration
root Block
external bool