diff options
author | charliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-02 07:11:41 +0000 |
---|---|---|
committer | charliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-02 07:11:41 +0000 |
commit | a056098cb719312452eca309bec914406f9e5ca3 (patch) | |
tree | 36680bbcdabc53cd0a4132996d2b8984eaaa945d /compile.c | |
parent | 78c75d91ae577df2c43ba5b41891572d75105b2d (diff) | |
download | ruby-a056098cb719312452eca309bec914406f9e5ca3.tar.gz |
* NEWS: Add note about frozen string literals
* compile.c (case_when_optimizable_literal): optimize NODE_LIT strings
in when clauses of case statements
* ext/ripper/eventids2.c: add tSTRING_SUFFIX
* parse.y: add 'f' suffix on string literals for frozen strings
* test/ripper/test_scanner_events.rb: add scanner tests
* test/ruby/test_string.rb: add frozen string tests
[Feature #8579] [ruby-core:55699]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2504,7 +2504,8 @@ case_when_optimizable_literal(NODE * node) modf(RFLOAT_VALUE(v), &ival) == 0.0) { return FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival); } - if (SYMBOL_P(v) || rb_obj_is_kind_of(v, rb_cNumeric)) { + if (SYMBOL_P(v) || RB_TYPE_P(v, T_STRING) || + rb_obj_is_kind_of(v, rb_cNumeric)) { return v; } break; |