@@ -120,10 +120,6 @@ static candidate_info** sort_candidates(PARROT_INTERP, PMC *candidates) {
120
120
num_candidates , candidate_graph_node * );
121
121
INTVAL insert_pos = 0 ;
122
122
123
- /* Ensure we know what is a 6model object and what is not. */
124
- if (!smo_id )
125
- smo_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "SixModelObject" , 0 ));
126
-
127
123
for (i = 0 ; i < num_candidates ; i ++ ) {
128
124
PMC * multi_sig_pmc , * types_list , * definedness_list ;
129
125
NQP_Signature * multi_sig ;
@@ -250,11 +246,24 @@ static candidate_info** sort_candidates(PARROT_INTERP, PMC *candidates) {
250
246
return result ;
251
247
}
252
248
249
+ /* Gets the list of possible candidates to dispatch too. */
250
+ static PMC * get_dispatchees (PARROT_INTERP , PMC * dispatcher ) {
251
+ if (!smo_id )
252
+ smo_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "SixModelObject" , 0 ));
253
+ if (dispatcher -> vtable -> base_type == smo_id ) {
254
+ NQP_Routine * r = (NQP_Routine * )PMC_data (dispatcher );
255
+ return r -> dispatchees ;
256
+ }
257
+ else {
258
+ return PARROT_DISPATCHERSUB (dispatcher )-> dispatchees ;
259
+ }
260
+ }
261
+
253
262
/* Performs a multiple dispatch using the candidates held in the passed
254
- * DispatcherSub and using the arguments in the passed capture. */
263
+ * dispatcher and using the arguments in the passed capture. */
255
264
PMC * nqp_multi_dispatch (PARROT_INTERP , PMC * dispatcher , PMC * capture ) {
256
265
/* Get list and number of dispatchees. */
257
- PMC * dispatchees = PARROT_DISPATCHERSUB ( dispatcher )-> dispatchees ;
266
+ PMC * dispatchees = get_dispatchees ( interp , dispatcher );
258
267
const INTVAL num_candidates = VTABLE_elements (interp , dispatchees );
259
268
260
269
/* Count arguments. */
0 commit comments