Exemple #1
0
def chp_proc_cont(orig, proc, env, cont, _vals):
    vals = _vals._get_full_list()
    arg_count = len(orig)
    if len(vals) == arg_count:
        return proc.call(vals, env, cont)
    if len(vals) == arg_count + 1:
        args, check = values.Values.make(vals[1:]), vals[0]
        check.mark_non_loop()
        return check_chaperone_results_loop(args, orig, 0, env,
                call_cont(proc, env, call_cont(check, env, cont)))
    assert False
Exemple #2
0
    def call(self, args, env, cont):
        from pycket.interpreter import return_value

        if len(args) == 0:
            return self.parameter.call(args, env, call_cont(self.wrap, env, cont))
        elif len(args) == 1:
            if self.guard:
                return self.guard.call(args, env,
                        call_cont(self.parameter, env, cont))
            return self.parameter.call(args, env, cont)
        else:
            raise SchemeException("wrong number of arguments to parameter")
Exemple #3
0
    def call(self, args, env, cont):
        from pycket.interpreter import return_value

        if len(args) == 0:
            return self.parameter.call(args, env, call_cont(self.wrap, env, cont))
        elif len(args) == 1:
            if self.guard:
                return self.guard.call(args, env,
                        call_cont(self.parameter, env, cont))
            return self.parameter.call(args, env, cont)
        else:
            raise SchemeException("wrong number of arguments to parameter")
Exemple #4
0
def imp_proc_cont(arg_count, proc, env, cont, _vals):
    vals = _vals._get_full_list()
    if len(vals) == arg_count:
        return proc.call(vals, env, cont)
    if len(vals) == arg_count + 1:
        args, check = vals[1:], vals[0]
        check.mark_non_loop()
        return proc.call(args, env, call_cont(check, env, cont))
    assert False
Exemple #5
0
 def get_struct_info(self, env, cont):
     from pycket.interpreter import return_multi_vals
     if self.struct_info_handler is not None:
         cont = call_cont(self.struct_info_handler, env, cont)
     return self.inner.get_struct_info(env, cont)
Exemple #6
0
def cwicm(key, proc, default, env, cont):
    lup = cont.find_cm(key)
    val = default if lup is None else lup
    if isinstance(key, values.W_ContinuationMarkKey):
        return key.get_cmk(val, env, call_cont(proc, env, cont))
    return proc.call([val], env, cont)
Exemple #7
0
def call_with_values (producer, consumer, env, cont):
    # FIXME: check arity
    return producer.call([], env, call_cont(consumer, env, cont))
Exemple #8
0
def call_with_values (producer, consumer, env, cont, extra_call_info):
    # FIXME: check arity
    return producer.call_with_extra_info([], env, call_cont(consumer, env, cont), extra_call_info)
Exemple #9
0
 def get_struct_info(self, env, cont):
     from pycket.interpreter import return_multi_vals
     if self.struct_info_handler is not None:
         cont = call_cont(self.struct_info_handler, env, cont)
     return self.inner.get_struct_info(env, cont)
Exemple #10
0
 def get_struct_info(self, env, cont):
     handler = self.handler_map.lookup(INFO_HANDLER_IDX, self.handlers)
     if handler is not None:
         cont = call_cont(handler, env, cont)
     return self.inner.get_struct_info(env, cont)
Exemple #11
0
def call_with_values (producer, consumer, env, cont, extra_call_info):
    # FIXME: check arity
    return producer.call_with_extra_info([], env, call_cont(consumer, env, cont), extra_call_info)
Exemple #12
0
 def get_struct_info(self, env, cont):
     handler = self.map.lookup_handler(INFO_HANDLER_IDX, self)
     if handler is not None:
         cont = call_cont(handler, env, cont)
     return self.inner.get_struct_info(env, cont)