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

Function fx_WeakRef

xs/sources/xsMapSet.c:1806–1823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1804}
1805
1806void fx_WeakRef(txMachine* the)
1807{
1808 txSlot* target;
1809 txSlot* instance;
1810 if (!mxHasTarget)
1811 mxTypeError("call: WeakRef");
1812 if (mxArgc < 1)
1813 mxTypeError("no target");
1814 target = fxCanBeHeldWeakly(the, mxArgv(0));
1815 if (!target)
1816 mxTypeError("target: not an object");
1817 mxPushSlot(mxTarget);
1818 fxGetPrototypeFromConstructor(the, &mxWeakRefPrototype);
1819 instance = fxNewWeakRefInstance(the);
1820 mxPullSlot(mxResult);
1821 fxKeepDuringJobs(the, target);
1822 instance->next->value.weakRef.target = target;
1823}
1824
1825void fx_WeakRef_prototype_deref(txMachine* the)
1826{

Callers

nothing calls this directly

Calls 4

fxCanBeHeldWeaklyFunction · 0.85
fxNewWeakRefInstanceFunction · 0.85
fxKeepDuringJobsFunction · 0.85

Tested by

no test coverage detected