4.4.1 数据结构 - 作用域
type Scope struct {
parent *Scope // 当前作用域的父作用域
children []*Scope // 当前作用域的子作用域
elems map[string]Object // 当前作用域所包含的符号对象,key 是符号名称
pos, end syntax.Pos // 作用域位置信息
comment string // for debugging only
isFunc bool // set if this is a function scope (internal use only)
}func (s *Scope) Lookup(name string) Object { /* 忽略函数体 */ }
func (s *Scope) LookupParent(name string, pos syntax.Pos) (*Scope, Object) { /* 忽略函数体 */ }
func (s *Scope) Insert(obj Object) Object { /* 忽略函数体 */ }最后更新于