develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33742 - in trunk/languages/perl6/src: builtins classes parser utils

From:
duff
Date:
December 9, 2008 22:17
Subject:
[svn:parrot] r33742 - in trunk/languages/perl6/src: builtins classes parser utils
Message ID:
20081210061702.06716CB9AF@x12.develooper.com
Author: duff
Date: Tue Dec  9 22:16:59 2008
New Revision: 33742

Modified:
   trunk/languages/perl6/src/builtins/control.pir
   trunk/languages/perl6/src/builtins/guts.pir
   trunk/languages/perl6/src/builtins/io.pir
   trunk/languages/perl6/src/builtins/math.pir
   trunk/languages/perl6/src/classes/IO.pir
   trunk/languages/perl6/src/classes/List.pir
   trunk/languages/perl6/src/classes/Mapping.pir
   trunk/languages/perl6/src/classes/Object.pir
   trunk/languages/perl6/src/classes/Protoobject.pir
   trunk/languages/perl6/src/parser/quote_expression.pir
   trunk/languages/perl6/src/utils/perl6doc.pir

Log:
Change instances of "new 'Iterator', foo" to use "iter foo" instead

Modified: trunk/languages/perl6/src/builtins/control.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/control.pir	(original)
+++ trunk/languages/perl6/src/builtins/control.pir	Tue Dec  9 22:16:59 2008
@@ -147,14 +147,14 @@
 
 .sub 'die'
     .param pmc list            :slurpy
-    .local pmc iter
+    .local pmc it
     .local string message
 
     message = ''
-    iter = new 'Iterator', list
+    it = iter list
   iter_loop:
-    unless iter goto iter_end
-    $P0 = shift iter
+    unless it goto iter_end
+    $P0 = shift it
     $S0 = $P0
     message .= $S0
     goto iter_loop

Modified: trunk/languages/perl6/src/builtins/guts.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/guts.pir	(original)
+++ trunk/languages/perl6/src/builtins/guts.pir	Tue Dec  9 22:16:59 2008
@@ -315,12 +315,12 @@
 .sub '!SETUP_ARGS'
     .param pmc args_str
     .param int strip_program_name
-    .local pmc args, iter
+    .local pmc args, it
     args = new 'List'
-    iter = new 'Iterator', args_str
+    it = iter args_str
   args_loop:
-    unless iter goto args_end
-    $P0 = shift iter
+    unless it goto args_end
+    $P0 = shift it
     push args, $P0
     goto args_loop
   args_end:
@@ -341,7 +341,7 @@
 .sub '!keyword_class'
     .param string name   :optional
     .param int have_name :opt_flag
-    .local pmc class, resolve_list, methods, iter
+    .local pmc class, resolve_list, methods, it
 
     # Create class.
     if have_name goto named
@@ -354,11 +354,11 @@
 
     # Set resolve list to include all methods of the class.
     methods = inspect class, 'methods'
-    iter = new 'Iterator', methods
+    it = iter methods
     resolve_list = new 'ResizableStringArray'
   resolve_loop:
-    unless iter goto resolve_loop_end
-    $P0 = shift iter
+    unless it goto resolve_loop_end
+    $P0 = shift it
     push resolve_list, $P0
     goto resolve_loop
   resolve_loop_end:

Modified: trunk/languages/perl6/src/builtins/io.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/io.pir	(original)
+++ trunk/languages/perl6/src/builtins/io.pir	Tue Dec  9 22:16:59 2008
@@ -14,12 +14,12 @@
 
 .sub 'print'
     .param pmc args            :slurpy
-    .local pmc iter
+    .local pmc it
     args.'!flatten'()
-    iter = new 'Iterator', args
+    it = iter args
   iter_loop:
-    unless iter goto iter_end
-    $S0 = shift iter
+    unless it goto iter_end
+    $S0 = shift it
     print $S0
     goto iter_loop
   iter_end:

Modified: trunk/languages/perl6/src/builtins/math.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/math.pir	(original)
+++ trunk/languages/perl6/src/builtins/math.pir	Tue Dec  9 22:16:59 2008
@@ -166,7 +166,7 @@
     .param num    exp          :optional
     .param int    has_exp      :opt_flag
     .local num    result, fracdivisor, magnitude
-    .local pmc     iter
+    .local pmc    it
 
     if radix <= 1 goto err_range
     if radix > 36 goto err_range
@@ -175,11 +175,11 @@
     fracdivisor = 1.0
 
     $P0 = split '', intpart
-    iter = new 'Iterator', $P0
+    it = iter $P0
 
   lp1: # Accumulate over decimal part
-    unless iter goto ex1
-    $S0 = shift iter
+    unless it goto ex1
+    $S0 = shift it
     $S0 = downcase $S0
     if $S0 == "_" goto lp1
     $I0 = index "0123456789abcdefghijklmnopqrstuvwxyz", $S0
@@ -197,8 +197,8 @@
     $P99 = shift $P0                             # remove the radix point
 
   lp2: # Accumulate over fractional part, keep length
-    unless iter goto ex2
-    $S0 = shift iter
+    unless it goto ex2
+    $S0 = shift it
     $S0 = downcase $S0
     if $S0 == "_" goto lp2
     $I0 = index "0123456789abcdefghijklmnopqrstuvwxyz", $S0

Modified: trunk/languages/perl6/src/classes/IO.pir
==============================================================================
--- trunk/languages/perl6/src/classes/IO.pir	(original)
+++ trunk/languages/perl6/src/classes/IO.pir	Tue Dec  9 22:16:59 2008
@@ -61,14 +61,14 @@
 
 .sub 'print' :method
     .param pmc args            :slurpy
-    .local pmc iter
+    .local pmc it
     .local pmc PIO
     PIO = getattribute self, "$!PIO"
     args = 'list'(args)
-    iter = new 'Iterator', args
+    it = iter args
   iter_loop:
-    unless iter goto iter_end
-    $S0 = shift iter
+    unless it goto iter_end
+    $S0 = shift it
     print PIO, $S0
     goto iter_loop
   iter_end:

Modified: trunk/languages/perl6/src/classes/List.pir
==============================================================================
--- trunk/languages/perl6/src/classes/List.pir	(original)
+++ trunk/languages/perl6/src/classes/List.pir	Tue Dec  9 22:16:59 2008
@@ -64,7 +64,7 @@
 .namespace ['List']
 .sub 'Iterator' :method
     self.'!flatten'()
-    $P0 = new 'Iterator', self
+    $P0 = iter self
     .return ($P0)
 .end
 

Modified: trunk/languages/perl6/src/classes/Mapping.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Mapping.pir	(original)
+++ trunk/languages/perl6/src/classes/Mapping.pir	Tue Dec  9 22:16:59 2008
@@ -52,12 +52,12 @@
 
 .sub 'get_string' :method :vtable
     $S0 = ''
-    .local pmc iter
-    iter = new 'Iterator', self
+    .local pmc it
+    it = iter self
   loop:
-    unless iter goto end
-    $S1 = shift iter
-    $S2 = iter[$S1]
+    unless it goto end
+    $S1 = shift it
+    $S2 = it[$S1]
     $S0 = concat $S0, $S1
     concat $S0, "\t"
     concat $S0, $S2
@@ -75,12 +75,12 @@
 =cut
 
 .sub 'hash' :method
-    .local pmc result, iter
+    .local pmc result, it
     result = new 'Perl6Hash'
-    iter = new 'Iterator', self
+    it = iter self
   iter_loop:
-    unless iter goto iter_end
-    $S0 = shift iter
+    unless it goto iter_end
+    $S0 = shift it
     $P0 = self[$S0]
     result[$S0] = $P0
     goto iter_loop
@@ -126,15 +126,15 @@
 =cut
 
 .sub 'kv' :method :multi('Hash')
-    .local pmc iter
+    .local pmc it
     .local pmc rv
-    iter = new 'Iterator', self
+    it = iter self
     rv   = new 'List'
   loop:
-    unless iter goto end
-    $S1 = shift iter
+    unless it goto end
+    $S1 = shift it
     push rv, $S1
-    $P1 = iter[$S1]
+    $P1 = it[$S1]
     push rv, $P1
     goto loop
   end:
@@ -148,15 +148,15 @@
 =cut
 
 .sub 'pairs' :method :multi('Hash')
-    .local pmc iter
+    .local pmc it
     .local pmc rv
-    iter = new 'Iterator', self
+    it = iter self
     rv   = 'list'()
     $P3 = get_hll_global 'Perl6Pair'
   loop:
-    unless iter goto end
-    $P1 = shift iter
-    $P2 = iter[$P1]
+    unless it goto end
+    $P1 = shift it
+    $P2 = it[$P1]
     $P4 = $P3.'new'('key' => $P1, 'value' => $P2)
     push rv, $P4
     goto loop
@@ -210,13 +210,13 @@
 
 
 .sub 'keys' :method :multi('Hash')
-    .local pmc iter
+    .local pmc it
     .local pmc rv
-    iter = new 'Iterator', self
+    it = iter self
     rv   = new 'List'
   loop:
-    unless iter goto end
-    $S1 = shift iter
+    unless it goto end
+    $S1 = shift it
     push rv, $S1
     goto loop
   end:
@@ -228,12 +228,12 @@
 =cut
 
 .sub 'reverse' :method :multi('Hash')
-    .local pmc result, iter
+    .local pmc result, it
     result = new 'Perl6Hash'
-    iter = new 'Iterator', self
+    it = iter self
   iter_loop:
-    unless iter goto iter_end
-    $S0 = shift iter
+    unless it goto iter_end
+    $S0 = shift it
     $S1 = self[$S0]
     result[$S1] = $S0
     goto iter_loop
@@ -243,14 +243,14 @@
 
 
 .sub 'values' :method :multi('Hash')
-    .local pmc iter
+    .local pmc it
     .local pmc rv
-    iter = new 'Iterator', self
+    it = iter self
     rv   = new 'List'
   loop:
-    unless iter goto end
-    $S1 = shift iter
-    $P1 = iter[$S1]
+    unless it goto end
+    $S1 = shift it
+    $P1 = it[$S1]
     push rv, $P1
     goto loop
   end:

Modified: trunk/languages/perl6/src/classes/Object.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Object.pir	(original)
+++ trunk/languages/perl6/src/classes/Object.pir	Tue Dec  9 22:16:59 2008
@@ -215,7 +215,7 @@
     whence = self.'WHENCE'()
     unless whence goto no_whence
     .local pmc this_whence_iter
-    this_whence_iter = new 'Iterator', whence
+    this_whence_iter = iter whence
   this_whence_iter_loop:
     unless this_whence_iter goto no_whence
     $S0 = shift this_whence_iter
@@ -231,7 +231,7 @@
     # the all_parents list includes ourself.
     .local pmc all_parents, class_iter
     all_parents = inspect $P0, "all_parents"
-    class_iter = new 'Iterator', all_parents
+    class_iter = iter all_parents
   class_iter_loop:
     unless class_iter goto class_iter_loop_end
     .local pmc cur_class
@@ -251,7 +251,7 @@
     # Go through the provided init_parents to see if we have anything that
     # matches.
     .local pmc ip_iter, cur_ip
-    ip_iter = new 'Iterator', init_parents
+    ip_iter = iter init_parents
   ip_iter_loop:
     unless ip_iter goto ip_iter_loop_end
     cur_ip = shift ip_iter
@@ -282,12 +282,12 @@
   found_init_attribs:
 
     # Now go through attributes of the current class and iternate over them.
-    .local pmc attribs, iter
+    .local pmc attribs, it
     attribs = inspect cur_class, "attributes"
-    iter = new 'Iterator', attribs
+    it = iter attribs
   iter_loop:
-    unless iter goto iter_end
-    $S0 = shift iter
+    unless it goto iter_end
+    $S0 = shift it
 
     # See if we have an init value; use Undef if not.
     .local int got_init_value

Modified: trunk/languages/perl6/src/classes/Protoobject.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Protoobject.pir	(original)
+++ trunk/languages/perl6/src/classes/Protoobject.pir	Tue Dec  9 22:16:59 2008
@@ -113,7 +113,7 @@
   from_list:
     # List.
     .local pmc list_iter, cur_pair
-    list_iter = new 'Iterator', what
+    list_iter = iter what
   list_iter_loop:
     unless list_iter goto done_whence
     cur_pair = shift list_iter

Modified: trunk/languages/perl6/src/parser/quote_expression.pir
==============================================================================
--- trunk/languages/perl6/src/parser/quote_expression.pir	(original)
+++ trunk/languages/perl6/src/parser/quote_expression.pir	Tue Dec  9 22:16:59 2008
@@ -51,13 +51,13 @@
     action = options['action']
 
     ##  set up options based on flags
-    .local pmc flagarray, iter
+    .local pmc flagarray, it
     flagarray = split ' ', flags
-    iter = new 'Iterator', flagarray
+    it = iter flagarray
   iter_loop:
-    unless iter goto iter_end
+    unless it goto iter_end
     .local string oname
-    oname = shift iter
+    oname = shift it
     oname = substr oname, 1
     options[oname] = 1
     if oname == 'ww' goto opt_ww
@@ -154,11 +154,11 @@
     ##  using an iterator to do it.
     ##  wwdoubleopts = clone options
             wwdoubleopts = new 'Hash'
-            .local pmc iter2
-            iter2 = new 'Iterator', options
+            .local pmc it2
+            it2 = iter options
           iter2_loop:
-            unless iter2 goto iter2_end
-            $S0 = shift iter2
+            unless it2 goto iter2_end
+            $S0 = shift it2
             $P0 = options[$S0]
             wwdoubleopts[$S0] = $P0
             goto iter2_loop

Modified: trunk/languages/perl6/src/utils/perl6doc.pir
==============================================================================
--- trunk/languages/perl6/src/utils/perl6doc.pir	(original)
+++ trunk/languages/perl6/src/utils/perl6doc.pir	Tue Dec  9 22:16:59 2008
@@ -97,12 +97,12 @@
     ##  coming directly from Parrot, but currently Parrot provides
     ##  it as a ResizableStringArray and we need Undefs for
     ##  non-existent elements (RSA gives empty strings).
-    .local pmc args, iter
+    .local pmc args, it
     args = new 'ResizableStringArray'
-    iter = new 'Iterator', args_str
+    it = iter args_str
   args_loop:
-    unless iter goto args_end
-    $P0 = shift iter
+    unless it goto args_end
+    $P0 = shift it
     push args, $P0
     goto args_loop
   args_end:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About