示例#1
0
文件: vm.go 项目: 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
}
示例#2
0
文件: vm.go 项目: 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())
}