Walker: step directly into the effective method
parent
d2fc408c1b
commit
e006aca541
|
@ -29,6 +29,8 @@ PREDICATE: method-spec < pair
|
|||
: order ( generic -- seq )
|
||||
"methods" word-prop keys sort-classes ;
|
||||
|
||||
GENERIC: effective-method ( ... generic -- method )
|
||||
|
||||
: next-method-class ( class generic -- class/f )
|
||||
order [ class< ] with subset reverse dup length 1 =
|
||||
[ drop f ] [ second ] if ;
|
||||
|
|
|
@ -118,6 +118,10 @@ M: standard-combination perform-combination
|
|||
|
||||
M: standard-combination dispatch# #>> ;
|
||||
|
||||
M: standard-generic effective-method
|
||||
[ dispatch# (picker) call ] keep
|
||||
[ order [ instance? ] with find-last nip ] keep method ;
|
||||
|
||||
ERROR: inconsistent-next-method object class generic ;
|
||||
|
||||
ERROR: no-next-method class generic ;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
USING: threads kernel namespaces continuations combinators
|
||||
sequences math namespaces.private continuations.private
|
||||
concurrency.messaging quotations kernel.private words
|
||||
sequences.private assocs models arrays accessors ;
|
||||
sequences.private assocs models arrays accessors
|
||||
generic generic.standard ;
|
||||
IN: tools.walker
|
||||
|
||||
SYMBOL: show-walker-hook ! ( status continuation thread -- )
|
||||
|
@ -68,15 +69,12 @@ M: object add-breakpoint ;
|
|||
: (step-into-dispatch) nth (step-into-quot) ;
|
||||
|
||||
: (step-into-execute) ( word -- )
|
||||
dup "step-into" word-prop [
|
||||
call
|
||||
] [
|
||||
dup primitive? [
|
||||
execute break
|
||||
] [
|
||||
word-def (step-into-quot)
|
||||
] if
|
||||
] ?if ;
|
||||
{
|
||||
{ [ dup "step-into" word-prop ] [ "step-into" word-prop call ] }
|
||||
{ [ dup standard-generic? ] [ effective-method (step-into-execute) ] }
|
||||
{ [ dup primitive? ] [ execute break ] }
|
||||
{ [ t ] [ word-def (step-into-quot) ] }
|
||||
} cond ;
|
||||
|
||||
\ (step-into-execute) t "step-into?" set-word-prop
|
||||
|
||||
|
|
Loading…
Reference in New Issue