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

Function fxHostNodeHoist

xs/sources/xsScope.c:747–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745}
746
747void fxHostNodeHoist(void* it, void* param)
748{
749 txHostNode* self = it;
750 txHoister* hoister = param;
751 txScope* scope = hoister->bodyScope;
752 self->hostIndex = -1;
753 if ((scope->token != XS_TOKEN_MODULE) && (scope->token != XS_TOKEN_PROGRAM)) {
754 txParser* parser = hoister->parser;
755 while ((scope->token != XS_TOKEN_MODULE) && (scope->token != XS_TOKEN_PROGRAM))
756 scope = scope->scope;
757 snprintf(parser->buffer, parser->bufferSize, "@%s", self->at->value);
758 txSymbol* symbol = fxNewParserSymbol(parser, parser->buffer);
759 if (!fxScopeGetDeclareNode(scope, symbol)) {
760 txDefineNode* definition = fxDefineNodeNew(parser, XS_TOKEN_DEFINE, symbol);
761 definition->initializer = (txNode*)fxHostNodeClone(parser, self);
762 fxScopeAddDeclareNode(scope, (txDeclareNode*)definition);
763 fxScopeAddDefineNode(scope, definition);
764 }
765 txAccessNode* access = it;
766 access->description = &gxTokenDescriptions[XS_TOKEN_ACCESS];
767 access->symbol = symbol;
768 access->initializer = C_NULL;
769 access->declaration = C_NULL;
770 }
771}
772
773void fxImportNodeHoist(void* it, void* param)
774{

Callers

nothing calls this directly

Calls 6

fxNewParserSymbolFunction · 0.85
fxScopeGetDeclareNodeFunction · 0.85
fxDefineNodeNewFunction · 0.85
fxHostNodeCloneFunction · 0.85
fxScopeAddDeclareNodeFunction · 0.85
fxScopeAddDefineNodeFunction · 0.85

Tested by

no test coverage detected