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

Function fxCheckFunction

xs/sources/xsTree.c:142–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void fxCheckFunction(txParser* parser)
143{
144 txNode* node = parser->root;
145 if (node->description->token == XS_TOKEN_PROGRAM) {
146 node = ((txProgramNode*)node)->body;
147 if (node->description->token == XS_TOKEN_STATEMENT) {
148 node = ((txStatementNode*)node)->expression;
149 if (node->description->token == XS_TOKEN_EXPRESSIONS) {
150 txNodeList* list = ((txExpressionsNode*)node)->items;
151 if (list->length == 1) {
152 node = list->first;
153 if (node->description->token == XS_TOKEN_FUNCTION)
154 return;
155 }
156 }
157 }
158 }
159 fxReportParserError(parser, node->line, "no function");
160}
161
162void fxCheckGenerator(txParser* parser)
163{

Callers 1

fxParserTreeFunction · 0.85

Calls 1

fxReportParserErrorFunction · 0.85

Tested by

no test coverage detected