Beispiel #1
0
 def constr_proc_wrapper_cont(self, field_values, struct_type_name, issuper,
     app, env, cont, _vals):
     from pycket.interpreter import return_multi_vals, jump
     guard_values = _vals.get_all_values()
     type = jit.promote(self.type)
     if guard_values:
         field_values = guard_values
     super_type = jit.promote(type.super)
     if isinstance(super_type, W_StructType):
         split_position = len(field_values) - type.init_field_cnt
         super_auto = super_type.constr.type.auto_values
         assert split_position >= 0
         field_values = self._splice(field_values, len(field_values),\
             split_position, super_auto, len(super_auto))
         if issuper:
             return super_type.constr.code(field_values[:split_position],
                 struct_type_name, True, env, cont, app)
         else:
             return super_type.constr.code(field_values[:split_position],
                 struct_type_name, True,
                 env, self.constr_proc_cont(field_values, env, cont), app)
     else:
         if issuper:
             return return_multi_vals(values.Values.make(field_values), env, cont)
         else:
             return jump(env, self.constr_proc_cont(field_values, env, cont))
Beispiel #2
0
 def code(self, field_values, issuper, env, cont):
     from pycket.interpreter import jump
     if self.type.guard is values.w_false:
         return jump(env, self.constr_proc_wrapper_cont(field_values, issuper, env, cont))
     else:
         guard_args = field_values + [values.W_Symbol.make(self.type.name)]
         jit.promote(self)
         return self.type.guard.call(guard_args, env,
             self.constr_proc_wrapper_cont(field_values, issuper, env, cont))
Beispiel #3
0
 def code(self, field_values, struct_type_name, issuper, env, cont, app):
     from pycket.interpreter import jump
     type = jit.promote(self.type)
     if type.guard is values.w_false:
         return jump(env, self.constr_proc_wrapper_cont(field_values,
             struct_type_name, issuper, app, env, cont))
     else:
         guard_args = field_values + [values.W_Symbol.make(struct_type_name)]
         jit.promote(self)
         return type.guard.call_with_extra_info(guard_args, env,
             self.constr_proc_wrapper_cont(field_values, struct_type_name,
                 issuper, app, env, cont), app)