1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-01 21:51:40 +02:00

45583/0005: internal: Document the WC_FUNCDEF data layout for anonymous functions with arguments (follow-up to 29492)

This commit is contained in:
Daniel Shahaf 2020-03-19 21:16:12 +00:00
parent 338a4a299a
commit e37df255c1
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,9 @@
2020-03-22 Daniel Shahaf <d.s@daniel.shahaf.name> 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 * 45583/0004: Src/parse.c, Src/zsh.h: internal: Add some comments
around wordcodes. No functional change. around wordcodes. No functional change.

View file

@ -175,6 +175,10 @@ struct heredocs *hdocs;
* - followed by number of patterns for body * - followed by number of patterns for body
* - followed by codes for body * - followed by codes for body
* - followed by strings 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 * WC_FOR
* - data contains type (list, ...) and offset to after body * - data contains type (list, ...) and offset to after body
@ -1734,8 +1738,9 @@ par_funcdef(int *cmplx)
ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p); ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
/* If it's an anonymous function... */
if (num == 0) { if (num == 0) {
/* Unnamed function */ /* ... look for arguments to it. */
int parg = ecadd(0); int parg = ecadd(0);
ecadd(0); ecadd(0);
while (tok == STRING) { while (tok == STRING) {
@ -2110,8 +2115,9 @@ par_simple(int *cmplx, int nr)
ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p); ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
/* If it's an anonymous function... */
if (argc == 0) { if (argc == 0) {
/* Unnamed function */ /* ... look for arguments to it. */
int parg = ecadd(0); int parg = ecadd(0);
ecadd(0); ecadd(0);
while (tok == STRING || IS_REDIROP(tok)) { while (tok == STRING || IS_REDIROP(tok)) {