mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: args tail at error
* parse.y (new_args_tail_gen): abandon parsing arguments after error. reported by ilsani Martino Sani (ilsani) at https://hackerone.com/reports/221201 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c23609e60
commit
80f5067478
2 changed files with 8 additions and 0 deletions
1
parse.y
1
parse.y
|
@ -9965,6 +9965,7 @@ new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
|
|||
|
||||
args = ZALLOC(struct rb_args_info);
|
||||
node = NEW_NODE(NODE_ARGS, 0, 0, args);
|
||||
if (parser->error_p) return node;
|
||||
|
||||
args->block_arg = b;
|
||||
args->kw_args = k;
|
||||
|
|
|
@ -958,6 +958,13 @@ x = __ENCODING__
|
|||
assert_syntax_error(" 0b\n", /\^/)
|
||||
end
|
||||
|
||||
def test_error_def_in_argument
|
||||
assert_separately([], "#{<<-"begin;"}\n#{<<~"end;"}")
|
||||
begin;
|
||||
assert_syntax_error("def f r:def d; def f 0end", /unexpected/)
|
||||
end;
|
||||
end
|
||||
|
||||
=begin
|
||||
def test_past_scope_variable
|
||||
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
|
||||
|
|
Loading…
Add table
Reference in a new issue