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

Function fxParamsBindingNodeBind

xs/sources/xsScope.c:1232–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1230}
1231
1232void fxParamsBindingNodeBind(void* it, void* param)
1233{
1234 txParamsBindingNode* self = it;
1235 txBinder* binder = param;
1236 txScope* functionScope = binder->scope;
1237 txFunctionNode* functionNode = (txFunctionNode*)(functionScope->node);
1238 txInteger count = self->items->length;
1239 if (functionNode->flags & mxGetterFlag) {
1240 if (count != 0)
1241 fxReportParserError(binder->parser, self->line, "invalid getter arguments");
1242 }
1243 else if (functionNode->flags & mxSetterFlag) {
1244 if ((count != 1) || (self->items->first->description->token == XS_TOKEN_REST_BINDING))
1245 fxReportParserError(binder->parser, self->line, "invalid setter arguments");
1246 }
1247 else {
1248 if (count > 255)
1249 fxReportParserError(binder->parser, self->line, "too many arguments");
1250 }
1251 if (functionNode->flags & mxArgumentsFlag) {
1252 txNode* item;
1253 self->declaration = fxScopeGetDeclareNode(functionScope, binder->parser->argumentsSymbol);
1254 if (functionNode->flags & mxStrictFlag)
1255 goto bail;
1256 item = self->items->first;
1257 while (item) {
1258 if (item->description->token != XS_TOKEN_ARG)
1259 goto bail;
1260 item = item->next;
1261 }
1262 item = self->items->first;
1263 while (item) {
1264 ((txDeclareNode*)item)->flags |= mxDeclareNodeClosureFlag;
1265 item = item->next;
1266 }
1267 self->mapped = 1;
1268 }
1269bail:
1270 fxNodeListDistribute(self->items, fxNodeDispatchBind, param);
1271}
1272
1273void fxPostfixExpressionNodeBind(void* it, void* param)
1274{

Callers

nothing calls this directly

Calls 3

fxReportParserErrorFunction · 0.85
fxScopeGetDeclareNodeFunction · 0.85
fxNodeListDistributeFunction · 0.85

Tested by

no test coverage detected