Skip to content

Commit

Permalink
Fix cmdarg handling for parsers < 24.
Browse files Browse the repository at this point in the history
  • Loading branch information
iliabylich authored and whitequark committed Feb 27, 2018
1 parent dc2d1c5 commit 3f74665
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/parser/lexer.rl
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,13 @@ class Parser::Lexer
e_rbrace | e_rparen | ']'
=> {
emit_table(PUNCTUATION)
@cond.lexpop; @cmdarg.pop

@cond.lexpop
if @version < 24
@cmdarg.lexpop
else
@cmdarg.pop
end

if tok == '}'.freeze
fnext expr_endarg;
Expand Down
10 changes: 10 additions & 0 deletions test/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6766,6 +6766,16 @@ def test_bug_447
%q{m [] do end},
%q{},
ALL_VERSIONS)

assert_parses(
s(:block,
s(:send, nil, :m,
s(:array),
s(:int, 1)),
s(:args), nil),
%q{m [], 1 do end},
%q{},
ALL_VERSIONS)
end

def test_bug_435
Expand Down

0 comments on commit 3f74665

Please sign in to comment.