@@ -1355,13 +1355,14 @@ static StackFrame *StackFrameNew(StackFrameType type, bool inherit_previous)
13551355 return frame ;
13561356}
13571357
1358- static StackFrame * StackFrameNewBundle (const Bundle * owner , bool inherit_previous , bool profiling )
1358+ static StackFrame * StackFrameNewBundle (const Bundle * owner , bool inherit_previous , bool profiling , const Bundle * calling_bundle )
13591359{
13601360 StackFrame * frame = StackFrameNew (STACK_FRAME_TYPE_BUNDLE , inherit_previous );
13611361
13621362 frame -> data .bundle .owner = owner ;
13631363 frame -> data .bundle .classes = ClassTableNew ();
13641364 frame -> data .bundle .vars = VariableTableNew ();
1365+ frame -> data .bundle .calling_bundle = calling_bundle ;
13651366 frame -> event = (profiling ) ? BundleToEventFrame (owner ) : NULL ;
13661367
13671368 return frame ;
@@ -1438,12 +1439,12 @@ static void EvalContextStackPushFrame(EvalContext *ctx, StackFrame *frame)
14381439 STACK_FRAME_TYPE_STR [frame -> type ]);
14391440}
14401441
1441- void EvalContextStackPushBundleFrame (EvalContext * ctx , const Bundle * owner , const Rlist * args , bool inherits_previous )
1442+ void EvalContextStackPushBundleFrame (EvalContext * ctx , const Bundle * owner , const Rlist * args , bool inherits_previous , const Bundle * calling_bundle )
14421443{
14431444 assert (ctx != NULL );
14441445 assert (!LastStackFrame (ctx , 0 ) || LastStackFrame (ctx , 0 )-> type == STACK_FRAME_TYPE_PROMISE_ITERATION );
14451446
1446- EvalContextStackPushFrame (ctx , StackFrameNewBundle (owner , inherits_previous , ctx -> profiling ));
1447+ EvalContextStackPushFrame (ctx , StackFrameNewBundle (owner , inherits_previous , ctx -> profiling , calling_bundle ));
14471448
14481449 if (RlistLen (args ) > 0 )
14491450 {
@@ -1566,9 +1567,11 @@ void EvalContextStackPushPromiseFrame(EvalContext *ctx, const Promise *owner)
15661567
15671568 EvalContextVariablePutSpecial (ctx , SPECIAL_SCOPE_THIS , "bundle" , PromiseGetBundle (owner )-> name , CF_DATA_TYPE_STRING , "source=promise" );
15681569 EvalContextVariablePutSpecial (ctx , SPECIAL_SCOPE_THIS , "namespace" , PromiseGetNamespace (owner ), CF_DATA_TYPE_STRING , "source=promise" );
1569- if (PromiseGetBundle (owner )-> calling_bundle != NULL )
1570+
1571+ StackFrame * bundle_frame = LastStackFrameByType (ctx , STACK_FRAME_TYPE_BUNDLE );
1572+ if (bundle_frame -> data .bundle .calling_bundle != NULL )
15701573 {
1571- char * calling_bundle_name = StringFormat ("%s:%s" , PromiseGetBundle ( owner ) -> calling_bundle -> ns , PromiseGetBundle ( owner ) -> calling_bundle -> name );
1574+ char * calling_bundle_name = StringFormat ("%s:%s" ,bundle_frame -> data . bundle . calling_bundle -> ns , bundle_frame -> data . bundle . calling_bundle -> name );
15721575 EvalContextVariablePutSpecial (ctx , SPECIAL_SCOPE_THIS , "calling_bundle" , calling_bundle_name , CF_DATA_TYPE_STRING , "source=promise" );
15731576 free (calling_bundle_name );
15741577 }
0 commit comments