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

Function fxRestBindingFromExpression

xs/sources/xsSyntaxical.c:3900–3931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3898}
3899
3900txNode* fxRestBindingFromExpression(txParser* parser, txNode* theNode, txToken theToken, txUnsigned flag)
3901{
3902 txNode* expression = ((txSpreadNode*)theNode)->expression;
3903 txNode* binding;
3904 if (theNode->next) {
3905 parser->errorSymbol = parser->SyntaxErrorSymbol;
3906 return NULL;
3907 }
3908 if (!expression)
3909 return NULL;
3910/* if ((theToken == XS_TOKEN_BINDING) && ((expression->description->token == XS_TOKEN_MEMBER) || (expression->description->token == XS_TOKEN_MEMBER_AT)))
3911 binding = expression;
3912 else */
3913 {
3914 binding = fxBindingFromExpression(parser, expression, theToken);
3915 if (!binding) {
3916 parser->errorSymbol = parser->SyntaxErrorSymbol;
3917 return NULL;
3918 }
3919 if (binding->description->token == XS_TOKEN_BINDING) {
3920 fxReportParserError(parser, parser->states[0].line, "invalid rest");
3921 return NULL;
3922 }
3923 if (flag && ((binding->description->token == XS_TOKEN_ARRAY_BINDING) || (binding->description->token == XS_TOKEN_OBJECT_BINDING))) {
3924 fxReportParserError(parser, parser->states[0].line, "invalid rest");
3925 return NULL;
3926 }
3927 }
3928 theNode->description = &gxTokenDescriptions[XS_TOKEN_REST_BINDING];
3929 ((txRestBindingNode*)theNode)->binding = binding;
3930 return theNode;
3931}
3932
3933void fxCheckArrowFunction(txParser* parser, txInteger count)
3934{

Calls 2

fxBindingFromExpressionFunction · 0.85
fxReportParserErrorFunction · 0.85

Tested by

no test coverage detected