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

Function fxCallExpression

xs/sources/xsSyntaxical.c:2132–2285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2130}
2131
2132void fxCallExpression(txParser* parser)
2133{
2134 txInteger chainLine = parser->states[0].line;
2135 fxLiteralExpression(parser, 0);
2136 if (gxTokenFlags[parser->states[0].token] & XS_TOKEN_CALL_EXPRESSION) {
2137 txBoolean chainFlag = 0;
2138 fxCheckArrowFunction(parser, 1);
2139 for (;;) {
2140 txInteger aLine = parser->states[0].line;
2141 if (parser->states[0].token == XS_TOKEN_DOT) {
2142 fxGetNextToken(parser);
2143 if (parser->states[0].token == XS_TOKEN_IDENTIFIER) {
2144 fxPushSymbol(parser, parser->states[0].symbol);
2145 fxPushNodeStruct(parser, 2, XS_TOKEN_MEMBER, aLine);
2146 fxGetNextToken(parser);
2147 }
2148 else if (parser->states[0].token == XS_TOKEN_PRIVATE_IDENTIFIER) {
2149 if (parser->root->flags & mxSuperFlag)
2150 fxReportParserError(parser, parser->states[0].line, "invalid super");
2151 fxPushSymbol(parser, parser->states[0].symbol);
2152 fxSwapNodes(parser);
2153 fxPushNodeStruct(parser, 2, XS_TOKEN_PRIVATE_MEMBER, aLine);
2154 fxGetNextToken(parser);
2155 }
2156 else
2157 fxReportParserError(parser, parser->states[0].line, "missing property");
2158 }
2159 //else if (parser->states[0].crlf)
2160 // break;
2161 else if (parser->states[0].token == XS_TOKEN_LEFT_BRACKET) {
2162 fxGetNextToken(parser);
2163 fxCommaExpression(parser);
2164 fxPushNodeStruct(parser, 2, XS_TOKEN_MEMBER_AT, aLine);
2165 fxMatchToken(parser, XS_TOKEN_RIGHT_BRACKET);
2166 }
2167 else if (parser->states[0].token == XS_TOKEN_LEFT_PARENTHESIS) {
2168 txUnsigned nativeFlags = 0;
2169 txAccessNode* access = NULL;
2170 if (parser->root->description && (parser->root->description->token == XS_TOKEN_ACCESS)) {
2171 access = (txAccessNode*)parser->root;
2172 if (access->symbol == parser->evalSymbol) {
2173 parser->flags |= mxEvalFlag;
2174 }
2175 else if (parser->flags & mxCFlag) {
2176 if (access->symbol == parser->NativeSymbol) {
2177 nativeFlags = mxNativeConstructorFlag;
2178 }
2179 else if (access->symbol == parser->nativeSymbol) {
2180 nativeFlags = mxNativeFunctionFlag;
2181 parser->flags |= mxNativeFlag;
2182 }
2183 }
2184 }
2185 fxParameters(parser);
2186 if (nativeFlags) {
2187 txParamsNode* params = (txParamsNode*)parser->root;
2188 if (params->items->length == 0)
2189 fxReportParserError(parser, aLine, "%s: no argument", access->symbol->string);

Callers 2

fxPostfixExpressionFunction · 0.85
fxClassExpressionFunction · 0.85

Calls 15

fxLiteralExpressionFunction · 0.85
fxCheckArrowFunctionFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushSymbolFunction · 0.85
fxPushNodeStructFunction · 0.85
fxReportParserErrorFunction · 0.85
fxSwapNodesFunction · 0.85
fxCommaExpressionFunction · 0.85
fxMatchTokenFunction · 0.85
fxParametersFunction · 0.85
fxPopNodeFunction · 0.85
fxPushNULLFunction · 0.85

Tested by

no test coverage detected