Skip to content

Commit

Permalink
only generate gets of non-local vars in VAL mode
Browse files Browse the repository at this point in the history
This fixes a crash for code like "#{@A;1}".

Unlike CRuby globals are excluded too since mruby doesn't implement
hooking.
  • Loading branch information
cremno committed Jun 1, 2015
1 parent bd2686d commit 7e8fb15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/codegen.c
Expand Up @@ -1911,7 +1911,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;

case NODE_GVAR:
{
if (val) {
int sym = new_sym(s, sym(tree));

genop(s, MKOP_ABx(OP_GETGLOBAL, cursp(), sym));
Expand All @@ -1920,7 +1920,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;

case NODE_IVAR:
{
if (val) {
int sym = new_sym(s, sym(tree));

genop(s, MKOP_ABx(OP_GETIV, cursp(), sym));
Expand All @@ -1929,7 +1929,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;

case NODE_CVAR:
{
if (val) {
int sym = new_sym(s, sym(tree));

genop(s, MKOP_ABx(OP_GETCV, cursp(), sym));
Expand All @@ -1951,7 +1951,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;

case NODE_BACK_REF:
{
if (val) {
char buf[2] = { '$' };
mrb_value str;
int sym;
Expand All @@ -1965,7 +1965,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;

case NODE_NTH_REF:
{
if (val) {
int sym;
mrb_state *mrb = s->mrb;
mrb_value fix = mrb_fixnum_value((intptr_t)tree);
Expand Down

0 comments on commit 7e8fb15

Please sign in to comment.