words.alias: make aliases to parsing words also parsing words.
parent
db81422ff4
commit
15c4927c5f
|
@ -1,6 +1,11 @@
|
|||
USING: math eval tools.test effects ;
|
||||
USING: math eval lexer tools.test effects sequences ;
|
||||
IN: words.alias.tests
|
||||
|
||||
ALIAS: foo +
|
||||
[ ] [ "IN: words.alias.tests CONSTANT: foo 5" eval( -- ) ] unit-test
|
||||
[ ( -- value ) ] [ \ foo stack-effect ] unit-test
|
||||
|
||||
ALIAS: MY-H{ H{
|
||||
{ H{ { 1 2 } } } [
|
||||
"IN: words.alias.tests MY-H{ { 1 2 } }" eval( -- x )
|
||||
] unit-test
|
||||
|
|
|
@ -8,7 +8,8 @@ PREDICATE: alias < word "alias" word-prop ;
|
|||
|
||||
: define-alias ( new old -- )
|
||||
[ [ 1quotation ] [ stack-effect ] bi define-inline ]
|
||||
[ drop t "alias" set-word-prop ] 2bi ;
|
||||
[ drop t "alias" set-word-prop ]
|
||||
[ parsing-word? [ t "parsing" set-word-prop ] [ drop ] if ] 2tri ;
|
||||
|
||||
M: alias reset-word
|
||||
[ call-next-method ] [ f "alias" set-word-prop ] bi ;
|
||||
|
|
Loading…
Reference in New Issue