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 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. // Root returns the root block of the section.
func (section FuncSection) Root () (root Block) { func (section FuncSection) Root () (root Block) {
root = section.root root = section.root

View File

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

View File

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

View File

@ -260,12 +260,6 @@ type Phrase struct {
// Block represents a scoped/indented block of code. // Block represents a scoped/indented block of code.
type Block []Phrase 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. // FuncSection represents a function section.
type FuncSection struct { type FuncSection struct {
locatable locatable
@ -274,7 +268,7 @@ type FuncSection struct {
receiver *Declaration receiver *Declaration
inputs []Declaration inputs []Declaration
outputs []FuncOutput outputs []Declaration
root Block root Block
external bool external bool