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

Function fxBinding

xs/sources/xsSyntaxical.c:3472–3506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3470}
3471
3472void fxBinding(txParser* parser, txToken theToken, txUnsigned flags)
3473{
3474 txInteger aLine = parser->states[0].line;
3475 fxCheckParserStack(parser, aLine);
3476 if (parser->states[0].token == XS_TOKEN_IDENTIFIER) {
3477 fxCheckStrictSymbol(parser, parser->states[0].symbol);
3478 if (((theToken == XS_TOKEN_CONST) || (theToken == XS_TOKEN_LET) || (theToken == XS_TOKEN_USING)) && (parser->states[0].symbol == parser->letSymbol))
3479 fxReportParserError(parser, parser->states[0].line, "invalid identifier");
3480 fxPushSymbol(parser, parser->states[0].symbol);
3481 fxPushNodeStruct(parser, 1, theToken, aLine);
3482 if (flags & mxAwaitingFlag)
3483 parser->root->flags |= mxAwaitingFlag;
3484 fxGetNextToken(parser);
3485 }
3486 else if (parser->states[0].token == XS_TOKEN_LEFT_BRACE) {
3487 if (theToken == XS_TOKEN_USING)
3488 fxReportParserError(parser, parser->states[0].line, "invalid using");
3489 fxObjectBinding(parser, theToken);
3490 }
3491 else if (parser->states[0].token == XS_TOKEN_LEFT_BRACKET) {
3492 if (theToken == XS_TOKEN_USING)
3493 fxReportParserError(parser, parser->states[0].line, "invalid using");
3494 fxArrayBinding(parser, theToken);
3495 }
3496 else {
3497 fxReportParserError(parser, parser->states[0].line, "missing identifier");
3498 fxPushNULL(parser);
3499 }
3500 if ((flags & 1) && (parser->states[0].token == XS_TOKEN_ASSIGN)) {
3501 parser->flags &= ~mxForFlag;
3502 fxGetNextToken(parser);
3503 fxAssignmentExpression(parser);
3504 fxPushNodeStruct(parser, 2, XS_TOKEN_BINDING, aLine);
3505 }
3506}
3507
3508txNode* fxBindingFromExpression(txParser* parser, txNode* theNode, txToken theToken)
3509{

Callers 6

fxTryStatementFunction · 0.85
fxVariableStatementFunction · 0.85
fxArrayBindingFunction · 0.85
fxObjectBindingFunction · 0.85
fxParametersBindingFunction · 0.85
fxRestBindingFunction · 0.85

Calls 10

fxCheckParserStackFunction · 0.85
fxCheckStrictSymbolFunction · 0.85
fxReportParserErrorFunction · 0.85
fxPushSymbolFunction · 0.85
fxPushNodeStructFunction · 0.85
fxGetNextTokenFunction · 0.85
fxObjectBindingFunction · 0.85
fxArrayBindingFunction · 0.85
fxPushNULLFunction · 0.85
fxAssignmentExpressionFunction · 0.85

Tested by

no test coverage detected