func (interp *Interpreter) lookupName(name token.Token, expr ast.Expr) (interface{}, error) {
	distance, ok := interp.Locals[expr]
	if !ok {
		return interp.globals.Get(name)
	}
	return interp.env.GetAt(name, distance)
}
// lookupName looks for the exact value that the expr is pointing at
// via the pre-populated Locals code
// This assumes that the resolver has already ran and populated the Locals
// map.
// NOTE: As noted in the book https://craftinginterpreters.com/resolving-and-binding.html#assigning-to-a-resolved-variable
// This resolver is tightly coupled to the interpreter
lookupName looks for the exact value that the expr is pointing at
via the pre-populated Locals code
This assumes that the resolver has already ran and populated the Locals
map.
// lookupName looks for the exact value that the expr is pointing at // via the pre - populated Locals code // This assumes that the resolver has already ran and populated the Locals // map . // NOTE : As noted in the book https : // craftinginterpreters . com / resolving - and - binding . html#assigning - to - a - resolved - variable // This resolver is tightly coupled to the interpreter
func (interp *Interpreter) lookupName(name token.Token, expr ast.Expr) (interface{}, error) {
	distance, ok := interp.Locals[expr]
	if !ok {
		return interp.globals.Get(name)
	}
	return interp.env.GetAt(name, distance)
}
func ( interp * Interpreter ) lookupName ( name token . Token , expr ast . Expr ) ( interface { } , error ) { distance , ok := interp . Locals [ expr ] if ! ok { return interp . globals . Get ( name ) } return interp . env . GetAt ( name , distance ) }
lookupName looks for the exact value that the expr is pointing at
via the pre-populated Locals code
This assumes that the resolver has already ran and populated the Locals
map.
lookupName looks for the exact value that the expr is pointing at via the pre - populated Locals code This assumes that the resolver has already ran and populated the Locals map .