[svn:parrot] r41687 - branches/pcc_reapply/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Oct 4 13:03:34 UTC 2009


Author: bacek
Date: Sun Oct  4 13:03:32 2009
New Revision: 41687
URL: https://trac.parrot.org/parrot/changeset/41687

Log:
[core] Fix strange shortcut in setting Sub.outer_ctx with normal loop.

Modified:
   branches/pcc_reapply/src/pmc/sub.pmc

Modified: branches/pcc_reapply/src/pmc/sub.pmc
==============================================================================
--- branches/pcc_reapply/src/pmc/sub.pmc	Sun Oct  4 12:53:51 2009	(r41686)
+++ branches/pcc_reapply/src/pmc/sub.pmc	Sun Oct  4 13:03:32 2009	(r41687)
@@ -1073,16 +1073,14 @@
 
         /* If we've got a context around for the outer sub, set it as the
          * outer context. */
-
-        /* XXX This code looks very suspicious. */
-        /* (CONTEXT(interp)->caller_ctx->caller_ctx->current_sub */
-        tmp1 = Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
-        tmp2 = Parrot_pcc_get_caller_ctx(interp, tmp1);
-        if (Parrot_pcc_get_sub(interp, tmp2) == outer)
-            sub->outer_ctx = tmp2;
-        /* else if (CONTEXT(interp)->caller_ctx->current_sub == outer) */
-        else if (Parrot_pcc_get_sub(interp, tmp1) == outer)
-            sub->outer_ctx = tmp1;
+        tmp1 = CURRENT_CONTEXT(interp);
+        while (!PMC_IS_NULL(tmp1)) {
+            if (Parrot_pcc_get_sub(interp, tmp1) == outer) {
+                sub->outer_ctx = tmp1;
+                break;
+            }
+            tmp1 = Parrot_pcc_get_caller_ctx(interp, tmp1);
+        }
     }
 
     METHOD get_multisig() {


More information about the parrot-commits mailing list