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

Function fxGeneratorExpression

xs/sources/xsSyntaxical.c:2955–2985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2953}
2954
2955void fxGeneratorExpression(txParser* parser, txInteger theLine, txSymbol** theSymbol, txUnsigned flag)
2956{
2957 txUnsigned flags = parser->flags;
2958 parser->flags = (flags & (mxParserFlags | mxStrictFlag)) | mxGeneratorFlag | mxTargetFlag | flag;
2959 if ((parser->states[0].token == XS_TOKEN_IDENTIFIER)
2960 || ((theSymbol == C_NULL) && (parser->states[0].token == XS_TOKEN_AWAIT))) {
2961 fxPushSymbol(parser, parser->states[0].symbol);
2962 if (theSymbol)
2963 *theSymbol = parser->states[0].symbol;
2964 else if (parser->states[0].symbol == parser->yieldSymbol)
2965 fxReportParserError(parser, parser->states[0].line, "invalid yield");
2966 else if ((parser->flags & mxAsyncFlag) && (parser->states[0].symbol == parser->awaitSymbol))
2967 fxReportParserError(parser, parser->states[0].line, "invalid await");
2968 fxCheckStrictSymbol(parser, parser->states[0].symbol);
2969 fxGetNextToken(parser);
2970 }
2971 else
2972 fxPushNULL(parser);
2973 fxParametersBinding(parser);
2974 fxMatchToken(parser, XS_TOKEN_LEFT_BRACE);
2975 parser->flags |= mxYieldFlag;
2976 fxBody(parser);
2977 parser->flags &= ~mxYieldFlag;
2978 fxPushNodeStruct(parser, 1, XS_TOKEN_BODY, theLine);
2979 fxPushNodeStruct(parser, 3, XS_TOKEN_GENERATOR, theLine);
2980 parser->root->flags = parser->flags & (mxStrictFlag | mxNotSimpleParametersFlag | mxGeneratorFlag | mxArgumentsFlag | mxEvalFlag | flag);
2981 if (!(flags & mxStrictFlag) && (parser->flags & mxStrictFlag))
2982 fxCheckStrictFunction(parser, (txFunctionNode*)parser->root);
2983 parser->flags = flags;
2984 fxMatchToken(parser, XS_TOKEN_RIGHT_BRACE);
2985}
2986
2987void fxGroupExpression(txParser* parser, txUnsigned flag)
2988{

Callers 5

fxExportDeclarationFunction · 0.85
fxStatementFunction · 0.85
fxLiteralExpressionFunction · 0.85
fxClassExpressionFunction · 0.85
fxObjectExpressionFunction · 0.85

Calls 10

fxPushSymbolFunction · 0.85
fxReportParserErrorFunction · 0.85
fxCheckStrictSymbolFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushNULLFunction · 0.85
fxParametersBindingFunction · 0.85
fxMatchTokenFunction · 0.85
fxBodyFunction · 0.85
fxPushNodeStructFunction · 0.85
fxCheckStrictFunctionFunction · 0.85

Tested by

no test coverage detected