Skip to content

Commit

Permalink
Revert "Refactor to reduce "swap" instruction of pattern matching"
Browse files Browse the repository at this point in the history
This reverts commit 3a4be42.

To fix following warning:

```
compiling ../compile.c
../compile.c:6336:20: warning: variable 'line' is uninitialized when used here [-Wuninitialized]
    ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
                   ^~~~
../compile.c:220:57: note: expanded from macro 'ADD_INSN'
  ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
                                                        ^~~~
../compile.c:6327:13: note: initialize the variable 'line' to silence this warning
    int line;
            ^
             = 0
1 warning generated.
```
  • Loading branch information
znz committed Aug 17, 2020
1 parent a73b5cc commit 5849309
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compile.c
Expand Up @@ -6333,7 +6333,6 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
INIT_ANCHOR(body_seq);
INIT_ANCHOR(cond_seq);

ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
CHECK(COMPILE(head, "case base", node->nd_head));

branches = decl_branch_base(iseq, node, "case");
Expand All @@ -6346,6 +6345,8 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
endlabel = NEW_LABEL(line);
elselabel = NEW_LABEL(line);

ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
ADD_INSN(head, line, swap);
ADD_SEQ(ret, head); /* case VAL */

while (type == NODE_IN) {
Expand Down

0 comments on commit 5849309

Please sign in to comment.