1
0
Fork 0
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/trunk@8401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-05-01 00:15:25 +00:00
parent fa1855c6d4
commit 1ec656e349
3 changed files with 20 additions and 13 deletions

View file

@ -1,8 +1,11 @@
Sun May 1 09:13:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sun May 1 09:15:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (process_sflag): replace '-' in variable names with '_'.
[ruby-dev:26107]
* eval.c (rb_eval), parse.y (arg): reduce fixnum range literal at
parser. fixed: [ruby-dev:26113]
Sat Apr 30 11:59:25 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_FUNC_ATTRIBUTE): check for function attribute.

10
eval.c
View file

@ -3226,16 +3226,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
View file

@ -1760,7 +1760,14 @@ 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);
}
/*%
$$ = dispatch2(dot2, $1, $3);
%*/
@ -1770,7 +1777,14 @@ arg : lhs '=' 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);
}
/*%
$$ = dispatch2(dot3, $1, $3);
%*/