| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Pugs
Revision: 22180
Author: ruoso
Date: 07 Sep 2008 10:47:30
Changes:[smop] specific test for array iterator...
Files:| ... | ...@@ -144,6 +144,7 @@ | |
| 144 | 144 | test/29_bind_capture_signature.p6 |
| 145 | 145 | test/30_array_map.m0ld |
| 146 | 146 | test/31_int_postfix_plusplus.m0ld |
| 147 | test/32_array_iterator.m0ld | |
| 147 | 148 | ) |
| 148 | 149 | set(c_file) |
| 149 | 150 | if (test_file MATCHES "\\.sm0p$") |
| ... | ...@@ -40,32 +40,10 @@ | |
| 40 | 40 | my $back; |
| 41 | 41 | my $interpreter; |
| 42 | 42 | |
| 43 | my $scalar = ¢SMOP__S1P__Scalar; | |
| 44 | 43 | |
| 45 | my $actualcapture = $capture."positional"(0); | |
| 46 | my $lexicalscope = $capture."positional"(1); | |
| 47 | my $outerscopecontainer = $lexicalscope."outer"(); | |
| 48 | my $outerscope = $outerscopecontainer."FETCH"(); | |
| 49 | ||
| 50 | my $count = $actualcapture."elems"(); | |
| 51 | my $outerbind = $count."infix:>"(0); | |
| 52 | ||
| 53 | my $void; | |
| 54 | my $val; | |
| 55 | ||
| 56 | my $container = $lexicalscope."postcircumfix:{ }"("$_"); | |
| 57 | ||
| 58 | if $outerbind { goto then } else { goto else }; | |
| 59 | then: | |
| 60 | my $pos = $actualcapture."positional"(0); | |
| 61 | $val = $scalar."new"($pos); | |
| 62 | goto exit; | |
| 63 | else: | |
| 64 | my $item = $outerscope."postcircumfix:{ }"("$_"); | |
| 65 | $val = $item."FETCH"(); | |
| 66 | exit: | |
| 67 | $void = $container."STORE"($val); | |
| 68 | $void = $interpreter."goto"($back); | |
| 44 | my $result; | |
| 45 | my $void = $back."setr"($result); | |
| 46 | $void = $interpreter."goto"($back); | |
| 69 | 47 | }; |
| 70 | 48 | |
| 71 | 49 | } |
| ... | ...@@ -0,0 +1,30 @@ | |
| 1 | my $array = ¢SMOP__S1P__Array."new"(); | |
| 2 | my $element = $array."postcircumfix:[ ]"(0); | |
| 3 | my $void = $element."STORE"("ok 1\n"); | |
| 4 | $element = $array."postcircumfix:[ ]"(1); | |
| 5 | $void = $element."STORE"("ok 2\n"); | |
| 6 | $element = $array."postcircumfix:[ ]"(2); | |
| 7 | $void = $element."STORE"("ok 3\n"); | |
| 8 | $element = $array."postcircumfix:[ ]"(3); | |
| 9 | $void = $element."STORE"("ok 4\n"); | |
| 10 | ||
| 11 | my $out_scalar = ¢SMOP__S1P__RootNamespace."postcircumfix:{ }"("$*OUT"); | |
| 12 | my $out = $out_scalar."FETCH"(); | |
| 13 | $void = $out."print"("1..5\n"); | |
| 14 | ||
| 15 | my $iterator = $array."Iterator"(); | |
| 16 | my $iteritem = $iterator."FETCH"(); | |
| 17 | ||
| 18 | while: | |
| 19 | my $result = $iteritem."prefix:="(); | |
| 20 | my $bool = $result."bool"(); | |
| 21 | ||
| 22 | if $bool { goto iteration } else { goto end }; | |
| 23 | ||
| 24 | iteration: | |
| 25 | my $item = $result."FETCH"(); | |
| 26 | $void = $out."print"($item); | |
| 27 | goto while; | |
| 28 | ||
| 29 | end: | |
| 30 | $void = $out."print"("ok 5\n"); |