Author: leo
Date: Mon Nov 14 07:40:02 2005
New Revision: 9971

Modified:
   trunk/classes/sub.pmc
   trunk/src/sub.c
Log:
lexicals 22 - More comments WRT outer_ctx


Modified: trunk/classes/sub.pmc
==============================================================================
--- trunk/classes/sub.pmc       (original)
+++ trunk/classes/sub.pmc       Mon Nov 14 07:40:02 2005
@@ -358,13 +358,19 @@ create_ctx:
             INTERP->current_method = NULL;
         }
         context->current_HLL = sub->HLL_id;
-        /* create pad if needed */
+        /* create pad if needed
+         * TODO move this up in front of argument passing
+         *      and factor out common code with coroutine pmc
+         */
         if (!PMC_IS_NULL(sub->lex_info)) {
             context->lex_pad = pmc_new_init(INTERP,
                     Parrot_get_ctx_HLL_type(interpreter,
                         enum_class_LexPad),
                     sub->lex_info);
             VTABLE_set_pointer(INTERP, context->lex_pad, context);
+            /*
+             * if this isn't a closure, outer is our calloer
+             */
             if (!sub->outer_ctx)
                  sub->outer_ctx = caller_ctx;
         }

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c     (original)
+++ trunk/src/sub.c     Mon Nov 14 07:40:02 2005
@@ -436,6 +436,11 @@ Parrot_find_pad(Interp* interpreter, STR
         lex_pad = ctx->lex_pad;
         if (PMC_IS_NULL(lex_pad))
             return NULL;
+        /*
+         * can't use outer_sub - we need the dynamic context
+         * where registers are, not a possibly different static
+         * instance of the closure
+         */
         sub = ctx->current_sub;
     }
     return NULL;

Reply via email to