Commit ff36f0b
authored
Function signature fix for repeating arguments (#760)
* fix(signature): Enable the use of repeating parameters in lambda functions
Before this change, a function signature containing a repeating symbol (eg. <n+>) would copy the first of those arguments into every matching parameter (eg. `function($a1, $a2)<n+>{[$a1, $a2]}(1, 2)` returns [1, 1] instead of [1, 2]) instead of copying each argument to each parameter respectively.
* test(signature): Add tests for variadic lambda functions
"Variadic" just means a function can take an arbitrary number of arguments (eg. <n+>).
One important note here is that this implementation doesn't actually support an arbitrary number of arguments, only as many as the number of parameters you're willing to add to your function. I tried to change as little as possible while still squashing the bug.
I would recommend a breaking change that would bind each repeating parameter to an array of its provided arguments. Then, you could write something like this: `function($nums, $str)<n+s>{{$str: $count($nums)}}`1 parent 6092352 commit ff36f0b
File tree
7 files changed
+44
-2
lines changed- src
7 files changed
+44
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | | - | |
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| |||
0 commit comments