Permalink
Browse files

`||=` reference error can happen with constants as well; #3138

  • Loading branch information...
matz committed Mar 23, 2016
1 parent 817b884 commit 4fcff347474088e72d8b6016219d35ceb00c5a22
Showing with 2 additions and 1 deletion.
  1. +2 −1 mrbgems/mruby-compiler/core/parse.y
@@ -709,7 +709,8 @@ new_masgn(parser_state *p, node *a, node *b)
static node*
new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
{
if (op == mrb_intern_lit(p->mrb, "||") && (intptr_t)a->car == NODE_CVAR) {
if (op == mrb_intern_lit(p->mrb, "||") &&
((intptr_t)a->car == NODE_CONST || (intptr_t)a->car == NODE_CVAR)) {
return new_rescue(p, a, list1(list3(list1(new_const(p, mrb_intern_lit(p->mrb, "NameError"))),
0, new_asgn(p, a, b))), NULL);
}

0 comments on commit 4fcff34

Please sign in to comment.