]> gitweb.factorcode.org Git - factor.git/commitdiff
words.alias: make aliases to parsing words also parsing words.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 16 Apr 2013 18:23:41 +0000 (11:23 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 16 Apr 2013 18:23:41 +0000 (11:23 -0700)
core/words/alias/alias-tests.factor
core/words/alias/alias.factor

index 4dc53f769efd82a05773cb9f7479b7baac14f798..badf63486b89862b6825d2cc82bd1f19360e0c30 100644 (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
index e9fd7213fc97209782bd230e07f09b43501c9204..754cda996b57c60990f4aa89afc3d4bed0df8895 100644 (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 ;