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

[svn:parrot] r34010 - trunk/languages/perl6/src/classes

From:
pmichaud
Date:
December 16, 2008 20:29
Subject:
[svn:parrot] r34010 - trunk/languages/perl6/src/classes
Message ID:
20081217042901.9BCDDCBA12@x12.develooper.com
Author: pmichaud
Date: Tue Dec 16 20:29:00 2008
New Revision: 34010

Modified:
   trunk/languages/perl6/src/classes/Mapping.pir

Log:
[rakudo]:  Clean up stringification of mappings.


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 16 20:29:00 2008
@@ -37,21 +37,20 @@
 .end
 
 
-.sub 'get_string' :method :vtable
-    $S0 = ''
+.sub '' :vtable('get_string') :method
+    .local string result
+    result = ''
+    $P0 = self.'pairs'()
     .local pmc it
-    it = iter self
-  loop:
-    unless it goto end
-    $S1 = shift it
-    $S2 = it[$S1]
-    $S0 = concat $S0, $S1
-    concat $S0, "\t"
-    concat $S0, $S2
-    concat $S0, "\n"
-    goto loop
-  end:
-    .return ($S0)
+    it = iter $P0
+  it_loop:
+    unless it goto it_done
+    $S0 = shift it
+    result .= $S0
+    result .= "\n"
+    goto it_loop
+  it_done:
+    .return (result)
 .end
 
 



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