Commit e1892f6
CLJS-1516: better error message when calling macros with arity
When expanding a macro with an incorrect number
of arguments, emit invalid arity diagnostic reporting
the number of arguments decremented by 2 in order
to hide the count associated with special variables
&env and &form.
- The approach taken for regular JVM ClojureScript
is to catch the ArityException and throw a new
one with the count decremented by two.
- The approach taken for bootstrapped ClojureScript
---since a generic js/Error is thrown---is to instead
add a check for multi-arity-fns to consult the meta
in the invalid arity path to see if the function is
actually a bootstrap macroexpander and to
decrement by two in that case.1 parent 9391870 commit e1892f6
2 files changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
2349 | 2349 | | |
2350 | 2350 | | |
2351 | 2351 | | |
2352 | | - | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
2353 | 2356 | | |
2354 | 2357 | | |
2355 | 2358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2784 | 2784 | | |
2785 | 2785 | | |
2786 | 2786 | | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
2790 | 2792 | | |
2791 | 2793 | | |
2792 | 2794 | | |
| |||
0 commit comments