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

Function fxFunctionExpression

xs/sources/xsSyntaxical.c:2907–2953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2905}
2906
2907void fxFunctionExpression(txParser* parser, txInteger theLine, txSymbol** theSymbol, txUnsigned flag)
2908{
2909 txUnsigned flags = parser->flags;
2910 parser->flags = (flags & (mxParserFlags | mxStrictFlag)) | mxFunctionFlag | mxTargetFlag | flag;
2911 if ((parser->states[0].token == XS_TOKEN_IDENTIFIER)
2912 || ((flags & mxGeneratorFlag) && !(flags & mxStrictFlag) && (parser->states[0].token == XS_TOKEN_YIELD))
2913 || ((theSymbol == C_NULL) && (parser->states[0].token == XS_TOKEN_AWAIT))) {
2914 fxPushSymbol(parser, parser->states[0].symbol);
2915 if (theSymbol)
2916 *theSymbol = parser->states[0].symbol;
2917 fxCheckStrictSymbol(parser, parser->states[0].symbol);
2918 fxGetNextToken(parser);
2919 }
2920 else
2921 fxPushNULL(parser);
2922 fxParametersBinding(parser);
2923 if (parser->states[0].token == XS_TOKEN_HOST) {
2924 fxGetNextToken(parser);
2925 if (parser->states[0].token == XS_TOKEN_STRING) {
2926 fxPushStringNode(parser, parser->states[0].stringLength, parser->states[0].string, theLine);
2927 fxGetNextToken(parser);
2928 }
2929 else {
2930 fxReportParserError(parser, parser->states[0].line, "invalid host function");
2931 fxPushNULL(parser);
2932 }
2933 fxPushNodeStruct(parser, 3, XS_TOKEN_HOST, theLine);
2934 parser->root->flags = parser->flags & (mxStrictFlag | mxNotSimpleParametersFlag | mxTargetFlag | mxArgumentsFlag | mxEvalFlag | flag);
2935 if (!(flags & mxStrictFlag) && (parser->flags & mxStrictFlag))
2936 fxCheckStrictFunction(parser, (txFunctionNode*)parser->root);
2937 parser->flags = flags;
2938 }
2939 else {
2940 fxMatchToken(parser, XS_TOKEN_LEFT_BRACE);
2941 fxBody(parser);
2942 fxPushNodeStruct(parser, 1, XS_TOKEN_BODY, theLine);
2943 fxPushNodeStruct(parser, 3, XS_TOKEN_FUNCTION, theLine);
2944 parser->root->flags = parser->flags & (mxStrictFlag | mxNotSimpleParametersFlag | mxTargetFlag | mxArgumentsFlag | mxEvalFlag | flag);
2945 if (!(flags & mxStrictFlag) && (parser->flags & mxStrictFlag))
2946 fxCheckStrictFunction(parser, (txFunctionNode*)parser->root);
2947 if (parser->flags & mxNativeFlag) {
2948 fxCheckNativeFunction(parser);
2949 }
2950 parser->flags = flags;
2951 fxMatchToken(parser, XS_TOKEN_RIGHT_BRACE);
2952 }
2953}
2954
2955void fxGeneratorExpression(txParser* parser, txInteger theLine, txSymbol** theSymbol, txUnsigned flag)
2956{

Callers 5

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

Calls 12

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

Tested by

no test coverage detected