diff options
| -rw-r--r-- | src/codegen.c | 1 | ||||
| -rw-r--r-- | test/t/syntax.rb | 11 |
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 |
