[svn:parrot] r48866 - in trunk: compilers/pct/src/PCT compilers/pct/src/POST t/compilers/pct

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Wed Sep 8 19:26:52 UTC 2010


Author: pmichaud
Date: Wed Sep  8 19:26:52 2010
New Revision: 48866
URL: https://trac.parrot.org/parrot/changeset/48866

Log:
[pct]:  Refactor cache parameter of .lineof method to be named param.

Modified:
   trunk/compilers/pct/src/PCT/HLLCompiler.pir
   trunk/compilers/pct/src/POST/Compiler.pir
   trunk/t/compilers/pct/pct_hllcompiler.t

Modified: trunk/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/HLLCompiler.pir	Wed Sep  8 19:26:46 2010	(r48865)
+++ trunk/compilers/pct/src/PCT/HLLCompiler.pir	Wed Sep  8 19:26:52 2010	(r48866)
@@ -955,7 +955,7 @@
     .return ($P0)
 .end
 
-=item lineof(target, pos [, cache])
+=item lineof(target, pos [, cache :named('cache')])
 
 Return the line number of offset C<pos> within C<target>.  The return
 value uses zero for the first line.  If C<cache> is true, then
@@ -966,7 +966,7 @@
 .sub 'lineof' :method
     .param pmc target
     .param int pos
-    .param int cache           :optional
+    .param int cache           :optional :named('cache')
     .local pmc linepos
 
     # If we've previously cached C<linepos> for target, we use it.

Modified: trunk/compilers/pct/src/POST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/POST/Compiler.pir	Wed Sep  8 19:26:46 2010	(r48865)
+++ trunk/compilers/pct/src/POST/Compiler.pir	Wed Sep  8 19:26:52 2010	(r48866)
@@ -131,7 +131,7 @@
     if null pos goto done_subline
     source = cpost['source']
     if null source goto done_subline
-    line = self.'lineof'(source, pos, 1)
+    line = self.'lineof'(source, pos, 'cache'=>1)
     inc line
   done_subline:
     self.'pir'(cpost)

Modified: trunk/t/compilers/pct/pct_hllcompiler.t
==============================================================================
--- trunk/t/compilers/pct/pct_hllcompiler.t	Wed Sep  8 19:26:46 2010	(r48865)
+++ trunk/t/compilers/pct/pct_hllcompiler.t	Wed Sep  8 19:26:52 2010	(r48866)
@@ -218,33 +218,33 @@
     .local pmc hll, target
     hll = get_hll_global ['PCT'], 'HLLCompiler'
     target = box "0123\n5678\r0123\r\n678\n"
-    $I0 = hll.'lineof'(target, 0, 1)
+    $I0 = hll.'lineof'(target, 0, 'cache'=>1)
     is($I0, 0, "lineof - beginning of string")
-    $I0 = hll.'lineof'(target, 1, 1)
+    $I0 = hll.'lineof'(target, 1, 'cache'=>1)
     is($I0, 0, "lineof - char on first line")
-    $I0 = hll.'lineof'(target, 4, 1)
+    $I0 = hll.'lineof'(target, 4, 'cache'=>1)
     is($I0, 0, "lineof - immediately before nl")
-    $I0 = hll.'lineof'(target, 5, 1)
+    $I0 = hll.'lineof'(target, 5, 'cache'=>1)
     is($I0, 1, "lineof - immediately after nl")
-    $I0 = hll.'lineof'(target, 8, 1)
+    $I0 = hll.'lineof'(target, 8, 'cache'=>1)
     is($I0, 1, "lineof - char before cr")
-    $I0 = hll.'lineof'(target, 9, 1)
+    $I0 = hll.'lineof'(target, 9, 'cache'=>1)
     is($I0, 1, "lineof - immediately before cr")
-    $I0 = hll.'lineof'(target, 10, 1)
+    $I0 = hll.'lineof'(target, 10, 'cache'=>1)
     is($I0, 2, "lineof - immediately after cr")
-    $I0 = hll.'lineof'(target, 11, 1)
+    $I0 = hll.'lineof'(target, 11, 'cache'=>1)
     is($I0, 2, "lineof - char after cr")
-    $I0 = hll.'lineof'(target, 13, 1)
+    $I0 = hll.'lineof'(target, 13, 'cache'=>1)
     is($I0, 2, "lineof - char before crnl")
-    $I0 = hll.'lineof'(target, 14, 1)
+    $I0 = hll.'lineof'(target, 14, 'cache'=>1)
     is($I0, 2, "lineof - immediately before crnl")
-    $I0 = hll.'lineof'(target, 15, 1)
+    $I0 = hll.'lineof'(target, 15, 'cache'=>1)
     is($I0, 3, "lineof - middle of crnl")
-    $I0 = hll.'lineof'(target, 16, 1)
+    $I0 = hll.'lineof'(target, 16, 'cache'=>1)
     is($I0, 3, "lineof - immediately after crnl")
-    $I0 = hll.'lineof'(target, 19, 1)
+    $I0 = hll.'lineof'(target, 19, 'cache'=>1)
     is($I0, 3, "lineof - immediately before final nl")
-    $I0 = hll.'lineof'(target, 20, 1)
+    $I0 = hll.'lineof'(target, 20, 'cache'=>1)
     is($I0, 4, "lineof - immediately after final nl")
 .end
 CODE


More information about the parrot-commits mailing list