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

Function fxNewAsyncGeneratorInstance

xs/sources/xsGenerator.c:1796–1856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1794}
1795
1796txSlot* fxNewAsyncGeneratorInstance(txMachine* the)
1797{
1798 txSlot* prototype;
1799 txSlot* instance;
1800 txSlot* property;
1801 txSlot* function;
1802 txSlot* home;
1803
1804 prototype = (the->stack->kind == XS_REFERENCE_KIND) ? the->stack->value.reference : mxAsyncGeneratorPrototype.value.reference;
1805
1806 instance = fxNewSlot(the);
1807 instance->kind = XS_INSTANCE_KIND;
1808 instance->value.instance.garbage = C_NULL;
1809 instance->value.instance.prototype = prototype;
1810 the->stack->value.reference = instance;
1811 the->stack->kind = XS_REFERENCE_KIND;
1812
1813 property = instance->next = fxNewSlot(the);
1814 property->flag = XS_INTERNAL_FLAG;
1815 property->kind = XS_STACK_KIND;
1816 property->ID = XS_NO_ID;
1817 property->value.stack.length = 0;
1818 property->value.stack.address = C_NULL;
1819
1820 property = property->next = fxNewSlot(the);
1821 property->flag = XS_INTERNAL_FLAG;
1822 property->kind = XS_INTEGER_KIND;
1823 property->value.integer = XS_CODE_START_ASYNC_GENERATOR;
1824
1825 property = property->next = fxNewSlot(the);
1826 property->flag = XS_INTERNAL_FLAG;
1827 property->kind = XS_LIST_KIND;
1828 property->value.list.first = C_NULL;
1829 property->value.list.last = C_NULL;
1830
1831 function = fxNewHostFunction(the, fxAsyncGeneratorResolveAwait, 1, XS_NO_ID, mxAsyncGeneratorResolveAwaitProfileID);
1832 home = mxFunctionInstanceHome(function);
1833 home->value.home.object = instance;
1834 property = fxNextSlotProperty(the, property, the->stack, XS_NO_ID, XS_INTERNAL_FLAG);
1835 mxPop();
1836
1837 function = fxNewHostFunction(the, fxAsyncGeneratorRejectAwait, 1, XS_NO_ID, mxAsyncGeneratorRejectAwaitProfileID);
1838 home = mxFunctionInstanceHome(function);
1839 home->value.home.object = instance;
1840 property = fxNextSlotProperty(the, property, the->stack, XS_NO_ID, XS_INTERNAL_FLAG);
1841 mxPop();
1842
1843 function = fxNewHostFunction(the, fxAsyncGeneratorResolveYield, 1, XS_NO_ID, mxAsyncGeneratorResolveYieldProfileID);
1844 home = mxFunctionInstanceHome(function);
1845 home->value.home.object = instance;
1846 property = fxNextSlotProperty(the, property, the->stack, XS_NO_ID, XS_INTERNAL_FLAG);
1847 mxPop();
1848
1849 function = fxNewHostFunction(the, fxAsyncGeneratorRejectYield, 1, XS_NO_ID, mxAsyncGeneratorRejectYieldProfileID);
1850 home = mxFunctionInstanceHome(function);
1851 home->value.home.object = instance;
1852 property = fxNextSlotProperty(the, property, the->stack, XS_NO_ID, XS_INTERNAL_FLAG);
1853 mxPop();

Callers

nothing calls this directly

Calls 3

fxNewSlotFunction · 0.85
fxNewHostFunctionFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected