words.alias: make aliases to parsing words also parsing words.

db4
John Benediktsson 2013-04-16 11:23:41 -07:00
parent db81422ff4
commit 15c4927c5f
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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 ;