| 612 | } |
| 613 | |
| 614 | void fxDefineNodeHoist(void* it, void* param) |
| 615 | { |
| 616 | txDefineNode* self = it; |
| 617 | txHoister* hoister = param; |
| 618 | txDeclareNode* node; |
| 619 | if (self->flags & mxStrictFlag) { |
| 620 | if ((self->symbol == hoister->parser->argumentsSymbol) || (self->symbol == hoister->parser->evalSymbol) || (self->symbol == hoister->parser->yieldSymbol)) |
| 621 | fxReportParserError(hoister->parser, self->line, "invalid definition %s", self->symbol->string); |
| 622 | } |
| 623 | if ((hoister->scope == hoister->bodyScope) && (hoister->scope->token != XS_TOKEN_MODULE)) { |
| 624 | node = fxScopeGetDeclareNode(hoister->bodyScope, self->symbol); |
| 625 | if (node) { |
| 626 | if ((node->description->token == XS_TOKEN_CONST) || (node->description->token == XS_TOKEN_LET)) |
| 627 | fxReportParserError(hoister->parser, self->line, "duplicate variable %s", self->symbol->string); |
| 628 | } |
| 629 | else { |
| 630 | if (hoister->functionScope != hoister->bodyScope) |
| 631 | node = fxScopeGetDeclareNode(hoister->functionScope, self->symbol); |
| 632 | if (!node) |
| 633 | fxScopeAddDeclareNode(hoister->bodyScope, (txDeclareNode*)self); |
| 634 | } |
| 635 | fxScopeAddDefineNode(hoister->bodyScope, self); |
| 636 | } |
| 637 | else { |
| 638 | node = fxScopeGetDeclareNode(hoister->scope, self->symbol); |
| 639 | if (node) |
| 640 | fxReportParserError(hoister->parser, self->line, "duplicate variable %s", self->symbol->string); |
| 641 | else |
| 642 | fxScopeAddDeclareNode(hoister->scope, (txDeclareNode*)self); |
| 643 | fxScopeAddDefineNode(hoister->scope, self); |
| 644 | } |
| 645 | ((txFunctionNode*)(self->initializer))->symbol = C_NULL; |
| 646 | fxNodeDispatchHoist(self->initializer, param); |
| 647 | ((txFunctionNode*)(self->initializer))->symbol = self->symbol; |
| 648 | } |
| 649 | |
| 650 | void fxExportNodeHoist(void* it, void* param) |
| 651 | { |
nothing calls this directly
no test coverage detected