1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (yylex): 'do' should return kDO_BLOCK on EXPR_ENDARG.

* parse.y (singleton): "def (()).a end" dumped core.

* parse.y (range_op): node may be null.

* parse.y (match_gen): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-06-12 09:24:58 +00:00
parent e252e87784
commit 143e2c24f0
3 changed files with 67 additions and 30 deletions

View file

@ -2,6 +2,24 @@ Wed Jun 12 15:00:57 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* parse.y (stmt): fix typo.
Wed Jun 12 01:10:40 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (singleton): "def (()).a end" dumped core.
* parse.y (cond2): node may be null.
* parse.y (match_gen): ditto.
Tue Jun 11 17:12:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (arg): void value check for "..", "...", "!", and "not".
* parse.y (match_gen): void value check for "=~".
* parse.y (value_expr): check NODE_AND and NODE_OR recursively.
* parse.y (cond0): void value check added for conditionals.
Mon Jun 10 19:02:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* numeric.c (fix_lshift): negative shift count means right shift.

2
gc.c
View file

@ -726,7 +726,7 @@ rb_gc_mark(ptr)
default:
rb_bug("rb_gc_mark(): unknown data type 0x%x(0x%x) %s",
obj->as.basic.flags & T_MASK, obj,
is_pointer_to_heap(obj)?"corrupted object":"non object");
is_pointer_to_heap(obj) ? "corrupted object" : "non object");
}
}

77
parse.y
View file

@ -770,10 +770,14 @@ arg : lhs '=' arg
}
| arg tDOT2 arg
{
value_expr($1);
value_expr($3);
$$ = NEW_DOT2($1, $3);
}
| arg tDOT3 arg
{
value_expr($1);
value_expr($3);
$$ = NEW_DOT3($1, $3);
}
| arg '+' arg
@ -894,7 +898,6 @@ arg : lhs '=' arg
}
| '!' arg
{
value_expr($2);
$$ = NEW_NOT(cond($2));
}
| '~' arg
@ -1852,18 +1855,24 @@ singleton : var_ref
}
| '(' {lex_state = EXPR_BEG;} expr opt_nl ')'
{
switch (nd_type($3)) {
case NODE_STR:
case NODE_DSTR:
case NODE_XSTR:
case NODE_DXSTR:
case NODE_DREGX:
case NODE_LIT:
case NODE_ARRAY:
case NODE_ZARRAY:
yyerror("can't define single method for literals.");
default:
break;
if ($3 == 0) {
yyerror("can't define single method for ().");
}
else {
switch (nd_type($3)) {
case NODE_STR:
case NODE_DSTR:
case NODE_XSTR:
case NODE_DXSTR:
case NODE_DREGX:
case NODE_LIT:
case NODE_ARRAY:
case NODE_ZARRAY:
yyerror("can't define single method for literals");
default:
value_expr($3);
break;
}
}
$$ = $3;
}
@ -4240,25 +4249,31 @@ match_gen(node1, node2)
{
local_cnt('~');
switch (nd_type(node1)) {
case NODE_DREGX:
case NODE_DREGX_ONCE:
return NEW_MATCH2(node1, node2);
case NODE_LIT:
if (TYPE(node1->nd_lit) == T_REGEXP) {
value_expr(node1);
value_expr(node2);
if (node1) {
switch (nd_type(node1)) {
case NODE_DREGX:
case NODE_DREGX_ONCE:
return NEW_MATCH2(node1, node2);
case NODE_LIT:
if (TYPE(node1->nd_lit) == T_REGEXP) {
return NEW_MATCH2(node1, node2);
}
}
}
switch (nd_type(node2)) {
case NODE_DREGX:
case NODE_DREGX_ONCE:
return NEW_MATCH3(node2, node1);
case NODE_LIT:
if (TYPE(node2->nd_lit) == T_REGEXP) {
if (node2) {
switch (nd_type(node2)) {
case NODE_DREGX:
case NODE_DREGX_ONCE:
return NEW_MATCH3(node2, node1);
case NODE_LIT:
if (TYPE(node2->nd_lit) == T_REGEXP) {
return NEW_MATCH3(node2, node1);
}
}
}
@ -4374,7 +4389,6 @@ aryset(recv, idx)
NODE *recv, *idx;
{
value_expr(recv);
return NEW_CALL(recv, tASET, idx);
}
@ -4393,7 +4407,6 @@ attrset(recv, id)
ID id;
{
value_expr(recv);
return NEW_CALL(recv, rb_id_attrset(id), 0);
}
@ -4501,6 +4514,10 @@ value_expr(node)
case NODE_IF:
return value_expr(node->nd_body) && value_expr(node->nd_else);
case NODE_AND:
case NODE_OR:
return value_expr(node->nd_2nd);
case NODE_NEWLINE:
return value_expr(node->nd_next);
@ -4676,6 +4693,7 @@ cond0(node)
enum node_type type = nd_type(node);
assign_in_cond(node);
value_expr(node);
switch (type) {
case NODE_DREGX:
case NODE_DREGX_ONCE:
@ -4726,6 +4744,7 @@ cond2(node)
{
enum node_type type;
if (!node) return node;
node = cond(node);
type = nd_type(node);
if (type == NODE_NEWLINE) node = node->nd_next;