Author: coke
Date: Fri Mar 28 14:34:07 2008
New Revision: 26608
Modified:
trunk/runtime/parrot/library/Data/Replace.pir
trunk/runtime/parrot/library/Stream/Coroutine.pir
trunk/runtime/parrot/library/Stream/Lines.pir
trunk/runtime/parrot/library/Stream/Replay.pir
trunk/runtime/parrot/library/Stream/Sub.pir
trunk/runtime/parrot/library/Stream/Writer.pir
Log:
use of type ids (e.g. ".Integer") is [DEPRECATED]
Avoid using them in some PIR modules: especially when checking for Undef,
better to use the opcode than the explicit type check.
(also fix one grammar-o in a comment)
Modified: trunk/runtime/parrot/library/Data/Replace.pir
==============================================================================
--- trunk/runtime/parrot/library/Data/Replace.pir (original)
+++ trunk/runtime/parrot/library/Data/Replace.pir Fri Mar 28 14:34:07 2008
@@ -98,8 +98,8 @@
find_global temp, "Data::Replace", name
errorson .PARROT_ERRORS_GLOBALS_FLAG
# invoke it if found
- typeof $I0, temp
- if $I0 == .Undef goto REPLACE_PROPS
+ $I0 = defined temp
+ unless $I0 goto REPLACE_PROPS
temp( where, oldVal, newVal, cache )
REPLACE_PROPS:
Modified: trunk/runtime/parrot/library/Stream/Coroutine.pir
==============================================================================
--- trunk/runtime/parrot/library/Stream/Coroutine.pir (original)
+++ trunk/runtime/parrot/library/Stream/Coroutine.pir Fri Mar 28 14:34:07 2008
@@ -49,8 +49,8 @@
null str
coro = self."source"()
- typeof $I0, coro
- if $I0 == .Undef goto END
+ $I0 = defined coro
+ unless $I0 goto END
str = coro( self )
END:
Modified: trunk/runtime/parrot/library/Stream/Lines.pir
==============================================================================
--- trunk/runtime/parrot/library/Stream/Lines.pir (original)
+++ trunk/runtime/parrot/library/Stream/Lines.pir Fri Mar 28 14:34:07 2008
@@ -60,8 +60,8 @@
# XXX: check if the buffer is empty if the source stream is not connected
getattribute $P0, self, 'source'
if_null $P0, NOT_CONNECTED
- typeof $I0, $P0
- if $I0 == .Undef goto NOT_CONNECTED
+ $I0 = defined $P0
+ unless $I0 goto NOT_CONNECTED
$I0 = $P0."connected"()
.return($I0)
NOT_CONNECTED:
Modified: trunk/runtime/parrot/library/Stream/Replay.pir
==============================================================================
--- trunk/runtime/parrot/library/Stream/Replay.pir (original)
+++ trunk/runtime/parrot/library/Stream/Replay.pir Fri Mar 28 14:34:07 2008
@@ -180,8 +180,8 @@
.local pmc clones
null ret
- typeof $I0, source
- if $I0==.Undef goto END
+ $I0 = defined source
+ unless $I0 goto END
getattribute strings, self, 'strings'
getattribute clones, self, 'clones'
Modified: trunk/runtime/parrot/library/Stream/Sub.pir
==============================================================================
--- trunk/runtime/parrot/library/Stream/Sub.pir (original)
+++ trunk/runtime/parrot/library/Stream/Sub.pir Fri Mar 28 14:34:07 2008
@@ -115,8 +115,8 @@
.local string str
temp = self."source"()
- typeof $I0, temp
- if $I0 == .Undef goto END
+ $I0 = defined temp
+ unless $I0 goto END
.include "interpinfo.pasm"
$P0 = interpinfo .INTERPINFO_CURRENT_CONT
setattribute self, 'write_cont', $P0
Modified: trunk/runtime/parrot/library/Stream/Writer.pir
==============================================================================
--- trunk/runtime/parrot/library/Stream/Writer.pir (original)
+++ trunk/runtime/parrot/library/Stream/Writer.pir Fri Mar 28 14:34:07 2008
@@ -142,14 +142,13 @@
setattribute self, 'writer', $P0
source = self."source"()
- if_null source, END
- typeof $I0, source
- if $I0 == .Undef goto END
+ $I0 = defined source
+ unless $I0 goto END
source( str )
END:
.return()
- goto WRITE # XXX else self get's overwritten by source
+ goto WRITE # XXX else self gets overwritten by source
.end
=item source."rawRead"() (B<internal>)