mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_eval), parse.y (arg): reduce fixnum range literal at
parser. fixed: [ruby-dev:26113] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b957b3ff5
commit
a55c6429b9
3 changed files with 21 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu May 12 01:21:13 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_eval), parse.y (arg): reduce fixnum range literal at
|
||||
parser. fixed: [ruby-dev:26113]
|
||||
|
||||
Wed May 11 16:20:01 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* lib/webrick/cgi.rb: new methods WEBrick::CGI#[], WEBrick::CGI#logger
|
||||
|
|
10
eval.c
10
eval.c
|
@ -3207,16 +3207,6 @@ rb_eval(self, n)
|
|||
result = rb_range_new(rb_eval(self, node->nd_beg),
|
||||
rb_eval(self, node->nd_end),
|
||||
nd_type(node) == NODE_DOT3);
|
||||
if (node->nd_state) break;
|
||||
if (nd_type(node->nd_beg) == NODE_LIT && FIXNUM_P(node->nd_beg->nd_lit) &&
|
||||
nd_type(node->nd_end) == NODE_LIT && FIXNUM_P(node->nd_end->nd_lit))
|
||||
{
|
||||
nd_set_type(node, NODE_LIT);
|
||||
node->nd_lit = result;
|
||||
}
|
||||
else {
|
||||
node->nd_state = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_FLIP2: /* like AWK */
|
||||
|
|
18
parse.y
18
parse.y
|
@ -1057,13 +1057,27 @@ arg : lhs '=' arg
|
|||
{
|
||||
value_expr($1);
|
||||
value_expr($3);
|
||||
$$ = NEW_DOT2($1, $3);
|
||||
if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
|
||||
nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
|
||||
$1->nd_lit = rb_range_new($1->nd_lit, $3->nd_lit, Qfalse);
|
||||
$$ = $1;
|
||||
}
|
||||
else {
|
||||
$$ = NEW_DOT2($1, $3);
|
||||
}
|
||||
}
|
||||
| arg tDOT3 arg
|
||||
{
|
||||
value_expr($1);
|
||||
value_expr($3);
|
||||
$$ = NEW_DOT3($1, $3);
|
||||
if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
|
||||
nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
|
||||
$1->nd_lit = rb_range_new($1->nd_lit, $3->nd_lit, Qtrue);
|
||||
$$ = $1;
|
||||
}
|
||||
else {
|
||||
$$ = NEW_DOT3($1, $3);
|
||||
}
|
||||
}
|
||||
| arg '+' arg
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue