SectionKind has been retired

This commit is contained in:
Sasha Koshka 2022-09-21 21:25:48 -04:00
parent b3ebd7a259
commit 6040980003
6 changed files with 7 additions and 68 deletions

View File

@ -101,14 +101,14 @@ func (analyzer *AnalysisOperation) fetchSection (
// table as soon as the vital details are acquired, and mark it as // table as soon as the vital details are acquired, and mark it as
// incomplete. that way, it can still be referenced by itself in certain // incomplete. that way, it can still be referenced by itself in certain
// scenarios. // scenarios.
switch parsedSection.Kind() { switch parsedSection.(type) {
case parser.SectionKindType: case parser.TypeSection:
section, err = analyzer.analyzeTypeSection() section, err = analyzer.analyzeTypeSection()
if err != nil { return} if err != nil { return}
case parser.SectionKindEnum: case parser.EnumSection:
case parser.SectionKindFace: case parser.FaceSection:
case parser.SectionKindData: case parser.DataSection:
case parser.SectionKindFunc: case parser.FuncSection:
} }
return return

View File

@ -24,6 +24,6 @@ var BuiltInString = createPrimitive("String", Type {
// list. // list.
func createPrimitive (name string, inherits Type) (primitive TypeSection) { func createPrimitive (name string, inherits Type) (primitive TypeSection) {
primitive.where = locator { name: name } primitive.where = locator { name: name }
primitive.inherits = inherits primitive.what = inherits
return return
} }

View File

@ -26,18 +26,6 @@ func (table SectionTable) ToString (indent int) (output string) {
return return
} }
// SectionKind differentiates Section interfaces.
type SectionKind int
const (
SectionKindType SectionKind = iota
SectionKindObjt
SectionKindEnum
SectionKindFace
SectionKindData
SectionKindFunc
)
// Section is a semantically analyzed section. // Section is a semantically analyzed section.
type Section interface { type Section interface {
// Provided by sectionBase // Provided by sectionBase
@ -47,7 +35,6 @@ type Section interface {
ModuleName () (path string) ModuleName () (path string)
// Must be implemented by each individual section // Must be implemented by each individual section
Kind () (kind SectionKind)
ToString (indent int) (output string) ToString (indent int) (output string)
} }

View File

@ -11,12 +11,6 @@ type TypeSection struct {
complete bool complete bool
} }
// Kind returns SectionKindType.
func (section TypeSection) Kind () (kind SectionKind) {
kind = SectionKindType
return
}
// ToString returns all data stored within the type section, in string form. // ToString returns all data stored within the type section, in string form.
func (section TypeSection) ToString (indent int) (output string) { func (section TypeSection) ToString (indent int) (output string) {
output += doIndent(indent, "typeSection ", section.where.ToString(), "\n") output += doIndent(indent, "typeSection ", section.where.ToString(), "\n")

View File

@ -23,36 +23,6 @@ func (tree SyntaxTree) ResolveRequire (name string) (path string, exists bool) {
return return
} }
// Kind returns the section's kind (SectionKindType).
func (section TypeSection) Kind () (kind SectionKind) {
kind = SectionKindType
return
}
// Kind returns the section's kind (SectionKindEnum).
func (section EnumSection) Kind () (kind SectionKind) {
kind = SectionKindEnum
return
}
// Kind returns the section's kind (SectionKindFace).
func (section FaceSection) Kind () (kind SectionKind) {
kind = SectionKindFace
return
}
// Kind returns the section's kind (SectionKindData).
func (section DataSection) Kind () (kind SectionKind) {
kind = SectionKindData
return
}
// Kind returns the section's kind (SectionKindFunc).
func (section FuncSection) Kind () (kind SectionKind) {
kind = SectionKindFunc
return
}
// Length returns the amount of names in the identifier. // Length returns the amount of names in the identifier.
func (identifier Identifier) Length () (length int) { func (identifier Identifier) Length () (length int) {
length = len(identifier.trail) length = len(identifier.trail)

View File

@ -15,22 +15,10 @@ type SyntaxTree struct {
sections map[string] Section sections map[string] Section
} }
// SectionKind differentiates Section interfaces.
type SectionKind int
const (
SectionKindType = iota
SectionKindEnum
SectionKindFace
SectionKindData
SectionKindFunc
)
// Section can be any kind of section. You can find out what type of section it // Section can be any kind of section. You can find out what type of section it
// is with the Kind method. // is with the Kind method.
type Section interface { type Section interface {
Location () (location file.Location) Location () (location file.Location)
Kind () (kind SectionKind)
Permission () (permission types.Permission) Permission () (permission types.Permission)
Name () (name string) Name () (name string)
NewError (message string, kind infoerr.ErrorKind) (err error) NewError (message string, kind infoerr.ErrorKind) (err error)