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

ruby-changes:47528

From: nobu <ko1@a...>
Date: Tue, 22 Aug 2017 22:21:24 +0900 (JST)
Subject: [ruby-changes:47528] nobu:r59644 (trunk): parse.y: primary should not be 0

nobu	2017-08-22 22:21:18 +0900 (Tue, 22 Aug 2017)

  New Revision: 59644

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

  Log:
    parse.y: primary should not be 0
    
    * parse.y (primary): should not be 0, since it can be a receiver.
      [ruby-core:82447] [Bug #13836]

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_defined.rb
Index: parse.y
===================================================================
--- parse.y	(revision 59643)
+++ parse.y	(revision 59644)
@@ -2487,7 +2487,7 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2487
 		| tLPAREN_ARG {SET_LEX_STATE(EXPR_ENDARG);} rparen
 		    {
 		    /*%%%*/
-			$$ = 0;
+			$$ = NEW_BEGIN(0);
 		    /*%
 			$$ = dispatch1(paren, 0);
 		    %*/
Index: test/ruby/test_defined.rb
===================================================================
--- test/ruby/test_defined.rb	(revision 59643)
+++ test/ruby/test_defined.rb	(revision 59644)
@@ -99,6 +99,10 @@ class TestDefined < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_defined.rb#L99
     end
   end
 
+  def test_defined_empty_paren_arg
+    assert_nil(defined?(p () + 1))
+  end
+
   def test_defined_impl_specific
     feature7035 = '[ruby-core:47558]' # not spec
     assert_predicate(defined?(Foo), :frozen?, feature7035)

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

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