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

Function fxFunctionNodeHoist

xs/sources/xsScope.c:715–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715void fxFunctionNodeHoist(void* it, void* param)
716{
717 txFunctionNode* self = it;
718 txHoister* hoister = param;
719 txScope* functionScope = hoister->functionScope;
720 txScope* bodyScope = hoister->bodyScope;
721 hoister->functionScope = self->scope = fxScopeNew(param, it, XS_TOKEN_FUNCTION);
722 hoister->bodyScope = C_NULL;
723 if (self->symbol) {
724 txDefineNode* node = fxDefineNodeNew(hoister->parser, XS_TOKEN_CONST, self->symbol);
725 node->initializer = fxValueNodeNew(hoister->parser, XS_TOKEN_CURRENT);
726 fxScopeAddDeclareNode(hoister->functionScope, (txDeclareNode*)node);
727 fxScopeAddDefineNode(hoister->functionScope, node);
728 }
729 fxNodeDispatchHoist(self->params, param);
730 if ((self->flags & (mxArgumentsFlag | mxEvalFlag)) && !(self->flags & mxArrowFlag)) {
731 txDeclareNode* declaration = fxDeclareNodeNew(hoister->parser, XS_TOKEN_VAR, hoister->parser->argumentsSymbol);
732 fxScopeAddDeclareNode(hoister->functionScope, declaration);
733 }
734 fxNodeDispatchHoist(self->body, param);
735 fxScopeHoisted(self->scope, param);
736 hoister->bodyScope = bodyScope;
737 hoister->functionScope = functionScope;
738}
739
740txHostNode* fxHostNodeClone(txParser* parser, txHostNode* self)
741{

Callers

nothing calls this directly

Calls 8

fxScopeNewFunction · 0.85
fxDefineNodeNewFunction · 0.85
fxValueNodeNewFunction · 0.85
fxScopeAddDeclareNodeFunction · 0.85
fxScopeAddDefineNodeFunction · 0.85
fxNodeDispatchHoistFunction · 0.85
fxDeclareNodeNewFunction · 0.85
fxScopeHoistedFunction · 0.85

Tested by

no test coverage detected