зеркало из https://github.com/github/ruby.git
* parse.y (arg): put back old ** behavior for negative number
right operand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ff7e65eb84
Коммит
1c770e7077
|
@ -3,6 +3,11 @@ Tue Jan 21 16:59:18 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
* instruby.rb: use real interpreter pathname at shebang line.
|
* instruby.rb: use real interpreter pathname at shebang line.
|
||||||
[ruby-dev:19370]
|
[ruby-dev:19370]
|
||||||
|
|
||||||
|
Tue Jan 21 16:22:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (arg): put back old ** behavior for negative number
|
||||||
|
right operand.
|
||||||
|
|
||||||
Tue Jan 21 14:46:12 2003 Tanaka Akira <akr@m17n.org>
|
Tue Jan 21 14:46:12 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/pp.rb: Use Test::Unit.
|
* lib/pp.rb: Use Test::Unit.
|
||||||
|
|
19
parse.y
19
parse.y
|
@ -1022,7 +1022,26 @@ arg : lhs '=' arg
|
||||||
}
|
}
|
||||||
| arg tPOW arg
|
| arg tPOW arg
|
||||||
{
|
{
|
||||||
|
int need_negate = Qfalse;
|
||||||
|
|
||||||
|
if ($1 && nd_type($1) == NODE_LIT) {
|
||||||
|
|
||||||
|
switch (TYPE($1->nd_lit)) {
|
||||||
|
case T_FIXNUM:
|
||||||
|
case T_FLOAT:
|
||||||
|
case T_BIGNUM:
|
||||||
|
if (RTEST(rb_funcall($1->nd_lit,'<',1,INT2FIX(0)))) {
|
||||||
|
$1->nd_lit = rb_funcall($1->nd_lit,rb_intern("-@"),0,0);
|
||||||
|
need_negate = Qtrue;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$$ = call_op($1, tPOW, 1, $3);
|
$$ = call_op($1, tPOW, 1, $3);
|
||||||
|
if (need_negate) {
|
||||||
|
$$ = call_op($$, tUMINUS, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| tUPLUS arg
|
| tUPLUS arg
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче