diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/parse.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index dfaef3a2b..fc7b9821f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-03-22 Daniel Shahaf <d.s@daniel.shahaf.name> + * 45583/0005: Src/parse.c: internal: Document the WC_FUNCDEF + data layout for anonymous functions with arguments (follow-up + to 29492) + * 45583/0004: Src/parse.c, Src/zsh.h: internal: Add some comments around wordcodes. No functional change. 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)) { |