Skip to content

Commit

Permalink
don't warn on boolification of type objects.
Browse files Browse the repository at this point in the history
Just evaluate them always to false.
Also include a wee bit more information in the warnings when using a type
object as a value (in the vtable methods in cheats/parrot/Protoobject.pir)
  • Loading branch information
moritz committed Mar 15, 2010
1 parent eff4bd3 commit b12fd89
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/cheats/parrot/Protoobject.pir
Expand Up @@ -98,24 +98,26 @@ Return a clone of the protoobject with a new WHENCE property set.
.namespace ['P6protoobject']
.sub '' :vtable('get_bool') :method
.const 'Sub' $P1 = '!FAIL'
$P0 = $P1('Use of type object as value')
$I0 = istrue $P0
.return ($I0)
# .const 'Sub' $P1 = '!FAIL'
# I don't think boolean context should warn, no? --moritz
# $P0 = $P1('Use of type object as value in boolean context')
## $I0 = istrue $P0
# .return ($I0)
.return (0)
.end

.namespace ['P6protoobject']
.sub '' :vtable('get_integer') :method
.const 'Sub' $P1 = '!FAIL'
$P0 = $P1('Use of type object as value')
$P0 = $P1('Use of type object as value in integer context')
$I0 = $P0
.return ($I0)
.end

.namespace ['P6protoobject']
.sub '' :vtable('get_number') :method
.const 'Sub' $P1 = '!FAIL'
$P0 = $P1('Use of type object as value')
$P0 = $P1('Use of type object as value in numeric context')
$N0 = $P0
.return ($N0)
.end
Expand Down

0 comments on commit b12fd89

Please sign in to comment.