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

Function fxCheckReference

xs/sources/xsSyntaxical.c:4070–4121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4068}
4069
4070txBoolean fxCheckReference(txParser* parser, txToken theToken)
4071{
4072 txNode* node = parser->root;
4073 txToken aToken = (node && node->description) ? node->description->token : XS_NO_TOKEN;
4074 if (aToken == XS_TOKEN_EXPRESSIONS) {
4075 txNode* item;
4076 again:
4077 item = ((txExpressionsNode*)node)->items->first;
4078 if (item && !item->next) {
4079 aToken = (item->description) ? item->description->token : XS_NO_TOKEN;
4080 if ((aToken == XS_TOKEN_ACCESS) || (aToken == XS_TOKEN_MEMBER) || (aToken == XS_TOKEN_MEMBER_AT) || (aToken == XS_TOKEN_PRIVATE_MEMBER) || (aToken == XS_TOKEN_UNDEFINED)) {
4081 item->next = node->next;
4082 node = parser->root = item;
4083 }
4084 else if (aToken == XS_TOKEN_EXPRESSIONS) {
4085 item->next = node->next;
4086 node = item;
4087 goto again;
4088 }
4089 else
4090 aToken = XS_TOKEN_EXPRESSIONS;
4091 }
4092 }
4093 if (aToken == XS_TOKEN_ACCESS) {
4094 fxCheckStrictSymbol(parser, ((txAccessNode*)node)->symbol);
4095 return 1;
4096 }
4097 if ((aToken == XS_TOKEN_MEMBER) || (aToken == XS_TOKEN_MEMBER_AT) || (aToken == XS_TOKEN_PRIVATE_MEMBER) || (aToken == XS_TOKEN_UNDEFINED))
4098 return 1;
4099
4100 if (theToken == XS_TOKEN_ASSIGN) {
4101 if (aToken == XS_TOKEN_ARRAY) {
4102 txNode* binding = fxArrayBindingFromExpression(parser, node, XS_TOKEN_ACCESS);
4103 if (binding) {
4104 binding->next = node->next;
4105 parser->root = binding;
4106 return 1;
4107 }
4108 }
4109 else if (aToken == XS_TOKEN_OBJECT) {
4110 txNode* binding = fxObjectBindingFromExpression(parser, node, XS_TOKEN_ACCESS);
4111 if (binding) {
4112 binding->next = node->next;
4113 parser->root = binding;
4114 return 1;
4115 }
4116 }
4117 }
4118 else if (theToken == XS_TOKEN_DELETE)
4119 return 1;
4120 return 0;
4121}
4122
4123void fxCheckStrictBinding(txParser* parser, txNode* node)
4124{

Callers 5

xsSyntaxical.cFile · 0.85
fxAssignmentExpressionFunction · 0.85
fxUnaryExpressionFunction · 0.85
fxPrefixExpressionFunction · 0.85
fxPostfixExpressionFunction · 0.85

Calls 3

fxCheckStrictSymbolFunction · 0.85

Tested by

no test coverage detected