Stub for analyzing type specifiers

This commit is contained in:
Sasha Koshka 2022-09-20 11:01:56 -04:00
parent 92ac258dbe
commit b3ebd7a259
2 changed files with 18 additions and 4 deletions

View File

@ -40,6 +40,7 @@ func (analyzer AnalysisOperation) analyzeTypeSection () (
outputSection.where = analyzer.currentPosition outputSection.where = analyzer.currentPosition
outputSection.what, err = analyzer.analyzeType(inputSection.Type()) outputSection.what, err = analyzer.analyzeType(inputSection.Type())
if err != nil { return }
outputSection.complete = true outputSection.complete = true
return return

View File

@ -1,6 +1,7 @@
package analyzer package analyzer
import "git.tebibyte.media/arf/arf/types" import "git.tebibyte.media/arf/arf/types"
import "git.tebibyte.media/arf/arf/parser"
// TypeKind represents what kind of type a type is. // TypeKind represents what kind of type a type is.
type TypeKind int type TypeKind int
@ -27,9 +28,8 @@ type ObjectMember struct {
// need to include it in the semantic analysis because we need to know // need to include it in the semantic analysis because we need to know
// how many members objects have. // how many members objects have.
permission types.Permission permission types.Permission
// TODO: create argument type similar to what's in the parser and have what Type
// a defaultValue member here.
} }
func (member ObjectMember) ToString (indent int) (output string) { func (member ObjectMember) ToString (indent int) (output string) {
@ -37,8 +37,8 @@ func (member ObjectMember) ToString (indent int) (output string) {
indent, indent,
member.name, " ", member.name, " ",
member.permission.ToString(), member.permission.ToString(),
// TODO: default value
"\n") "\n")
output += member.what.ToString(indent + 1)
return return
} }
@ -96,3 +96,16 @@ func (what Type) ToString (indent int) (output string) {
} }
return return
} }
// analyzeType analyzes a type specifier.
func (analyzer AnalysisOperation) analyzeType (
inputType parser.Type,
) (
outputType Type,
err error,
) {
// TODO
outputType.mutable = inputType.Mutable()
return
}