| 3987 | } |
| 3988 | |
| 3989 | void fxCheckNativeFunction(txParser* parser) |
| 3990 | { |
| 3991 | txFunctionNode* function = (txFunctionNode*)(parser->root); |
| 3992 | txBodyNode* body = (txBodyNode*)(function->body); |
| 3993 | if (body->description != &gxTokenDescriptions[XS_TOKEN_BODY]) |
| 3994 | goto bail; |
| 3995 | txStatementNode* statement = (txStatementNode*)(body->statement); |
| 3996 | if ((function->flags & mxDerivedFlag) && (function->flags & mxHostFlag)) { |
| 3997 | txStatementsNode* statements = (txStatementsNode*)(statement); |
| 3998 | if (statements->description != &gxTokenDescriptions[XS_TOKEN_STATEMENTS]) |
| 3999 | goto bail; |
| 4000 | if (statements->items->length != 2) |
| 4001 | goto bail; |
| 4002 | statement = (txStatementNode*)(statements->items->first); |
| 4003 | if (statement->description != &gxTokenDescriptions[XS_TOKEN_STATEMENT]) |
| 4004 | goto bail; |
| 4005 | txSuperNode* super = (txSuperNode*)(statement->expression); |
| 4006 | if (super->description != &gxTokenDescriptions[XS_TOKEN_SUPER]) |
| 4007 | goto bail; |
| 4008 | txParamsNode* params = (txParamsNode*)(super->params); |
| 4009 | if (params->items->length != 0) |
| 4010 | goto bail; |
| 4011 | statement = (txStatementNode*)(statement->next); |
| 4012 | } |
| 4013 | if ((statement->description != &gxTokenDescriptions[XS_TOKEN_RETURN]) && (statement->description != &gxTokenDescriptions[XS_TOKEN_STATEMENT])) |
| 4014 | goto bail; |
| 4015 | txCallNewNode* call = (txCallNewNode*)(statement->expression); |
| 4016 | if (call->description != &gxTokenDescriptions[XS_TOKEN_CALL]) |
| 4017 | goto bail; |
| 4018 | txMemberNode* member = (txMemberNode*)(call->reference); |
| 4019 | if (member->description != &gxTokenDescriptions[XS_TOKEN_MEMBER]) |
| 4020 | goto bail; |
| 4021 | if (member->symbol != parser->callSymbol) |
| 4022 | goto bail; |
| 4023 | txHostNode* host = (txHostNode*)(member->reference); |
| 4024 | if (host->description != &gxTokenDescriptions[XS_TOKEN_HOST]) |
| 4025 | goto bail; |
| 4026 | txParamsNode* params = (txParamsNode*)(call->params); |
| 4027 | if (params->description != &gxTokenDescriptions[XS_TOKEN_PARAMS]) |
| 4028 | goto bail; |
| 4029 | txParamsBindingNode* args = (txParamsBindingNode*)(function->params); |
| 4030 | if (args->description != &gxTokenDescriptions[XS_TOKEN_PARAMS_BINDING]) |
| 4031 | goto bail; |
| 4032 | if (params->items->length != args->items->length + 1) |
| 4033 | goto bail; |
| 4034 | txNode* arg = args->items->first; |
| 4035 | txNode* param = params->items->first; |
| 4036 | if (param->description != &gxTokenDescriptions[XS_TOKEN_THIS]) |
| 4037 | goto bail; |
| 4038 | param = param->next; |
| 4039 | while (arg) { |
| 4040 | txDeclareNode* binding; |
| 4041 | txAccessNode* access; |
| 4042 | if (arg->description == &gxTokenDescriptions[XS_TOKEN_REST_BINDING]) { |
| 4043 | if (param->description != &gxTokenDescriptions[XS_TOKEN_SPREAD]) |
| 4044 | goto bail; |
| 4045 | binding = (txDeclareNode*)(((txRestBindingNode*)arg)->binding); |
| 4046 | access = (txAccessNode*)(((txSpreadNode*)param)->expression); |
no test coverage detected