MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxRunEval

Function fxRunEval

xs/sources/xsRun.c:4606–4644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4604}
4605
4606void fxRunEval(txMachine* the)
4607{
4608 txStringStream aStream;
4609 txUnsigned flags;
4610 txSlot* function;
4611 txSlot* home;
4612 txSlot* closures;
4613 if (the->stack->value.integer == 0)
4614 the->stack->kind = XS_UNDEFINED_KIND;
4615 else
4616 the->stack += the->stack->value.integer;
4617 the->stack[4] = the->stack[0];
4618 the->stack += 4;
4619 if ((the->stack->kind == XS_STRING_KIND) || (the->stack->kind == XS_STRING_X_KIND)) {
4620 aStream.slot = the->stack;
4621 aStream.offset = 0;
4622 aStream.size = mxStringLength(fxToString(the, aStream.slot));
4623 flags = mxProgramFlag | mxEvalFlag;
4624 if (the->frame->flag & XS_STRICT_FLAG)
4625 flags |= mxStrictFlag;
4626 if (the->frame->flag & XS_FIELD_FLAG)
4627 flags |= mxFieldFlag;
4628 function = mxFunction->value.reference;
4629 if (function->flag & XS_CAN_CONSTRUCT_FLAG)
4630 flags |= mxTargetFlag;
4631 home = mxFunctionInstanceHome(function);
4632 if (home->value.home.object)
4633 flags |= mxSuperFlag;
4634 closures = mxFrameToEnvironment(the->frame);
4635 if (closures->kind == XS_REFERENCE_KIND)
4636 closures = closures->value.reference;
4637 else
4638 closures = C_NULL;
4639 fxRunScript(the, fxParseScript(the, &aStream, fxStringGetter, flags), mxThis, mxHasTarget ? mxTarget : C_NULL, closures, home->value.home.object, home->value.home.module);
4640 aStream.slot->kind = the->stack->kind;
4641 aStream.slot->value = the->stack->value;
4642 mxPop();
4643 }
4644}
4645
4646void fxRunForAwaitOf(txMachine* the)
4647{

Callers

nothing calls this directly

Calls 3

fxToStringFunction · 0.85
fxRunScriptFunction · 0.85
fxParseScriptFunction · 0.70

Tested by

no test coverage detected