Ticket #1790: temporary_boolean_isa_integer.patch

File temporary_boolean_isa_integer.patch, 1.3 KB (added by NotFound, 11 years ago)

Patch with a hackish temporary fix

  • src/pmc/boolean.pmc

     
    184184        SELF.set_bool(VTABLE_shift_integer(INTERP, info)); 
    185185    } 
    186186 
     187/* 
     188 
     189=item C<INTVAL isa(STRING *name)> 
     190 
     191Temporary solution for backward compatibility until deprecation cycle. 
     192 
     193See TT #1790 
     194 
     195=cut 
     196 
     197*/ 
     198 
     199    VTABLE INTVAL isa(STRING *some) 
     200    { 
     201        if (Parrot_str_equal(INTERP, some, CONST_STRING(INTERP, "Boolean"))) 
     202            return 1; 
     203        if (Parrot_str_equal(INTERP, some, CONST_STRING(INTERP, "scalar"))) 
     204            return 1; 
     205        if (Parrot_str_equal(INTERP, some, CONST_STRING(INTERP, "Integer"))) 
     206            return 1; 
     207        return 0; 
     208    } 
     209 
    187210} 
    188211 
    189212/* 
  • t/pmc/boolean.t

     
    1919 
    2020.sub main :main 
    2121    .include 'test_more.pir' 
    22     plan(31) 
     22    plan(32) 
    2323    init_null_tests() 
    2424    init_int_tests() 
    2525    instantiate_tests() 
     
    207207    .local int b 
    208208 
    209209    p = new ['Boolean'] 
     210 
     211    isa b, p, "Integer" 
     212    is(b, 1, "Boolean isa Integer - going to be deprecated - TT #1790") 
     213 
    210214    does b, p, "scalar" 
    211215    is(b, 1, "Boolean does scalar") 
    212216    does b, p, "boolean"