mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[Bug #18884] class
cannot be just followed by modifiers
This commit is contained in:
parent
5e1c182900
commit
685efac059
Notes:
git
2022-06-29 14:13:36 +09:00
Merged: https://github.com/ruby/ruby/pull/6064 Merged-By: nobu <nobu@ruby-lang.org>
2 changed files with 8 additions and 1 deletions
2
parse.y
2
parse.y
|
@ -9235,7 +9235,7 @@ parse_ident(struct parser_params *p, int c, int cmd_state)
|
|||
return keyword_do_block;
|
||||
return keyword_do;
|
||||
}
|
||||
if (IS_lex_state_for(state, (EXPR_BEG | EXPR_LABELED)))
|
||||
if (IS_lex_state_for(state, (EXPR_BEG | EXPR_LABELED | EXPR_CLASS)))
|
||||
return kw->id[0];
|
||||
else {
|
||||
if (kw->id[0] != kw->id[1])
|
||||
|
|
|
@ -1359,6 +1359,13 @@ x = __ENCODING__
|
|||
end;
|
||||
end
|
||||
|
||||
def test_if_after_class
|
||||
assert_valid_syntax('module if true; Object end::Kernel; end')
|
||||
assert_valid_syntax('module while true; break Object end::Kernel; end')
|
||||
assert_valid_syntax('class if true; Object end::Kernel; end')
|
||||
assert_valid_syntax('class while true; break Object end::Kernel; 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