codegen.c: `ainfo` may be negative.

When argument information is not available. So it should not happen for
`yield` (error). In contrast, the error from `super` should be handled
in run time (ignored).
parent 87f113e1
...@@ -2321,7 +2321,9 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2321,7 +2321,9 @@ codegen(codegen_scope *s, node *tree, int val)
s2 = s2->prev; s2 = s2->prev;
if (!s2) break; if (!s2) break;
} }
if (s2) ainfo = s2->ainfo; if (s2 && s2->ainfo > 0) {
ainfo = s2->ainfo;
}
genop_2S(s, OP_ARGARY, cursp(), (ainfo<<4)|(lv & 0xf)); genop_2S(s, OP_ARGARY, cursp(), (ainfo<<4)|(lv & 0xf));
push(); push(); pop(); /* ARGARY pushes two values */ push(); push(); pop(); /* ARGARY pushes two values */
if (tree && tree->cdr) { if (tree && tree->cdr) {
...@@ -2361,7 +2363,10 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2361,7 +2363,10 @@ codegen(codegen_scope *s, node *tree, int val)
s2 = s2->prev; s2 = s2->prev;
if (!s2) break; if (!s2) break;
} }
if (s2) ainfo = s2->ainfo; if (s2) {
ainfo = s2->ainfo;
if (ainfo < 0) codegen_error(s, "invalid yield");
}
push(); push();
if (tree) { if (tree) {
n = gen_values(s, tree, VAL, 0); n = gen_values(s, tree, VAL, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment