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

Function fx_eval

xs/sources/xsGlobal.c:325–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325void fx_eval(txMachine* the)
326{
327 txStringStream aStream;
328 txSlot* realm;
329 txSlot* module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module;
330 if (!module) module = mxProgram.value.reference;
331
332 realm = mxModuleInstanceInternal(module)->value.module.realm;
333 if (mxArgc < 1)
334 return;
335 if (!mxIsStringPrimitive(mxArgv(0))) {
336 *mxResult = *mxArgv(0);
337 return;
338 }
339 aStream.slot = mxArgv(0);
340 aStream.offset = 0;
341 aStream.size = mxStringLength(fxToString(the, mxArgv(0)));
342 fxRunScript(the, fxParseScript(the, &aStream, fxStringGetter, mxProgramFlag | mxEvalFlag), mxRealmGlobal(realm), C_NULL, mxRealmClosures(realm)->value.reference, C_NULL, module);
343 mxPullSlot(mxResult);
344}
345
346void fx_Native(txMachine* the)
347{

Callers

nothing calls this directly

Calls 3

fxToStringFunction · 0.85
fxRunScriptFunction · 0.85
fxParseScriptFunction · 0.70

Tested by

no test coverage detected