typed: factor typed-def? out of typed-def.

locals-and-roots
Doug Coleman 2016-05-12 16:33:19 -07:00
parent 3fa9ad91f6
commit d5b33de57c
1 changed files with 7 additions and 3 deletions

View File

@ -139,11 +139,15 @@ MACRO: typed ( quot word effect -- quot' )
[ drop [ swap "typed-word" set-word-prop ] [ [ 1quotation ] dip ] 2bi ] dip [ drop [ swap "typed-word" set-word-prop ] [ [ 1quotation ] dip ] 2bi ] dip
[ typed ] 3curry ; [ typed ] 3curry ;
: typed-def ( word def effect -- quot ) : typed-def? ( effect -- quot )
dup { {
[ effect-in-types typed-stack-effect? ] [ effect-in-types typed-stack-effect? ]
[ effect-out-types typed-stack-effect? ] [ effect-out-types typed-stack-effect? ]
} 1|| [ (typed-def) ] [ nip no-types-specified ] if ; } 1|| ;
: typed-def ( word def effect -- quot )
dup typed-def?
[ (typed-def) ] [ nip no-types-specified ] if ;
M: typed-word subwords M: typed-word subwords
[ call-next-method ] [ call-next-method ]