зеркало из https://github.com/github/ruby.git
parse.y: required kwarg without parentheses
* parse.y (parser_yylex): only a newline after label should be significant. [ruby-core:61658] [Bug #9669] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6df5f314ac
Коммит
dcd1e5e5c2
|
@ -1,3 +1,8 @@
|
|||
Tue Mar 25 23:57:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_yylex): only a newline after label should be
|
||||
significant. [ruby-core:61658] [Bug #9669]
|
||||
|
||||
Tue Mar 25 23:32:25 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* ext/pathname/lib/pathname.rb (Pathname#join): remove unnecessary
|
||||
|
|
5
parse.y
5
parse.y
|
@ -7017,13 +7017,16 @@ parser_yylex(struct parser_params *parser)
|
|||
#endif
|
||||
/* fall through */
|
||||
case '\n':
|
||||
if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT)) {
|
||||
if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT | EXPR_LABELARG)) {
|
||||
#ifdef RIPPER
|
||||
if (!fallthru) {
|
||||
ripper_dispatch_scan_event(parser, tIGNORED_NL);
|
||||
}
|
||||
fallthru = FALSE;
|
||||
#endif
|
||||
if (IS_lex_state(EXPR_LABELARG) && parser->parser_in_kwarg) {
|
||||
goto normal_newline;
|
||||
}
|
||||
goto retry;
|
||||
}
|
||||
while ((c = nextc())) {
|
||||
|
|
|
@ -335,6 +335,15 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
end;
|
||||
end
|
||||
assert_equal(42, bug9669.foo(a: 42))
|
||||
assert_nothing_raised(SyntaxError, bug9669) do
|
||||
eval(<<-'end;', nil, __FILE__, __LINE__)
|
||||
o = {
|
||||
a:
|
||||
1
|
||||
}
|
||||
end;
|
||||
end
|
||||
assert_equal({a: 1}, o, bug9669)
|
||||
end
|
||||
|
||||
def test_block_required_keyword
|
||||
|
|
Загрузка…
Ссылка в новой задаче