summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-11-30 19:12:09 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2012-11-30 19:12:09 -0800
commit620fd92f090cbfa0f3cf81656792202bfa780a66 (patch)
treeb7b252bc62805896474e8961da22a4e06d36996d
parent1d3f4b3ff7cbd3393a669698a252601b232bf553 (diff)
parenta100352595794ec1f1a1aaa5ae1654bc29d21192 (diff)
downloadmruby-620fd92f090cbfa0f3cf81656792202bfa780a66.tar.gz
mruby-620fd92f090cbfa0f3cf81656792202bfa780a66.zip
Merge pull request #579 from skandhas/pr-remove-incorrect-pop-in-codegen
remove incorrect pop() call in codegen
-rw-r--r--src/codegen.c1
-rw-r--r--test/t/syntax.rb11
2 files changed, 11 insertions, 1 deletions
diff --git a/src/codegen.c b/src/codegen.c
index fd41e3cb8..1e468867c 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -1412,7 +1412,6 @@ codegen(codegen_scope *s, node *tree, int val)
codegen(s, tree->cdr->cdr->car, VAL);
pop();
gen_assignment(s, tree->car, cursp(), val);
- if (val) pop();
dispatch(s, pos);
break;
}
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 47221d425..0501608e5 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -58,3 +58,14 @@ assert('Nested const reference') do
Syntax4Const::CONST1 == "hello world" and
Syntax4Const::Const2.new.const1 == "hello world"
end
+
+assert('Abbreviated variable assignment as returns') do
+ module Syntax4AbbrVarAsgnAsReturns
+ class A
+ def b
+ @c ||= 1
+ end
+ end
+ end
+ Syntax4AbbrVarAsgnAsReturns::A.new.b == 1
+end