AST supports function output default values

This commit is contained in:
Sasha Koshka 2022-09-01 17:13:40 -04:00
parent eed9e4e7b9
commit 7deacff330

View File

@ -186,7 +186,7 @@ type ObjtMember struct {
defaultValue Argument defaultValue Argument
} }
// ObjtSection represents an object type definition // ObjtSection represents an object type definition.
type ObjtSection struct { type ObjtSection struct {
location file.Location location file.Location
name string name string
@ -196,6 +196,7 @@ type ObjtSection struct {
members []ObjtMember members []ObjtMember
} }
// EnumMember represents a member of an enum section.
type EnumMember struct { type EnumMember struct {
location file.Location location file.Location
name string name string
@ -236,6 +237,13 @@ type FaceSection struct {
// of certain control flow statements. // of certain control flow statements.
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
defaultValue Argument
}
// FuncSection represents a function section. // FuncSection represents a function section.
type FuncSection struct { type FuncSection struct {
location file.Location location file.Location
@ -244,6 +252,6 @@ type FuncSection struct {
receiver *Declaration receiver *Declaration
inputs []Declaration inputs []Declaration
outputs []Declaration outputs []FuncOutput
root *Block root *Block
} }