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

Function fxCheckNativeConstructor

xs/sources/xsSyntaxical.c:3952–3987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3950}
3951
3952void fxCheckNativeConstructor(txParser* parser)
3953{
3954 txClassNode* root = (txClassNode*)(parser->root);
3955 if (root->description != &gxTokenDescriptions[XS_TOKEN_CLASS])
3956 return;
3957 if (root->symbol != C_NULL)
3958 return;
3959 txHostNode* host = (txHostNode*)(root->heritage);
3960 if (host == C_NULL)
3961 return;
3962 if (host->description != &gxTokenDescriptions[XS_TOKEN_HOST])
3963 return;
3964 if (root->constructorInit != C_NULL)
3965 return;
3966 if (root->instanceInit != C_NULL)
3967 return;
3968 txFunctionNode* constructor = (txFunctionNode*)(root->constructor);
3969 if (constructor->description != &gxTokenDescriptions[XS_TOKEN_FUNCTION])
3970 return;
3971 txParamsBindingNode* args = (txParamsBindingNode*)(constructor->params);
3972 if (args->description != &gxTokenDescriptions[XS_TOKEN_PARAMS_BINDING])
3973 return;
3974 if (args->items->length != 0)
3975 return;
3976 txBodyNode* body = (txBodyNode*)(constructor->body);
3977 if (body->description != &gxTokenDescriptions[XS_TOKEN_BODY])
3978 return;
3979 txStatementNode* statement = (txStatementNode*)(body->statement);
3980 if (statement->description != &gxTokenDescriptions[XS_TOKEN_STATEMENT])
3981 return;
3982 txNode* undefined = (txNode*)(statement->expression);
3983 if (undefined->description != &gxTokenDescriptions[XS_TOKEN_UNDEFINED])
3984 return;
3985 fxPopNode(parser);
3986 fxPushNode(parser, (txNode*)host);
3987}
3988
3989void fxCheckNativeFunction(txParser* parser)
3990{

Callers 1

fxClassExpressionFunction · 0.85

Calls 2

fxPopNodeFunction · 0.85
fxPushNodeFunction · 0.85

Tested by

no test coverage detected