mirror of
https://github.com/janet-lang/janet
synced 2025-11-05 10:03:06 +00:00
Avoid possible infinite loop in rest destructuring.
This commit is contained in:
@@ -188,8 +188,8 @@ static int destructure(JanetCompiler *c,
|
|||||||
janetc_emit_ss(c, JOP_LENGTH, len, right, 0);
|
janetc_emit_ss(c, JOP_LENGTH, len, right, 0);
|
||||||
|
|
||||||
/* loop condition - reuse arg slot for the condition result */
|
/* loop condition - reuse arg slot for the condition result */
|
||||||
int32_t label_loop_start = janetc_emit_sss(c, JOP_EQUALS, arg, argi, len, 0);
|
int32_t label_loop_start = janetc_emit_sss(c, JOP_LESS_THAN, arg, argi, len, 0);
|
||||||
int32_t label_loop_cond_jump = janetc_emit_si(c, JOP_JUMP_IF, arg, 0, 0);
|
int32_t label_loop_cond_jump = janetc_emit_si(c, JOP_JUMP_IF_NOT, arg, 0, 0);
|
||||||
|
|
||||||
/* loop body */
|
/* loop body */
|
||||||
janetc_emit_sss(c, JOP_GET, arg, right, argi, 0);
|
janetc_emit_sss(c, JOP_GET, arg, right, argi, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user