File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -646,7 +646,7 @@ test "macro env can create sexpr AST nodes equivalently to quoting" ->
646
646
(m)"""
647
647
with -quote `@equals ` with -construct
648
648
649
- test "macros can evaluate arguments to JS and convert them back again" ->
649
+ test "macros can evaluate number arguments to JS and convert them back again" ->
650
650
esl """
651
651
(macro incrementedTimesTwo (lambda (x)
652
652
(var y (+ 1 ((. this evaluate) x)))
@@ -656,6 +656,15 @@ test "macros can evaluate arguments to JS and convert them back again" ->
656
656
"""
657
657
..`@equals ` "6 * 2;"
658
658
659
+ test "macros can evaluate macro-calling arguments to objects" ->
660
+ esl """
661
+ (macro printObject (lambda (objDefinition)
662
+ (= obj ((. this evaluate) objDefinition))
663
+ (return ((. this atom) ((. obj toString))))))
664
+ (printObject (object a 1))
665
+ """
666
+ ..`@equals ` "1;"
667
+
659
668
test "macros can unquote arrays into quasiquoted lists (non-splicing)" ->
660
669
esl "(macro what (lambda (x)
661
670
(return `(,x))))
@@ -1045,8 +1054,9 @@ test "macro can compile and return parameter as estree" ->
1045
1054
(that 3)
1046
1055
(that " hi ")
1047
1056
(that (c))
1057
+ (that (object a b))
1048
1058
'''
1049
- ..`@equals` " 3 ;\n 'hi' ;\nc();"
1059
+ ..`@equals` " 3 ;\n 'hi' ;\nc();\n({ a : b }); "
1050
1060
1051
1061
test " multiple invocations of the compiler are separate " ->
1052
1062
esl " (macro what (lambda () (return 'hi)))"
You can’t perform that action at this time.
0 commit comments