refactor how repl works
This commit is contained in:
@@ -20,7 +20,7 @@ type SymbolTable struct {
|
||||
Outer *SymbolTable
|
||||
|
||||
Store map[string]Symbol
|
||||
numDefinitions int
|
||||
NumDefinitions int
|
||||
|
||||
FreeSymbols []Symbol
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func NewSymbolTable() *SymbolTable {
|
||||
}
|
||||
|
||||
func (s *SymbolTable) Define(name string) Symbol {
|
||||
symbol := Symbol{Name: name, Index: s.numDefinitions}
|
||||
symbol := Symbol{Name: name, Index: s.NumDefinitions}
|
||||
if s.Outer == nil {
|
||||
symbol.Scope = GlobalScope
|
||||
} else {
|
||||
@@ -46,7 +46,7 @@ func (s *SymbolTable) Define(name string) Symbol {
|
||||
}
|
||||
|
||||
s.Store[name] = symbol
|
||||
s.numDefinitions++
|
||||
s.NumDefinitions++
|
||||
return symbol
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user