зеркало из https://github.com/github/ruby.git
parse.y: extract function
* parse.y (new_args_tail_gen): extract from dsym rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4d887d8b71
Коммит
87450541b3
48
parse.y
48
parse.y
|
@ -393,6 +393,8 @@ static NODE *ret_args_gen(struct parser_params*,NODE*);
|
|||
static NODE *arg_blk_pass(NODE*,NODE*);
|
||||
static NODE *new_yield_gen(struct parser_params*,NODE*);
|
||||
#define new_yield(node) new_yield_gen(parser, (node))
|
||||
static NODE *dsym_node_gen(struct parser_params*,NODE*);
|
||||
#define dsym_node(node) dsym_node_gen(parser, (node))
|
||||
|
||||
static NODE *gettable_gen(struct parser_params*,ID);
|
||||
#define gettable(id) gettable_gen(parser,(id))
|
||||
|
@ -4384,26 +4386,7 @@ dsym : tSYMBEG xstring_contents tSTRING_END
|
|||
{
|
||||
lex_state = EXPR_END;
|
||||
/*%%%*/
|
||||
if (!($$ = $2)) {
|
||||
$$ = NEW_LIT(ID2SYM(rb_intern("")));
|
||||
}
|
||||
else {
|
||||
VALUE lit;
|
||||
|
||||
switch (nd_type($$)) {
|
||||
case NODE_DSTR:
|
||||
nd_set_type($$, NODE_DSYM);
|
||||
break;
|
||||
case NODE_STR:
|
||||
lit = $$->nd_lit;
|
||||
$$->nd_lit = ID2SYM(rb_intern_str(lit));
|
||||
nd_set_type($$, NODE_LIT);
|
||||
break;
|
||||
default:
|
||||
$$ = NEW_NODE(NODE_DSYM, Qnil, 1, NEW_LIST($$));
|
||||
break;
|
||||
}
|
||||
}
|
||||
$$ = dsym_node($2);
|
||||
/*%
|
||||
$$ = dispatch1(dyna_symbol, $2);
|
||||
%*/
|
||||
|
@ -9420,6 +9403,31 @@ new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
|
|||
ruby_sourceline = saved_line;
|
||||
return node;
|
||||
}
|
||||
|
||||
static NODE*
|
||||
dsym_node_gen(struct parser_params *parser, NODE *node)
|
||||
{
|
||||
VALUE lit;
|
||||
|
||||
if (!node) {
|
||||
return NEW_LIT(ID2SYM(idNULL));
|
||||
}
|
||||
|
||||
switch (nd_type(node)) {
|
||||
case NODE_DSTR:
|
||||
nd_set_type(node, NODE_DSYM);
|
||||
break;
|
||||
case NODE_STR:
|
||||
lit = node->nd_lit;
|
||||
node->nd_lit = ID2SYM(rb_intern_str(lit));
|
||||
nd_set_type(node, NODE_LIT);
|
||||
break;
|
||||
default:
|
||||
node = NEW_NODE(NODE_DSYM, Qnil, 1, NEW_LIST(node));
|
||||
break;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
#endif /* !RIPPER */
|
||||
|
||||
static void
|
||||
|
|
Загрузка…
Ссылка в новой задаче