ripper.vcall.diff

Michael Edgar, 07/09/2011 12:24 PM

Download (1.64 KB)

View differences:

parse.y (working copy)
426 426
#define get_value(val) ripper_get_value(val)
427 427
static VALUE assignable_gen(struct parser_params*,VALUE);
428 428
#define assignable(lhs,node) assignable_gen(parser, (lhs))
429
static int id_is_var_gen(struct parser_params *parser, ID id);
430
#define id_is_var(id) id_is_var_gen(parser, (id))
429 431
#endif /* !RIPPER */
430 432

  
431 433
static ID formal_argument_gen(struct parser_params*, ID);
......
4276 4278
		    /*%%%*/
4277 4279
			if (!($$ = gettable($1))) $$ = NEW_BEGIN(0);
4278 4280
		    /*%
4279
			$$ = dispatch1(var_ref, $1);
4281
		        if (id_is_var(get_id($1))) {
4282
		          $$ = dispatch1(var_ref, $1);
4283
		        } else {
4284
		          $$ = dispatch1(vcall, $1);
4285
		        }
4280 4286
		    %*/
4281 4287
		    }
4282 4288
		;
......
7894 7900
    return t;
7895 7901
}
7896 7902

  
7897
#ifndef RIPPER
7903
#ifdef RIPPER
7904

  
7905
static int
7906
id_is_var_gen(struct parser_params *parser, ID id)
7907
{
7908
    if (id == keyword_self || id == keyword_nil || id == keyword_true || id == keyword_false ||
7909
        id == keyword__FILE__ || id == keyword__LINE__ || id == keyword__ENCODING__ ||
7910
        is_global_id(id) || is_instance_id(id) || is_const_id(id) || is_class_id(id)) {
7911
	return 1;
7912
    }
7913
    else if (is_local_id(id)) {
7914
	if (dyna_in_block() && dvar_defined(id)) return 1;
7915
	if (local_id(id)) return 1;
7916
	/* method call without arguments */
7917
	return 0;
7918
    }
7919
    compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
7920
    return 0;
7921
}
7922

  
7923
#else  /* !RIPPER */
7898 7924
static NODE*
7899 7925
node_newnode(struct parser_params *parser, enum node_type type, VALUE a0, VALUE a1, VALUE a2)
7900 7926
{