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

Function fxObjectBindingFromExpression

xs/sources/xsSyntaxical.c:3785–3829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3783}
3784
3785txNode* fxObjectBindingFromExpression(txParser* parser, txNode* theNode, txToken theToken)
3786{
3787 txNodeList* list = ((txObjectNode*)theNode)->items;
3788 txNode* property = list->first;
3789 txNode* binding;
3790 txUnsigned flags = 0;
3791 while (property) {
3792 if (!property->description) {
3793 parser->errorSymbol = parser->SyntaxErrorSymbol;
3794 return NULL;
3795 }
3796 if (property->description->token == XS_TOKEN_PROPERTY) {
3797 binding = fxBindingFromExpression(parser, ((txPropertyNode*)property)->value, theToken);
3798 if (!binding) {
3799 parser->errorSymbol = parser->SyntaxErrorSymbol;
3800 return NULL;
3801 }
3802 property->description = &gxTokenDescriptions[XS_TOKEN_PROPERTY_BINDING];
3803 ((txPropertyBindingNode*)property)->binding = binding;
3804 }
3805 else if (property->description->token == XS_TOKEN_PROPERTY_AT) {
3806 binding = fxBindingFromExpression(parser, ((txPropertyAtNode*)property)->value, theToken);
3807 if (!binding) {
3808 parser->errorSymbol = parser->SyntaxErrorSymbol;
3809 return NULL;
3810 }
3811 property->description = &gxTokenDescriptions[XS_TOKEN_PROPERTY_BINDING_AT];
3812 ((txPropertyBindingAtNode*)property)->binding = binding;
3813 }
3814 else if (property->description->token == XS_TOKEN_SPREAD) {
3815 binding = fxRestBindingFromExpression(parser, property, theToken, 1);
3816 if (!binding) {
3817 parser->errorSymbol = parser->SyntaxErrorSymbol;
3818 return NULL;
3819 }
3820 flags |= mxSpreadFlag;
3821 break;
3822 }
3823 property = property->next;
3824 }
3825 fxPushNode(parser, (txNode*)list);
3826 fxPushNodeStruct(parser, 1, XS_TOKEN_OBJECT_BINDING, theNode->line);
3827 parser->root->flags |= flags;
3828 return fxPopNode(parser);
3829}
3830
3831void fxParametersBinding(txParser* parser)
3832{

Callers 2

fxBindingFromExpressionFunction · 0.85
fxCheckReferenceFunction · 0.85

Calls 5

fxBindingFromExpressionFunction · 0.85
fxPushNodeFunction · 0.85
fxPushNodeStructFunction · 0.85
fxPopNodeFunction · 0.85

Tested by

no test coverage detected