From 20bd5570465c73b89458de58c9fb8cd4e5919b44 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 26 Jul 2022 03:54:06 +0200 Subject: Compile function environments --- pkg/lang/compiler/scope/scopes.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkg/lang/compiler/scope/scopes.go') diff --git a/pkg/lang/compiler/scope/scopes.go b/pkg/lang/compiler/scope/scopes.go index e34b45a..7a1b20c 100644 --- a/pkg/lang/compiler/scope/scopes.go +++ b/pkg/lang/compiler/scope/scopes.go @@ -26,6 +26,8 @@ type FunctionScope struct { id ScopeID unit code.Marker subUnitCount int + + outsideSymbolsInEnv []SymbolID } func NewFunctionScope(id ScopeID, unit code.Marker) FunctionScope { @@ -33,6 +35,8 @@ func NewFunctionScope(id ScopeID, unit code.Marker) FunctionScope { id: id, unit: unit, subUnitCount: 0, + + outsideSymbolsInEnv: make([]SymbolID, 0), } } @@ -44,6 +48,10 @@ func (sf FunctionScope) Unit() code.Marker { return sf.unit } +func (sf FunctionScope) OutsideSymbolsInEnv() []SymbolID { + return sf.outsideSymbolsInEnv +} + func (sf FunctionScope) IsRootScope() bool { return sf.ID() == ScopeID(0) } -- cgit 1.4.1