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

ruby-changes:17175

From: knu <ko1@a...>
Date: Fri, 3 Sep 2010 17:05:36 +0900 (JST)
Subject: [ruby-changes:17175] Ruby:r29174 (ruby_1_8): * parse.y (method_call): Add support for Ruby 1.9 style method

knu	2010-09-03 16:57:29 +0900 (Fri, 03 Sep 2010)

  New Revision: 29174

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

  Log:
    * parse.y (method_call): Add support for Ruby 1.9 style method
      invocation syntax f.(x) / f::(x), which is interpreted as
      f.call(x).

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/NEWS
    branches/ruby_1_8/parse.y

Index: ruby_1_8/parse.y
===================================================================
--- ruby_1_8/parse.y	(revision 29173)
+++ ruby_1_8/parse.y	(revision 29174)
@@ -1900,6 +1900,16 @@
 		    {
 			$$ = new_call($1, $3, 0);
 		    }
+		| primary_value '.' paren_args
+		    {
+			$$ = new_call($1, rb_intern("call"), $3);
+			fixpos($$, $1);
+		    }
+		| primary_value tCOLON2 paren_args
+		    {
+			$$ = new_call($1, rb_intern("call"), $3);
+			fixpos($$, $1);
+		    }
 		| kSUPER paren_args
 		    {
 			$$ = new_super($2);
Index: ruby_1_8/NEWS
===================================================================
--- ruby_1_8/NEWS	(revision 29173)
+++ ruby_1_8/NEWS	(revision 29174)
@@ -17,9 +17,17 @@
 
 * new hash immediates
 
-  Ruby 1.9 style hash syntax e.g. { key: value } is now also supported
-  in 1.8.  You can also write a method invocation syntax foo bar: baz.
+  Ruby 1.9 style hash syntax e.g. { key: value } is now supported.
+  Just like the normal hash syntax, you can put key-value pairs
+  without enclosing parentheses at the end of a method argument list.
+  e.g. some_method foo: 1, bar: 2
 
+* new method invocation syntax
+
+  Ruby 1.9 style special method invocation syntax f.(x), which is
+  equivalent to f.call(x), is supported.  This is mainly for use
+  in invoking a Proc.
+
 === Configuration changes
 
 * version specific directories
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 29173)
+++ ruby_1_8/ChangeLog	(revision 29174)
@@ -1,3 +1,9 @@
+Fri Sep  3 16:42:59 2010  Akinori MUSHA  <knu@i...>
+
+	* parse.y (method_call): Add support for Ruby 1.9 style method
+	  invocation syntax f.(x) / f::(x), which is interpreted as
+	  f.call(x).
+
 Fri Sep  3 12:40:54 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* intern.h (rb_usascii_str_new): macros for forward compatibility.

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

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