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

Function fx_AsyncGeneratorFunction

xs/sources/xsGenerator.c:1954–1989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1952}
1953
1954void fx_AsyncGeneratorFunction(txMachine* the)
1955{
1956 txInteger c, i;
1957 txStringStream stream;
1958 txSlot* module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module;
1959 if (!module) module = mxProgram.value.reference;
1960
1961 c = mxArgc;
1962 i = 0;
1963 mxPushStringX("(async function* anonymous(");
1964 while (c > 1) {
1965 fxToString(the, mxArgv(i));
1966 fxConcatString(the, the->stack, mxArgv(i));
1967 if (c > 2)
1968 fxConcatStringC(the, the->stack, ", ");
1969 c--;
1970 i++;
1971 }
1972 fxConcatStringC(the, the->stack, "\n){");
1973 if (c > 0) {
1974 fxToString(the, mxArgv(i));
1975 fxConcatString(the, the->stack, mxArgv(i));
1976 }
1977 fxConcatStringC(the, the->stack, "\n})");
1978 stream.slot = the->stack;
1979 stream.offset = 0;
1980 stream.size = mxStringLength(the->stack->value.string);
1981 fxRunScript(the, fxParseScript(the, &stream, fxStringGetter, mxProgramFlag | mxGeneratorFlag), C_NULL, C_NULL, C_NULL, C_NULL, module);
1982 mxPullSlot(mxResult);
1983 if (mxHasTarget && !fxIsSameSlot(the, mxTarget, mxFunction)) {
1984 mxPushSlot(mxTarget);
1985 fxGetPrototypeFromConstructor(the, &mxAsyncGeneratorFunctionPrototype);
1986 mxResult->value.reference->value.instance.prototype = the->stack->value.reference;
1987 mxPop();
1988 }
1989}
1990
1991void fxAsyncFromSyncIteratorDone(txMachine* the)
1992{

Callers

nothing calls this directly

Calls 7

fxToStringFunction · 0.85
fxConcatStringFunction · 0.85
fxConcatStringCFunction · 0.85
fxRunScriptFunction · 0.85
fxIsSameSlotFunction · 0.85
fxParseScriptFunction · 0.70

Tested by

no test coverage detected