Added permissions to analyzed sections

This commit is contained in:
Sasha Koshka 2022-10-01 17:21:17 -04:00
parent 07540e0abc
commit e2947eab8c
4 changed files with 20 additions and 5 deletions

View File

@ -187,7 +187,7 @@ func (analyzer *AnalysisOperation) resolvePrimitive (
case "U16": section = &PrimitiveU16
case "U32": section = &PrimitiveU32
case "U64": section = &PrimitiveU64
case "Objt": section = &PrimitiveObjt
case "Obj": section = &PrimitiveObj
case "Face": section = &PrimitiveFace
case "Func": section = &PrimitiveFunc
case "String": section = &BuiltInString

View File

@ -12,7 +12,7 @@ var PrimitiveU8 = createPrimitive("U8", Type {})
var PrimitiveU16 = createPrimitive("U16", Type {})
var PrimitiveU32 = createPrimitive("U32", Type {})
var PrimitiveU64 = createPrimitive("U64", Type {})
var PrimitiveObjt = createPrimitive("Objt", Type {})
var PrimitiveObj = createPrimitive("Obj", Type {})
var PrimitiveFace = createPrimitive("Face", Type {})
var PrimitiveFunc = createPrimitive("Func", Type {})

View File

@ -3,6 +3,7 @@ package analyzer
import "os"
import "sort"
import "path/filepath"
import "git.tebibyte.media/arf/arf/types"
// locator uniquely identifies a section in the section table.
type locator struct {
@ -77,6 +78,7 @@ type Section interface {
Complete () (complete bool)
ModulePath () (path string)
ModuleName () (path string)
Permission () (permission types.Permission)
locator () (where locator)
// Must be implemented by each individual section
@ -87,6 +89,7 @@ type Section interface {
type sectionBase struct {
where locator
complete bool
permission types.Permission
}
// Name returns the name of the section.
@ -113,6 +116,13 @@ func (section sectionBase) Complete () (complete bool) {
return
}
// Permission returns the permission of the section.
func (section sectionBase) Permission () (permission types.Permission) {
permission = section.permission
return
}
// locator returns the module path and name of the section.
func (section sectionBase) locator () (where locator) {
where = section.where
return

View File

@ -41,7 +41,10 @@ func (member ObjectMember) ToString (indent int) (output string) {
// ToString returns all data stored within the type section, in string form.
func (section TypeSection) ToString (indent int) (output string) {
output += doIndent(indent, "typeSection ", section.where.ToString(), "\n")
output += doIndent(indent, "typeSection ")
output += section.permission.ToString() + " "
output += section.where.ToString()
output += "\n"
output += section.what.ToString(indent + 1)
if section.argument != nil {
output += section.argument.ToString(indent + 1)
@ -68,6 +71,8 @@ func (analyzer AnalysisOperation) analyzeTypeSection () (
infoerr.ErrorKindError)
}
outputSection.permission = inputSection.Permission()
outputSection.what, err = analyzer.analyzeType(inputSection.Type())
if err != nil { return }