[前][次][番号順一覧][スレッド一覧]

ruby-changes:35621

From: nagachika <ko1@a...>
Date: Wed, 24 Sep 2014 02:40:08 +0900 (JST)
Subject: [ruby-changes:35621] nagachika:r47703 (ruby_2_1): merge revision(s) r47696, r47697: [Backport #10279]

nagachika	2014-09-24 02:39:48 +0900 (Wed, 24 Sep 2014)

  New Revision: 47703

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47703

  Log:
    merge revision(s) r47696,r47697: [Backport #10279]
    
    * parse.y (parse_ident): just after a label, new expression should
      start, cannot be a modifier.  [ruby-core:65211] [Bug #10279]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/parse.y
    branches/ruby_2_1/test/ruby/test_keyword.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 47702)
+++ ruby_2_1/ChangeLog	(revision 47703)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Wed Sep 24 02:30:55 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parse_ident): just after a label, new expression should
+	  start, cannot be a modifier.  [ruby-core:65211] [Bug #10279]
+
 Wed Sep 24 02:21:41 2014  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub (VCSUP): nothing to do if this worktree is not
Index: ruby_2_1/parse.y
===================================================================
--- ruby_2_1/parse.y	(revision 47702)
+++ ruby_2_1/parse.y	(revision 47703)
@@ -8195,7 +8195,7 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/ruby_2_1/parse.y#L8195
 			    return keyword_do_block;
 			return keyword_do;
 		    }
-		    if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE)))
+		    if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE | EXPR_LABELARG)))
 			return kw->id[0];
 		    else {
 			if (kw->id[0] != kw->id[1])
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 47702)
+++ ruby_2_1/version.h	(revision 47703)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.4"
 #define RUBY_RELEASE_DATE "2014-09-24"
-#define RUBY_PATCHLEVEL 246
+#define RUBY_PATCHLEVEL 247
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_1/test/ruby/test_keyword.rb
===================================================================
--- ruby_2_1/test/ruby/test_keyword.rb	(revision 47702)
+++ ruby_2_1/test/ruby/test_keyword.rb	(revision 47703)
@@ -325,7 +325,9 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_keyword.rb#L325
     assert_equal([[:keyreq, :a], [:keyrest, :b]], o.method(:bar).parameters, feature7701)
     assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar(c: bug8139)}
     assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar}
+  end
 
+  def test_required_keyword_with_newline
     bug9669 = '[ruby-core:61658] [Bug #9669]'
     assert_nothing_raised(SyntaxError, bug9669) do
       eval(<<-'end;', nil, __FILE__, __LINE__)
@@ -335,6 +337,7 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_keyword.rb#L337
       end;
     end
     assert_equal(42, bug9669.foo(a: 42))
+    o = nil
     assert_nothing_raised(SyntaxError, bug9669) do
       eval(<<-'end;', nil, __FILE__, __LINE__)
         o = {
@@ -346,6 +349,17 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_keyword.rb#L349
     assert_equal({a: 1}, o, bug9669)
   end
 
+  def test_required_keyword_with_reserved
+    bug10279 = '[ruby-core:65211] [Bug #10279]'
+    h = nil
+    assert_nothing_raised(SyntaxError, bug10279) do
+      break eval(<<-'end;', nil, __FILE__, __LINE__)
+        h = {a: if true then 42 end}
+      end;
+    end
+    assert_equal({a: 42}, h, bug10279)
+  end
+
   def test_block_required_keyword
     feature7701 = '[ruby-core:51454] [Feature #7701] required keyword argument'
     b = assert_nothing_raised(SyntaxError, feature7701) do

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r47696-47697


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]