зеркало из https://github.com/github/ruby.git
* parse.y (value_expr0): allow return/break/next/redo/retry in rhs
of logical operator. [ruby-dev:18534] * parse.y (remove_begin): eliminate useless NODE_BEGIN. [ruby-dev:18535] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6dfb5aa6ac
Коммит
8232622071
|
@ -1,3 +1,11 @@
|
|||
Fri Oct 18 23:11:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* parse.y (value_expr0): allow return/break/next/redo/retry in rhs
|
||||
of logical operator. [ruby-dev:18534]
|
||||
|
||||
* parse.y (remove_begin): eliminate useless NODE_BEGIN.
|
||||
[ruby-dev:18535]
|
||||
|
||||
Fri Oct 18 01:02:44 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* hash.c, eval.c: Use (*_NSGetEnviron()) instead of environ on
|
||||
|
|
35
parse.y
35
parse.y
|
@ -119,9 +119,12 @@ static NODE *logop();
|
|||
static NODE *newline_node();
|
||||
static void fixpos();
|
||||
|
||||
static int value_expr();
|
||||
static void void_expr();
|
||||
static int value_expr0();
|
||||
static void void_expr0();
|
||||
static void void_stmts();
|
||||
static NODE *remove_begin();
|
||||
#define value_expr(node) value_expr0((node) = remove_begin(node))
|
||||
#define void_expr(node) void_expr0((node) = remove_begin(node))
|
||||
|
||||
static NODE *block_append();
|
||||
static NODE *list_append();
|
||||
|
@ -4697,9 +4700,11 @@ node_assign(lhs, rhs)
|
|||
}
|
||||
|
||||
static int
|
||||
value_expr(node)
|
||||
value_expr0(node)
|
||||
NODE *node;
|
||||
{
|
||||
int cond = 0;
|
||||
|
||||
while (node) {
|
||||
switch (nd_type(node)) {
|
||||
case NODE_CLASS:
|
||||
|
@ -4714,7 +4719,7 @@ value_expr(node)
|
|||
case NODE_NEXT:
|
||||
case NODE_REDO:
|
||||
case NODE_RETRY:
|
||||
yyerror("void value expression");
|
||||
if (!cond) yyerror("void value expression");
|
||||
/* or "control never reach"? */
|
||||
return Qfalse;
|
||||
|
||||
|
@ -4736,6 +4741,7 @@ value_expr(node)
|
|||
|
||||
case NODE_AND:
|
||||
case NODE_OR:
|
||||
cond = 1;
|
||||
node = node->nd_2nd;
|
||||
break;
|
||||
|
||||
|
@ -4752,7 +4758,7 @@ value_expr(node)
|
|||
}
|
||||
|
||||
static void
|
||||
void_expr(node)
|
||||
void_expr0(node)
|
||||
NODE *node;
|
||||
{
|
||||
char *useless = 0;
|
||||
|
@ -4862,6 +4868,25 @@ void_stmts(node)
|
|||
}
|
||||
}
|
||||
|
||||
static NODE *
|
||||
remove_begin(node)
|
||||
NODE *node;
|
||||
{
|
||||
NODE **n = &node;
|
||||
while (*n) {
|
||||
switch (nd_type(*n)) {
|
||||
case NODE_NEWLINE:
|
||||
n = &(*n)->nd_next;
|
||||
continue;
|
||||
case NODE_BEGIN:
|
||||
*n = (*n)->nd_body;
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
static int
|
||||
assign_in_cond(node)
|
||||
NODE *node;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.3"
|
||||
#define RUBY_RELEASE_DATE "2002-10-17"
|
||||
#define RUBY_RELEASE_DATE "2002-10-18"
|
||||
#define RUBY_VERSION_CODE 173
|
||||
#define RUBY_RELEASE_CODE 20021017
|
||||
#define RUBY_RELEASE_CODE 20021018
|
||||
|
|
Загрузка…
Ссылка в новой задаче