summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-19 21:16:12 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-22 02:23:52 +0000
commite37df255c166efdda25d87b9d23f5c492cc02a68 (patch)
tree14f05151687dc082eaf771624f32f20b3487fcf3 /Src
parent338a4a299ad9b5c2e925a5c7ec38d1a6c811c4ed (diff)
downloadzsh-e37df255c166efdda25d87b9d23f5c492cc02a68.tar.gz
zsh-e37df255c166efdda25d87b9d23f5c492cc02a68.zip
45583/0005: internal: Document the WC_FUNCDEF data layout for anonymous functions with arguments (follow-up to 29492)
Diffstat (limited to 'Src')
-rw-r--r--Src/parse.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Src/parse.c b/Src/parse.c
index a4f83b573..6e79f6c4b 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -175,6 +175,10 @@ struct heredocs *hdocs;
* - followed by number of patterns for body
* - followed by codes for body
* - followed by strings for body
+ * - if number of names is 0, followed by:
+ * - the offset to the end of the funcdef
+ * - the number of arguments to the function
+ * - the arguments to the function
*
* WC_FOR
* - data contains type (list, ...) and offset to after body
@@ -1734,8 +1738,9 @@ par_funcdef(int *cmplx)
ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
+ /* If it's an anonymous function... */
if (num == 0) {
- /* Unnamed function */
+ /* ... look for arguments to it. */
int parg = ecadd(0);
ecadd(0);
while (tok == STRING) {
@@ -2110,8 +2115,9 @@ par_simple(int *cmplx, int nr)
ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
+ /* If it's an anonymous function... */
if (argc == 0) {
- /* Unnamed function */
+ /* ... look for arguments to it. */
int parg = ecadd(0);
ecadd(0);
while (tok == STRING || IS_REDIROP(tok)) {