Only top level entities are in toplevel.go

This commit is contained in:
Sasha Koshka 2024-03-14 02:41:51 -04:00
parent fc2fb42e53
commit 0a56a61f4f
2 changed files with 25 additions and 26 deletions

View File

@ -6,6 +6,31 @@ import "unicode"
import "github.com/google/uuid"
import "git.tebibyte.media/fspl/fspl/errors"
// Access determines the external access control mode for a top-level entity.
type Access int; const (
// AccessPublic allows other modules to access an entity normally.
AccessPublic Access = iota
// AccessOpaque causes a top-level entity to appear opaque to other
// units. Values of opaque types can be passed around, assigned to each-
// other, and their methods can be called, but the implementation of the
// type is entirely hidden. This access mode cannot be applied to
// functions or methods.
AccessOpaque
// AccessPrivate disallows other modules from accessing a top-level
// entity.
AccessPrivate
)
func (this Access) String () string {
switch this {
case AccessPrivate: return "-"
case AccessOpaque: return "#"
case AccessPublic: return "+"
default: return fmt.Sprintf("entity.Access(%d)", this)
}
}
// Signature is a function or method signature that is used in functions,
// methods, and specifying interface behaviors. It defines the type of a
// function.

View File

@ -20,32 +20,6 @@ type TopLevel interface {
topLevel ()
}
// Access determines the external access control mode for a top-level entity.
type Access int; const (
// AccessPublic allows other modules to access an entity normally.
AccessPublic Access = iota
// AccessOpaque causes a top-level entity to appear opaque to other
// units. Values of opaque types can be passed around, assigned to each-
// other, and their methods can be called, but the implementation of the
// type is entirely hidden. This access mode cannot be applied to
// functions or methods.
AccessOpaque
// AccessPrivate disallows other modules from accessing a top-level
// entity.
AccessPrivate
)
func (this Access) String () string {
switch this {
case AccessPrivate: return "-"
case AccessOpaque: return "#"
case AccessPublic: return "+"
default: return fmt.Sprintf("entity.Access(%d)", this)
}
}
var _ TopLevel = &Typedef { }
// Typedef binds a type to a global identifier.
type Typedef struct {