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

Function fxClassExpression

xs/sources/xsSyntaxical.c:2599–2905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2597}
2598
2599void fxClassExpression(txParser* parser, txInteger theLine, txSymbol** theSymbol)
2600{
2601 txBoolean heritageFlag = 0;
2602// txBoolean hostFlag = 0;
2603 txNode* constructor = NULL;
2604 txInteger aCount = 0;
2605 txInteger aLine = parser->states[0].line;
2606 txUnsigned flags = parser->flags;
2607 txUnsigned constructorFlags = mxSuperFlag;
2608 txInteger constructorInitCount = 0;
2609 txInteger instanceInitCount = 0;
2610 parser->flags |= mxStrictFlag;
2611 fxMatchToken(parser, XS_TOKEN_CLASS);
2612 if (parser->states[0].token == XS_TOKEN_IDENTIFIER) {
2613 fxPushSymbol(parser, parser->states[0].symbol);
2614 if (theSymbol)
2615 *theSymbol = parser->states[0].symbol;
2616 fxGetNextToken(parser);
2617 }
2618 else
2619 fxPushNULL(parser);
2620 if (parser->states[0].token == XS_TOKEN_EXTENDS) {
2621 fxMatchToken(parser, XS_TOKEN_EXTENDS);
2622 fxCallExpression(parser);
2623 fxCheckArrowFunction(parser, 1);
2624 fxCheckNativeConstructor(parser);
2625 flags |= parser->flags & mxAwaitingFlag;
2626 constructorFlags |= mxDerivedFlag;
2627 if (parser->root->description->token == XS_TOKEN_HOST)
2628 constructorFlags |= mxHostFlag;
2629 heritageFlag = 1;
2630 }
2631 else if (parser->states[0].token == XS_TOKEN_HOST) {
2632 fxGetNextToken(parser);
2633 fxPushNULL(parser);
2634 fxPushNULL(parser);
2635 if (parser->states[0].token == XS_TOKEN_STRING) {
2636 fxPushStringNode(parser, parser->states[0].stringLength, parser->states[0].string, aLine);
2637 fxGetNextToken(parser);
2638 }
2639 else {
2640 fxReportParserError(parser, parser->states[0].line, "invalid host class");
2641 fxPushNULL(parser);
2642 }
2643 fxPushNodeStruct(parser, 3, XS_TOKEN_HOST, aLine);
2644 constructorFlags |= mxBaseFlag | mxHostFlag;
2645// hostFlag = 1;
2646 }
2647 else {
2648 fxPushNULL(parser);
2649 constructorFlags |= mxBaseFlag;
2650 }
2651 if (parser->states[0].token == XS_TOKEN_LEFT_BRACE) {
2652 fxMatchToken(parser, XS_TOKEN_LEFT_BRACE);
2653 for (;;) {
2654 txBoolean aStaticFlag;
2655 txInteger aPropertyLine = parser->states[0].line;
2656 txSymbol* aSymbol;

Callers 3

fxExportDeclarationFunction · 0.85
fxStatementFunction · 0.85
fxLiteralExpressionFunction · 0.85

Calls 15

fxMatchTokenFunction · 0.85
fxPushSymbolFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushNULLFunction · 0.85
fxCallExpressionFunction · 0.85
fxCheckArrowFunctionFunction · 0.85
fxCheckNativeConstructorFunction · 0.85
fxPushStringNodeFunction · 0.85
fxReportParserErrorFunction · 0.85
fxPushNodeStructFunction · 0.85
fxCheckParserStackFunction · 0.85
fxStatementsFunction · 0.85

Tested by

no test coverage detected