diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-22 06:30:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-22 06:30:12 +0000 |
commit | e2ac7b3d8b58816813ad1d05ed86fec8c80973d6 (patch) | |
tree | bee931e36267315487d45d5776ae8f4a568feddf /NEWS | |
parent | c17cfbea9a4cf6e12d7feae2fdda50457590af6a (diff) | |
download | ruby-e2ac7b3d8b58816813ad1d05ed86fec8c80973d6.tar.gz |
Safe navigation operator
* compile.c (iseq_peephole_optimize): peephole optimization for
branchnil jumps.
* compile.c (iseq_compile_each): generate save navigation operator
code.
* insns.def (branchnil): new opcode to pop the tos and branch if
it is nil.
* parse.y (NEW_QCALL, call_op, parser_yylex): parse token '.?'.
[Feature #11537]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -18,6 +18,17 @@ with all sufficient information, see the ChangeLog file. * besides, --enable/--disable=frozen-string-literal options also have been introduced. +* safe navigation operator: + + * new method call syntax, `object.?foo', method #foo is called on + `object' if it is not nil. + this is similar to `try!' in ActiveSupport, except for: + * method name is syntactically required + obj.try! {} # valid + obj.? {} # syntax error + * attribute assignment is valid + obj.?attr += 1 + === Core classes updates (outstanding ones only) * ARGF |