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

Function fxBody

xs/sources/xsSyntaxical.c:1189–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1187}
1188
1189void fxBody(txParser* parser)
1190{
1191 txInteger count = parser->nodeCount;
1192 txInteger line = parser->states[0].line;
1193 txNode* node;
1194 fxCheckParserStack(parser, line);
1195 while ((parser->states[0].token != XS_TOKEN_EOF) && (parser->states[0].token != XS_TOKEN_RIGHT_BRACE)) {
1196 fxStatement(parser, 1);
1197 node = parser->root;
1198 if (!node || !node->description || (node->description->token != XS_TOKEN_STATEMENT))
1199 break;
1200 node = ((txStatementNode*)node)->expression;
1201 if (!node || !node->description || (node->description->token != XS_TOKEN_STRING))
1202 break;
1203 if (!(node->flags & mxStringEscapeFlag) && (c_strcmp(((txStringNode*)node)->value, "use strict") == 0)) {
1204 if (parser->flags & mxNotSimpleParametersFlag)
1205 fxReportParserError(parser, parser->states[0].line, "invalid directive");
1206 if (!(parser->flags & mxStrictFlag)) {
1207 parser->flags |= mxStrictFlag;
1208 if (parser->states[0].token == XS_TOKEN_IDENTIFIER)
1209 fxCheckStrictKeyword(parser);
1210 }
1211 }
1212 }
1213 while ((parser->states[0].token != XS_TOKEN_EOF) && (parser->states[0].token != XS_TOKEN_RIGHT_BRACE)) {
1214 fxStatement(parser, 1);
1215 }
1216 count = parser->nodeCount - count;
1217 if (count > 1) {
1218 fxPushNodeList(parser, count);
1219 fxPushNodeStruct(parser, 1, XS_TOKEN_STATEMENTS, line);
1220 }
1221 else if (count == 0) {
1222 fxPushNodeStruct(parser, 0, XS_TOKEN_UNDEFINED, line);
1223 fxPushNodeStruct(parser, 1, XS_TOKEN_STATEMENT, line);
1224 }
1225}
1226
1227void fxBlock(txParser* parser)
1228{

Callers 3

fxArrowExpressionFunction · 0.85
fxFunctionExpressionFunction · 0.85
fxGeneratorExpressionFunction · 0.85

Calls 6

fxCheckParserStackFunction · 0.85
fxStatementFunction · 0.85
fxReportParserErrorFunction · 0.85
fxCheckStrictKeywordFunction · 0.85
fxPushNodeListFunction · 0.85
fxPushNodeStructFunction · 0.85

Tested by

no test coverage detected