Skip to content

Commit

Permalink
Give NQP-based dispatcher support for 'is default'
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Mar 13, 2013
1 parent ab0d7bd commit c2fb4bc
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions src/Perl6/Metamodel/BOOTSTRAP.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1119,31 +1119,21 @@ BEGIN {
if nqp::elems(@possibles) > 1 { if nqp::elems(@possibles) > 1 {
# Locate any default candidates; if we find multiple defaults, this is # Locate any default candidates; if we find multiple defaults, this is
# no help, so we'll not bother collecting just which ones are good. # no help, so we'll not bother collecting just which ones are good.
nqp::die("default trait handling NYI"); my $default_cand;
#Rakudo_md_candidate_info *default_cand = NULL; for @possibles {
#INTVAL i; if nqp::can($_<sub>, 'default') && $_<sub>.default {
# if nqp::isconcrete($default_cand) {
#for (i = 0; i < possibles_count; i++) { $default_cand := Mu;
# PMC * const default_meth = VTABLE_find_method(interp, possibles[i]->sub, }
# Parrot_str_new(interp, "default", 0)); else {
# if (!PMC_IS_NULL(default_meth)) { $default_cand := $_;
# PMC *result = PMCNULL;; }
# Parrot_ext_call(interp, default_meth, "Pi->P", possibles[i]->sub, &result); }
# if (VTABLE_get_bool(interp, result)) { }
# if (default_cand == NULL) { if nqp::isconcrete($default_cand) {
# default_cand = possibles[i]; nqp::pop(@possibles) while @possibles;
# } @possibles[0] := $default_cand;
# else { }
# default_cand = NULL;
# break;
# }
# }
# }
#}
#if (default_cand) {
# possibles[0] = default_cand;
# possibles_count = 1;
#}
} }


# If we're at a single candidate here, and we also know there's no # If we're at a single candidate here, and we also know there's no
Expand Down

0 comments on commit c2fb4bc

Please sign in to comment.