Example #1
0
File: vm.go Project: jerluc/rift
func doAssignment(rift *lang.Rift, env collections.PersistentMap, assignment *lang.Assignment) interface{} {
	// TODO: Should I use lazy assignment here?
	var name string
	if rift.Name() == "main" {
		name = assignment.Ref().String()
	} else {
		name = rift.Name() + ":" + assignment.Ref().String()
	}
	env.Set(name, evaluate(rift, env, assignment.Value()))
	return nil
}
Example #2
0
File: vm.go Project: jerluc/rift
func dereference(rift *lang.Rift, env collections.PersistentMap, ref *lang.Ref) interface{} {
	// TODO: Support gravity
	sanity.Ensure(env.Contains(ref.String()), "Undefined reference to [%s]", ref.String())
	return env.GetOrNil(ref.String())
}