+redef class PSignature
+ meth compile_parameters(v: CompilerVisitor, orig_sig: MMSignature, params: Array[String]) is abstract
+end
+
+redef class ASignature
+ redef meth compile_parameters(v: CompilerVisitor, orig_sig: MMSignature, params: Array[String])
+ do
+ for ap in n_params do
+ var cname = v.cfc.register_variable(ap.variable)
+ v.nmc.method_params.add(ap.variable)
+ var orig_type = orig_sig[ap.position]
+ if not orig_type < ap.variable.stype then
+ # FIXME: do not test always
+ # FIXME: handle formal types
+ v.add_instr("/* check if p<{ap.variable.stype} with p:{orig_type} */")
+ ap.variable.stype.compile_type_check(v, params[ap.position], ap)
+ end
+ v.add_assignment(cname, params[ap.position])
+ end
+ for i in [0..n_closure_decls.length[ do
+ var wd = n_closure_decls[i]
+ var cname = v.cfc.register_closurevariable(wd.variable)
+ wd.variable.ctypename = "struct {v.nmc.method.closure_cname(i)} *"
+ v.add_assignment(cname, "{params[orig_sig.arity + i]}")
+ end
+ end
+end
+