diff options
Diffstat (limited to 'pkg/lang/compiler/scope/symbol.go')
| -rw-r--r-- | pkg/lang/compiler/scope/symbol.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pkg/lang/compiler/scope/symbol.go b/pkg/lang/compiler/scope/symbol.go index b87d5aa..8bfe60a 100644 --- a/pkg/lang/compiler/scope/symbol.go +++ b/pkg/lang/compiler/scope/symbol.go @@ -26,6 +26,8 @@ const ( // An env symbol is bound to a local on the stack, outside of the function's scope. // Emitted at lookup time, so the SymbolScope has no array for them. SymbolKindEnv SymbolKind = iota + // A global symbol is bound to a global from a dependency. + SymbolKindGlobal SymbolKind = iota ) func (s SymbolKind) String() string { @@ -34,6 +36,8 @@ func (s SymbolKind) String() string { return "variable" case SymbolKindEnv: return "env" + case SymbolKindGlobal: + return "global" default: panic("unknown symbol kind") } @@ -49,7 +53,7 @@ func (s Symbol[D]) Data() D { } type SymbolData interface { - SymbolVariable | SymbolEnv + SymbolVariable | SymbolEnv | SymbolGlobal } type SymbolVariable struct { @@ -67,3 +71,11 @@ type SymbolEnv struct { func (se SymbolEnv) IndexInEnv() int { return se.indexInEnv } + +type SymbolGlobal struct { + id string +} + +func (sg SymbolGlobal) ID() string { + return sg.id +} \ No newline at end of file |
