tools.trace: we can surely hardcode the excluded vocab list

modern-harvey2
Björn Lindqvist 2017-06-24 00:14:52 +02:00
parent c53895e03d
commit 3f818637cd
2 changed files with 17 additions and 30 deletions

View File

@ -1,6 +1,6 @@
IN: tools.trace.tests
USING: tools.trace tools.test tools.continuations kernel math combinators
sequences ;
USING: combinators kernel math sequences tools.continuations
tools.test tools.trace tools.trace.private ;
{ { 3 2 1 } } [ { 1 2 3 } [ reverse ] trace ] unit-test
@ -22,9 +22,15 @@ M: method-breakpoint-tuple method-breakpoint-test break drop 1 2 + ;
{ 6 } [ [ case-breakpoint-test ] trace ] unit-test
: call(-breakpoint-test ( -- x )
: call-op-para-breakpoint-test ( -- x )
[ break 1 ] call( -- x ) 2 + ;
\ call(-breakpoint-test don't-step-into
\ call-op-para-breakpoint-test don't-step-into
{ 3 } [ [ call(-breakpoint-test ] trace ] unit-test
{ 3 } [ [ call-op-para-breakpoint-test ] trace ] unit-test
{ f t t } [
\ + into?
\ dip into?
\ sq into?
] unit-test

View File

@ -1,17 +1,11 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: concurrency.promises models tools.continuations kernel
sequences concurrency.messaging locals continuations threads
namespaces namespaces.private make assocs accessors io strings
prettyprint math math.parser words effects summary io.styles classes
generic.math combinators.short-circuit kernel.private quotations ;
USING: accessors classes combinators.short-circuit effects
generic.math io io.styles kernel kernel.private make math.parser
namespaces prettyprint quotations sequences strings summary
tools.continuations words ;
IN: tools.trace
SYMBOL: exclude-vocabs
SYMBOL: include-vocabs
exclude-vocabs { "math" "accessors" } swap set-global
<PRIVATE
: callstack-depth ( callstack -- n )
@ -19,27 +13,14 @@ exclude-vocabs { "math" "accessors" } swap set-global
SYMBOL: end
: include? ( vocab -- ? )
include-vocabs get [ member? ] [ drop t ] if* ;
: exclude? ( vocab -- ? )
exclude-vocabs get [ member? ] [ drop f ] if* ;
: into? ( obj -- ? )
{
[ word? ]
[ predicate? not ]
[ math-generic? not ]
[
{
[ inline? ]
[
{
[ vocabulary>> include? ]
[ vocabulary>> exclude? not ]
} 1&&
]
} 1||
[ inline? ]
[ vocabulary>> { "math" "accessors" } member? not ] bi or
]
} 1&& ;