Esempio n. 1
0
func (l *Local) Eval(s *rt.Scope) rt.Value {
	oid, found, _ := s.Lookup(l.Value)
	if !found {
		switch l.Value {
		case "false":
			return rt.FALSE
		case "true":
			return rt.TRUE
		default:
			return rt.NIL
		}
	}

	obj := rt.RT.Heap.Lookup(oid)
	switch obj.(type) {
	case *rt.Object:
		obj.(*rt.Object).ID = oid
	}
	return obj
}
Esempio n. 2
0
func (a *Assign) Eval(s *rt.Scope) rt.Value {
	value := a.Expr.Visit(s)
	s.Insert(a.Target, value.OID())

	return value
}