Project

General

Profile

Feature #12912 ยป endless-range.patch

mame (Yusuke Endoh), 11/09/2016 02:54 PM

View differences:

parse.y
2088 2088
			$$ = dispatch2(dot3, $1, $3);
2089 2089
		    %*/
2090 2090
		    }
2091
		| arg tDOT2
2092
		    {
2093
		    /*%%%*/
2094
			value_expr($1);
2095
			$$ = NEW_DOT2($1, NEW_LIT(INT2FIX(-1)));
2096
		    /*%
2097
			$$ = dispatch2(dot2, $1, INT2FIX(-1));
2098
		    %*/
2099
		    }
2091 2100
		| arg '+' arg
2092 2101
		    {
2093 2102
		    /*%%%*/
range.c
763 763
    beg = RANGE_BEG(range);
764 764
    end = RANGE_END(range);
765 765

  
766
    if (FIXNUM_P(beg) && FIXNUM_P(end)) { /* fixnums are special */
766
    if (FIXNUM_P(beg) && end == INT2FIX(-1)) {
767
        long i = FIX2LONG(beg);
768
        while (1) {
769
            rb_yield(LONG2FIX(i++));
770
        }
771
    }
772
    else if (FIXNUM_P(beg) && FIXNUM_P(end)) { /* fixnums are special */
767 773
	long lim = FIX2LONG(end);
768 774
	long i;
769 775