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

Function fxCheckGenerator

xs/sources/xsTree.c:162–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void fxCheckGenerator(txParser* parser)
163{
164 txNode* node = parser->root;
165 if (node->description->token == XS_TOKEN_PROGRAM) {
166 node = ((txProgramNode*)node)->body;
167 if (node->description->token == XS_TOKEN_STATEMENT) {
168 node = ((txStatementNode*)node)->expression;
169 if (node->description->token == XS_TOKEN_EXPRESSIONS) {
170 txNodeList* list = ((txExpressionsNode*)node)->items;
171 if (list->length == 1) {
172 node = list->first;
173 if (node->description->token == XS_TOKEN_GENERATOR)
174 return;
175 }
176 }
177 }
178 }
179 fxReportParserError(parser, node->line, "no generator function");
180}
181
182void fxSkipShebang(txParser* parser)
183{

Callers 1

fxParserTreeFunction · 0.85

Calls 1

fxReportParserErrorFunction · 0.85

Tested by

no test coverage detected