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

Function fxBindingFromExpression

xs/sources/xsSyntaxical.c:3508–3601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3506}
3507
3508txNode* fxBindingFromExpression(txParser* parser, txNode* theNode, txToken theToken)
3509{
3510 txToken aToken = (theNode && theNode->description) ? theNode->description->token : XS_NO_TOKEN;
3511 txNode* binding;
3512again:
3513 if (aToken == XS_TOKEN_EXPRESSIONS) {
3514 txNode* item = ((txExpressionsNode*)theNode)->items->first;
3515 if (item && !item->next) {
3516 aToken = item->description->token;
3517 if ((aToken == XS_TOKEN_ACCESS) || (aToken == XS_TOKEN_MEMBER) || (aToken == XS_TOKEN_MEMBER_AT) || (aToken == XS_TOKEN_PRIVATE_MEMBER) || (aToken == XS_TOKEN_UNDEFINED)) {
3518 item->next = theNode->next;
3519 theNode = item;
3520 }
3521 else if (aToken == XS_TOKEN_EXPRESSIONS) {
3522 item->next = theNode->next;
3523 theNode = item;
3524 goto again;
3525 }
3526 else
3527 return NULL;
3528 }
3529 }
3530 if (aToken == XS_TOKEN_BINDING) {
3531 binding = fxBindingFromExpression(parser, ((txBindingNode*)theNode)->target, theToken);
3532 ((txBindingNode*)theNode)->target = binding;
3533// fxCheckStrictBinding(parser, theNode);
3534// fxCheckStrictSymbol(parser, ((txBindingNode*)theNode)->symbol);
3535// theNode->description = &gxTokenDescriptions[theToken];
3536 return theNode;
3537 }
3538 if (aToken == XS_TOKEN_ARRAY_BINDING) {
3539 txNodeList* list = ((txArrayBindingNode*)theNode)->items;
3540 txNode** address = &(list->first);
3541 txNode* item;
3542 while ((item = *address)) {
3543 txNode* binding = *address = fxBindingFromExpression(parser, item, theToken);
3544 binding->next = item->next;
3545 address = &(binding->next);
3546 }
3547 return theNode;
3548 }
3549 if (aToken == XS_TOKEN_OBJECT_BINDING) {
3550 txNodeList* list = ((txObjectBindingNode*)theNode)->items;
3551 txNode** address = &(list->first);
3552 txNode* item;
3553 while ((item = *address)) {
3554 txNode* binding = *address = fxBindingFromExpression(parser, item, theToken);
3555 binding->next = item->next;
3556 address = &(binding->next);
3557 }
3558 return theNode;
3559 }
3560 if (aToken == XS_TOKEN_PROPERTY_BINDING) {
3561 ((txPropertyBindingNode*)theNode)->binding = fxBindingFromExpression(parser, ((txPropertyBindingNode*)theNode)->binding, theToken);
3562 return theNode;
3563 }
3564 if (aToken == XS_TOKEN_PROPERTY_BINDING_AT) {
3565 ((txPropertyBindingAtNode*)theNode)->binding = fxBindingFromExpression(parser, ((txPropertyBindingAtNode*)theNode)->binding, theToken);

Calls 6

fxCheckStrictSymbolFunction · 0.85
fxPushSymbolFunction · 0.85
fxPushNodeStructFunction · 0.85
fxPopNodeFunction · 0.85

Tested by

no test coverage detected