diff --git a/packages/cxx-frontend/src/AST.ts b/packages/cxx-frontend/src/AST.ts index c900aa25..06981b32 100644 --- a/packages/cxx-frontend/src/AST.ts +++ b/packages/cxx-frontend/src/AST.ts @@ -2391,7 +2391,7 @@ export class StructuredBindingDeclarationAST extends DeclarationAST { /** * AsmOperandAST node. */ -export class AsmOperandAST extends DeclarationAST { +export class AsmOperandAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2477,7 +2477,7 @@ export class AsmOperandAST extends DeclarationAST { /** * AsmQualifierAST node. */ -export class AsmQualifierAST extends DeclarationAST { +export class AsmQualifierAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2509,7 +2509,7 @@ export class AsmQualifierAST extends DeclarationAST { /** * AsmClobberAST node. */ -export class AsmClobberAST extends DeclarationAST { +export class AsmClobberAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2542,7 +2542,7 @@ export class AsmClobberAST extends DeclarationAST { /** * AsmGotoLabelAST node. */ -export class AsmGotoLabelAST extends DeclarationAST { +export class AsmGotoLabelAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2573,9 +2573,9 @@ export class AsmGotoLabelAST extends DeclarationAST { } /** - * LabeledStatementAST node. + * SplicerAST node. */ -export class LabeledStatementAST extends StatementAST { +export class SplicerAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2586,13 +2586,13 @@ export class LabeledStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitLabeledStatement(this, context); + return visitor.visitSplicer(this, context); } /** - * Returns the location of the identifier token in this node + * Returns the location of the lbracket token in this node */ - getIdentifierToken(): Token | undefined { + getLbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -2604,36 +2604,10 @@ export class LabeledStatementAST extends StatementAST { } /** - * Returns the identifier attribute of this node - */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 2); - return cxx.getIdentifierValue(slot); - } -} - -/** - * CaseStatementAST node. - */ -export class CaseStatementAST extends StatementAST { - /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. - */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitCaseStatement(this, context); - } - - /** - * Returns the location of the case token in this node + * Returns the location of the ellipsis token in this node */ - getCaseToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** @@ -2641,23 +2615,30 @@ export class CaseStatementAST extends StatementAST { */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + cxx.getASTSlot(this.getHandle(), 3), this.parser, ); } /** - * Returns the location of the colon token in this node + * Returns the location of the secondColon token in this node */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getSecondColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the location of the rbracket token in this node + */ + getRbracketToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } } /** - * DefaultStatementAST node. + * GlobalModuleFragmentAST node. */ -export class DefaultStatementAST extends StatementAST { +export class GlobalModuleFragmentAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2668,28 +2649,54 @@ export class DefaultStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDefaultStatement(this, context); + return visitor.visitGlobalModuleFragment(this, context); } /** - * Returns the location of the default token in this node + * Returns the location of the module token in this node */ - getDefaultToken(): Token | undefined { + getModuleToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the colon token in this node + * Returns the location of the semicolon token in this node */ - getColonToken(): Token | undefined { + getSemicolonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } + + /** + * Returns the declarationList of this node + */ + getDeclarationList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: DeclarationAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } } /** - * ExpressionStatementAST node. + * PrivateModuleFragmentAST node. */ -export class ExpressionStatementAST extends StatementAST { +export class PrivateModuleFragmentAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2700,64 +2707,50 @@ export class ExpressionStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitExpressionStatement(this, context); + return visitor.visitPrivateModuleFragment(this, context); } /** - * Returns the expression of this node + * Returns the location of the module token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getModuleToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the semicolon token in this node + * Returns the location of the colon token in this node */ - getSemicolonToken(): Token | undefined { + getColonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } -} -/** - * CompoundStatementAST node. - */ -export class CompoundStatementAST extends StatementAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the private token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitCompoundStatement(this, context); + getPrivateToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the lbrace token in this node + * Returns the location of the semicolon token in this node */ - getLbraceToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the statementList of this node + * Returns the declarationList of this node */ - getStatementList(): Iterable { + getDeclarationList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: StatementAST | undefined; + let value: DeclarationAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -2770,19 +2763,12 @@ export class CompoundStatementAST extends StatementAST { }, }; } - - /** - * Returns the location of the rbrace token in this node - */ - getRbraceToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } } /** - * IfStatementAST node. + * ModuleDeclarationAST node. */ -export class IfStatementAST extends StatementAST { +export class ModuleDeclarationAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2793,89 +2779,81 @@ export class IfStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitIfStatement(this, context); + return visitor.visitModuleDeclaration(this, context); } /** - * Returns the location of the if token in this node + * Returns the location of the export token in this node */ - getIfToken(): Token | undefined { + getExportToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the constexpr token in this node + * Returns the location of the module token in this node */ - getConstexprToken(): Token | undefined { + getModuleToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the initializer of this node - */ - getInitializer(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); - } - - /** - * Returns the condition of this node + * Returns the moduleName of this node */ - getCondition(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), + getModuleName(): ModuleNameAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); - } - - /** - * Returns the statement of this node + * Returns the modulePartition of this node */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 6), + getModulePartition(): ModulePartitionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), this.parser, ); } /** - * Returns the location of the else token in this node + * Returns the attributeList of this node */ - getElseToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 7), this.parser); + getAttributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the elseStatement of this node + * Returns the location of the semicolon token in this node */ - getElseStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 8), - this.parser, - ); + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } } /** - * ConstevalIfStatementAST node. + * ModuleNameAST node. */ -export class ConstevalIfStatementAST extends StatementAST { +export class ModuleNameAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2886,69 +2864,39 @@ export class ConstevalIfStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitConstevalIfStatement(this, context); + return visitor.visitModuleName(this, context); } /** - * Returns the location of the if token in this node + * Returns the moduleQualifier of this node */ - getIfToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the location of the exclaim token in this node - */ - getExclaimToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the location of the constval token in this node - */ - getConstvalToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the statement of this node - */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), + getModuleQualifier(): ModuleQualifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } /** - * Returns the location of the else token in this node - */ - getElseToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); - } - - /** - * Returns the elseStatement of this node + * Returns the location of the identifier token in this node */ - getElseStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), - this.parser, - ); + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the isNot attribute of this node + * Returns the identifier attribute of this node */ - getIsNot(): boolean { - return cxx.getASTSlot(this.getHandle(), 6) !== 0; + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 2); + return cxx.getIdentifierValue(slot); } } /** - * SwitchStatementAST node. + * ModuleQualifierAST node. */ -export class SwitchStatementAST extends StatementAST { +export class ModuleQualifierAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -2959,65 +2907,46 @@ export class SwitchStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSwitchStatement(this, context); - } - - /** - * Returns the location of the switch token in this node - */ - getSwitchToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + return visitor.visitModuleQualifier(this, context); } /** - * Returns the initializer of this node + * Returns the moduleQualifier of this node */ - getInitializer(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + getModuleQualifier(): ModuleQualifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } /** - * Returns the condition of this node + * Returns the location of the identifier token in this node */ - getCondition(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the location of the dot token in this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + getDotToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the statement of this node + * Returns the identifier attribute of this node */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), - this.parser, - ); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 3); + return cxx.getIdentifierValue(slot); } } /** - * WhileStatementAST node. + * ModulePartitionAST node. */ -export class WhileStatementAST extends StatementAST { +export class ModulePartitionAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3028,55 +2957,31 @@ export class WhileStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitWhileStatement(this, context); + return visitor.visitModulePartition(this, context); } /** - * Returns the location of the while token in this node + * Returns the location of the colon token in this node */ - getWhileToken(): Token | undefined { + getColonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the condition of this node - */ - getCondition(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); - } - - /** - * Returns the statement of this node + * Returns the moduleName of this node */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), + getModuleName(): ModuleNameAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } } /** - * DoStatementAST node. + * ImportNameAST node. */ -export class DoStatementAST extends StatementAST { +export class ImportNameAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3087,69 +2992,89 @@ export class DoStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDoStatement(this, context); + return visitor.visitImportName(this, context); } /** - * Returns the location of the do token in this node + * Returns the location of the header token in this node */ - getDoToken(): Token | undefined { + getHeaderToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the statement of this node + * Returns the modulePartition of this node */ - getStatement(): StatementAST | undefined { - return AST.from( + getModulePartition(): ModulePartitionAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the location of the while token in this node + * Returns the moduleName of this node */ - getWhileToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getModuleName(): ModuleNameAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } +} +/** + * InitDeclaratorAST node. + */ +export class InitDeclaratorAST extends AST { /** - * Returns the location of the lparen token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitInitDeclarator(this, context); } /** - * Returns the expression of this node + * Returns the declarator of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), + getDeclarator(): DeclaratorAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } /** - * Returns the location of the rparen token in this node + * Returns the requiresClause of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + getRequiresClause(): RequiresClauseAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the location of the semicolon token in this node + * Returns the initializer of this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + getInitializer(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } } /** - * ForRangeStatementAST node. + * DeclaratorAST node. */ -export class ForRangeStatementAST extends StatementAST { +export class DeclaratorAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3160,82 +3085,76 @@ export class ForRangeStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitForRangeStatement(this, context); - } - - /** - * Returns the location of the for token in this node - */ - getForToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + return visitor.visitDeclarator(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the ptrOpList of this node */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getPtrOpList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: PtrOperatorAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the initializer of this node + * Returns the coreDeclarator of this node */ - getInitializer(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + getCoreDeclarator(): CoreDeclaratorAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the rangeDeclaration of this node + * Returns the declaratorChunkList of this node */ - getRangeDeclaration(): DeclarationAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); - } - - /** - * Returns the location of the colon token in this node - */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); - } - - /** - * Returns the rangeInitializer of this node - */ - getRangeInitializer(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); - } - - /** - * Returns the statement of this node - */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 7), - this.parser, - ); + getDeclaratorChunkList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: DeclaratorChunkAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } } /** - * ForStatementAST node. + * UsingDeclaratorAST node. */ -export class ForStatementAST extends StatementAST { +export class UsingDeclaratorAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3246,82 +3165,55 @@ export class ForStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitForStatement(this, context); + return visitor.visitUsingDeclarator(this, context); } /** - * Returns the location of the for token in this node + * Returns the location of the typename token in this node */ - getForToken(): Token | undefined { + getTypenameToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the initializer of this node - */ - getInitializer(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the condition of this node + * Returns the nestedNameSpecifier of this node */ - getCondition(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), + getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the location of the semicolon token in this node - */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); - } - - /** - * Returns the expression of this node + * Returns the unqualifiedId of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), + getUnqualifiedId(): UnqualifiedIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the rparen token in this node + * Returns the location of the ellipsis token in this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the statement of this node + * Returns the isPack attribute of this node */ - getStatement(): StatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 7), - this.parser, - ); + getIsPack(): boolean { + return cxx.getASTSlot(this.getHandle(), 4) !== 0; } } /** - * BreakStatementAST node. + * EnumeratorAST node. */ -export class BreakStatementAST extends StatementAST { +export class EnumeratorAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3332,60 +3224,72 @@ export class BreakStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBreakStatement(this, context); + return visitor.visitEnumerator(this, context); } /** - * Returns the location of the break token in this node + * Returns the location of the identifier token in this node */ - getBreakToken(): Token | undefined { + getIdentifierToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the semicolon token in this node + * Returns the attributeList of this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getAttributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } -} -/** - * ContinueStatementAST node. - */ -export class ContinueStatementAST extends StatementAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the equal token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitContinueStatement(this, context); + getEqualToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the continue token in this node + * Returns the expression of this node */ - getContinueToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the location of the semicolon token in this node + * Returns the identifier attribute of this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 4); + return cxx.getIdentifierValue(slot); } } /** - * ReturnStatementAST node. + * TypeIdAST node. */ -export class ReturnStatementAST extends StatementAST { +export class TypeIdAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3396,38 +3300,50 @@ export class ReturnStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitReturnStatement(this, context); + return visitor.visitTypeId(this, context); } /** - * Returns the location of the return token in this node + * Returns the typeSpecifierList of this node */ - getReturnToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getTypeSpecifierList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: SpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the expression of this node + * Returns the declarator of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( + getDeclarator(): DeclaratorAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } - - /** - * Returns the location of the semicolon token in this node - */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } } /** - * CoroutineReturnStatementAST node. + * HandlerAST node. */ -export class CoroutineReturnStatementAST extends StatementAST { +export class HandlerAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3438,38 +3354,55 @@ export class CoroutineReturnStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitCoroutineReturnStatement(this, context); + return visitor.visitHandler(this, context); } /** - * Returns the location of the coreturn token in this node + * Returns the location of the catch token in this node */ - getCoreturnToken(): Token | undefined { + getCatchToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expression of this node + * Returns the location of the lparen token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the semicolon token in this node + * Returns the exceptionDeclaration of this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getExceptionDeclaration(): ExceptionDeclarationAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the statement of this node + */ + getStatement(): CompoundStatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), + this.parser, + ); } } /** - * GotoStatementAST node. + * BaseSpecifierAST node. */ -export class GotoStatementAST extends StatementAST { +export class BaseSpecifierAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3480,57 +3413,116 @@ export class GotoStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitGotoStatement(this, context); + return visitor.visitBaseSpecifier(this, context); } /** - * Returns the location of the goto token in this node + * Returns the attributeList of this node */ - getGotoToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getAttributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the location of the star token in this node + * Returns the location of the virtualOrAccess token in this node */ - getStarToken(): Token | undefined { + getVirtualOrAccessToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the location of the otherVirtualOrAccess token in this node */ - getIdentifierToken(): Token | undefined { + getOtherVirtualOrAccessToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the semicolon token in this node + * Returns the nestedNameSpecifier of this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the identifier attribute of this node + * Returns the location of the template token in this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 4); - return cxx.getIdentifierValue(slot); + getTemplateToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); } /** - * Returns the isIndirect attribute of this node + * Returns the unqualifiedId of this node */ - getIsIndirect(): boolean { - return cxx.getASTSlot(this.getHandle(), 5) !== 0; + getUnqualifiedId(): UnqualifiedIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 5), + this.parser, + ); + } + + /** + * Returns the location of the ellipsis token in this node + */ + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } + + /** + * Returns the isTemplateIntroduced attribute of this node + */ + getIsTemplateIntroduced(): boolean { + return cxx.getASTSlot(this.getHandle(), 7) !== 0; + } + + /** + * Returns the isVirtual attribute of this node + */ + getIsVirtual(): boolean { + return cxx.getASTSlot(this.getHandle(), 8) !== 0; + } + + /** + * Returns the isVariadic attribute of this node + */ + getIsVariadic(): boolean { + return cxx.getASTSlot(this.getHandle(), 9) !== 0; + } + + /** + * Returns the accessSpecifier attribute of this node + */ + getAccessSpecifier(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 10); } } /** - * DeclarationStatementAST node. + * RequiresClauseAST node. */ -export class DeclarationStatementAST extends StatementAST { +export class RequiresClauseAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3541,24 +3533,31 @@ export class DeclarationStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDeclarationStatement(this, context); + return visitor.visitRequiresClause(this, context); } /** - * Returns the declaration of this node + * Returns the location of the requires token in this node */ - getDeclaration(): DeclarationAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), + getRequiresToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the expression of this node + */ + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } } /** - * TryBlockStatementAST node. + * ParameterDeclarationClauseAST node. */ -export class TryBlockStatementAST extends StatementAST { +export class ParameterDeclarationClauseAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3569,39 +3568,22 @@ export class TryBlockStatementAST extends StatementAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTryBlockStatement(this, context); - } - - /** - * Returns the location of the try token in this node - */ - getTryToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the statement of this node - */ - getStatement(): CompoundStatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + return visitor.visitParameterDeclarationClause(this, context); } /** - * Returns the handlerList of this node + * Returns the parameterDeclarationList of this node */ - getHandlerList(): Iterable { + getParameterDeclarationList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: HandlerAST | undefined; + let value: ParameterDeclarationAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -3614,37 +3596,33 @@ export class TryBlockStatementAST extends StatementAST { }, }; } -} -/** - * GeneratedLiteralExpressionAST node. - */ -export class GeneratedLiteralExpressionAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the comma token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitGeneratedLiteralExpression(this, context); + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the literal token in this node + * Returns the location of the ellipsis token in this node */ - getLiteralToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } + + /** + * Returns the isVariadic attribute of this node + */ + getIsVariadic(): boolean { + return cxx.getASTSlot(this.getHandle(), 3) !== 0; } } /** - * CharLiteralExpressionAST node. + * TrailingReturnTypeAST node. */ -export class CharLiteralExpressionAST extends ExpressionAST { +export class TrailingReturnTypeAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3655,29 +3633,31 @@ export class CharLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitCharLiteralExpression(this, context); + return visitor.visitTrailingReturnType(this, context); } /** - * Returns the location of the literal token in this node + * Returns the location of the minusGreater token in this node */ - getLiteralToken(): Token | undefined { + getMinusGreaterToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the literal attribute of this node + * Returns the typeId of this node */ - getLiteral(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 1); - return cxx.getLiteralValue(slot); + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } } /** - * BoolLiteralExpressionAST node. + * LambdaSpecifierAST node. */ -export class BoolLiteralExpressionAST extends ExpressionAST { +export class LambdaSpecifierAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3688,28 +3668,28 @@ export class BoolLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBoolLiteralExpression(this, context); + return visitor.visitLambdaSpecifier(this, context); } /** - * Returns the location of the literal token in this node + * Returns the location of the specifier token in this node */ - getLiteralToken(): Token | undefined { + getSpecifierToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the isTrue attribute of this node + * Returns the specifier attribute of this node */ - getIsTrue(): boolean { - return cxx.getASTSlot(this.getHandle(), 1) !== 0; + getSpecifier(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 1); } } /** - * IntLiteralExpressionAST node. + * TypeConstraintAST node. */ -export class IntLiteralExpressionAST extends ExpressionAST { +export class TypeConstraintAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3720,29 +3700,79 @@ export class IntLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitIntLiteralExpression(this, context); + return visitor.visitTypeConstraint(this, context); } /** - * Returns the location of the literal token in this node + * Returns the nestedNameSpecifier of this node */ - getLiteralToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the literal attribute of this node + getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); + } + + /** + * Returns the location of the identifier token in this node */ - getLiteral(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 1); - return cxx.getLiteralValue(slot); + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the location of the less token in this node + */ + getLessToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } + + /** + * Returns the templateArgumentList of this node + */ + getTemplateArgumentList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: TemplateArgumentAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the greater token in this node + */ + getGreaterToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the identifier attribute of this node + */ + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 5); + return cxx.getIdentifierValue(slot); } } /** - * FloatLiteralExpressionAST node. + * AttributeArgumentClauseAST node. */ -export class FloatLiteralExpressionAST extends ExpressionAST { +export class AttributeArgumentClauseAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3753,29 +3783,28 @@ export class FloatLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitFloatLiteralExpression(this, context); + return visitor.visitAttributeArgumentClause(this, context); } /** - * Returns the location of the literal token in this node + * Returns the location of the lparen token in this node */ - getLiteralToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the literal attribute of this node + * Returns the location of the rparen token in this node */ - getLiteral(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 1); - return cxx.getLiteralValue(slot); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } } /** - * NullptrLiteralExpressionAST node. + * AttributeAST node. */ -export class NullptrLiteralExpressionAST extends ExpressionAST { +export class AttributeAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3786,28 +3815,41 @@ export class NullptrLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNullptrLiteralExpression(this, context); + return visitor.visitAttribute(this, context); } /** - * Returns the location of the literal token in this node + * Returns the attributeToken of this node */ - getLiteralToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getAttributeToken(): AttributeTokenAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the literal attribute of this node + * Returns the attributeArgumentClause of this node */ - getLiteral(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 1); + getAttributeArgumentClause(): AttributeArgumentClauseAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); + } + + /** + * Returns the location of the ellipsis token in this node + */ + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * StringLiteralExpressionAST node. + * AttributeUsingPrefixAST node. */ -export class StringLiteralExpressionAST extends ExpressionAST { +export class AttributeUsingPrefixAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3818,29 +3860,35 @@ export class StringLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitStringLiteralExpression(this, context); + return visitor.visitAttributeUsingPrefix(this, context); } /** - * Returns the location of the literal token in this node + * Returns the location of the using token in this node */ - getLiteralToken(): Token | undefined { + getUsingToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the literal attribute of this node + * Returns the location of the attributeNamespace token in this node */ - getLiteral(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 1); - return cxx.getLiteralValue(slot); + getAttributeNamespaceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the location of the colon token in this node + */ + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * UserDefinedStringLiteralExpressionAST node. + * NewPlacementAST node. */ -export class UserDefinedStringLiteralExpressionAST extends ExpressionAST { +export class NewPlacementAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3851,29 +3899,54 @@ export class UserDefinedStringLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitUserDefinedStringLiteralExpression(this, context); + return visitor.visitNewPlacement(this, context); } /** - * Returns the location of the literal token in this node + * Returns the location of the lparen token in this node */ - getLiteralToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the literal attribute of this node + * Returns the expressionList of this node */ - getLiteral(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 1); - return cxx.getLiteralValue(slot); + getExpressionList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: ExpressionAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * ObjectLiteralExpressionAST node. + * NestedNamespaceSpecifierAST node. */ -export class ObjectLiteralExpressionAST extends ExpressionAST { +export class NestedNamespaceSpecifierAST extends AST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3884,48 +3957,50 @@ export class ObjectLiteralExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitObjectLiteralExpression(this, context); + return visitor.visitNestedNamespaceSpecifier(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the inline token in this node */ - getLparenToken(): Token | undefined { + getInlineToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the typeId of this node + * Returns the location of the identifier token in this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the location of the scope token in this node */ - getRparenToken(): Token | undefined { + getScopeToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the bracedInitList of this node + * Returns the identifier attribute of this node */ - getBracedInitList(): BracedInitListAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 3); + return cxx.getIdentifierValue(slot); + } + + /** + * Returns the isInline attribute of this node + */ + getIsInline(): boolean { + return cxx.getASTSlot(this.getHandle(), 4) !== 0; } } /** - * ThisExpressionAST node. + * LabeledStatementAST node. */ -export class ThisExpressionAST extends ExpressionAST { +export class LabeledStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3936,21 +4011,36 @@ export class ThisExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitThisExpression(this, context); + return visitor.visitLabeledStatement(this, context); } /** - * Returns the location of the this token in this node + * Returns the location of the identifier token in this node */ - getThisToken(): Token | undefined { + getIdentifierToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } + + /** + * Returns the location of the colon token in this node + */ + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the identifier attribute of this node + */ + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 2); + return cxx.getIdentifierValue(slot); + } } /** - * GenericSelectionExpressionAST node. + * CaseStatementAST node. */ -export class GenericSelectionExpressionAST extends ExpressionAST { +export class CaseStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -3961,78 +4051,38 @@ export class GenericSelectionExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitGenericSelectionExpression(this, context); + return visitor.visitCaseStatement(this, context); } /** - * Returns the location of the generic token in this node + * Returns the location of the case token in this node */ - getGenericToken(): Token | undefined { + getCaseToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the expression of this node + * Returns the expression of this node */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the location of the comma token in this node - */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); - } - - /** - * Returns the genericAssociationList of this node - */ - getGenericAssociationList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: GenericAssociationAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the location of the rparen token in this node + * Returns the location of the colon token in this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * NestedStatementExpressionAST node. + * DefaultStatementAST node. */ -export class NestedStatementExpressionAST extends ExpressionAST { +export class DefaultStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4043,38 +4093,28 @@ export class NestedStatementExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNestedStatementExpression(this, context); + return visitor.visitDefaultStatement(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the default token in this node */ - getLparenToken(): Token | undefined { + getDefaultToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the statement of this node - */ - getStatement(): CompoundStatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node + * Returns the location of the colon token in this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } } /** - * NestedExpressionAST node. + * ExpressionStatementAST node. */ -export class NestedExpressionAST extends ExpressionAST { +export class ExpressionStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4085,14 +4125,7 @@ export class NestedExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNestedExpression(this, context); - } - - /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + return visitor.visitExpressionStatement(this, context); } /** @@ -4100,75 +4133,23 @@ export class NestedExpressionAST extends ExpressionAST { */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } -} - -/** - * IdExpressionAST node. - */ -export class IdExpressionAST extends ExpressionAST { - /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. - */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitIdExpression(this, context); - } - - /** - * Returns the nestedNameSpecifier of this node - */ - getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { - return AST.from( cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } /** - * Returns the location of the template token in this node + * Returns the location of the semicolon token in this node */ - getTemplateToken(): Token | undefined { + getSemicolonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } - - /** - * Returns the unqualifiedId of this node - */ - getUnqualifiedId(): UnqualifiedIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the isTemplateIntroduced attribute of this node - */ - getIsTemplateIntroduced(): boolean { - return cxx.getASTSlot(this.getHandle(), 3) !== 0; - } } /** - * LambdaExpressionAST node. + * CompoundStatementAST node. */ -export class LambdaExpressionAST extends ExpressionAST { +export class CompoundStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4179,36 +4160,29 @@ export class LambdaExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitLambdaExpression(this, context); + return visitor.visitCompoundStatement(this, context); } /** - * Returns the location of the lbracket token in this node + * Returns the location of the lbrace token in this node */ - getLbracketToken(): Token | undefined { + getLbraceToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the captureDefault token in this node - */ - getCaptureDefaultToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the captureList of this node + * Returns the statementList of this node */ - getCaptureList(): Iterable { + getStatementList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: LambdaCaptureAST | undefined; + let value: StatementAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -4223,75 +4197,67 @@ export class LambdaExpressionAST extends ExpressionAST { } /** - * Returns the location of the rbracket token in this node + * Returns the location of the rbrace token in this node */ - getRbracketToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getRbraceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } +} +/** + * IfStatementAST node. + */ +export class IfStatementAST extends StatementAST { /** - * Returns the location of the less token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getLessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitIfStatement(this, context); } /** - * Returns the templateParameterList of this node + * Returns the location of the if token in this node */ - getTemplateParameterList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: TemplateParameterAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getIfToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the greater token in this node + * Returns the location of the constexpr token in this node */ - getGreaterToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + getConstexprToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the templateRequiresClause of this node + * Returns the location of the lparen token in this node */ - getTemplateRequiresClause(): RequiresClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 7), - this.parser, - ); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the lparen token in this node + * Returns the initializer of this node */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 8), this.parser); + getInitializer(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the parameterDeclarationClause of this node + * Returns the condition of this node */ - getParameterDeclarationClause(): ParameterDeclarationClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 9), + getCondition(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), this.parser, ); } @@ -4300,139 +4266,41 @@ export class LambdaExpressionAST extends ExpressionAST { * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 10), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } /** - * Returns the gnuAtributeList of this node + * Returns the statement of this node */ - getGnuAtributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the lambdaSpecifierList of this node - */ - getLambdaSpecifierList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: LambdaSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the exceptionSpecifier of this node - */ - getExceptionSpecifier(): ExceptionSpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 13), - this.parser, - ); - } - - /** - * Returns the attributeList of this node - */ - getAttributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the trailingReturnType of this node - */ - getTrailingReturnType(): TrailingReturnTypeAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 15), + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 6), this.parser, ); } /** - * Returns the requiresClause of this node + * Returns the location of the else token in this node */ - getRequiresClause(): RequiresClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 16), - this.parser, - ); + getElseToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 7), this.parser); } /** - * Returns the statement of this node + * Returns the elseStatement of this node */ - getStatement(): CompoundStatementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 17), + getElseStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 8), this.parser, ); } - - /** - * Returns the captureDefault attribute of this node - */ - getCaptureDefault(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 18); - } } /** - * FoldExpressionAST node. + * ConstevalIfStatementAST node. */ -export class FoldExpressionAST extends ExpressionAST { +export class ConstevalIfStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4443,83 +4311,69 @@ export class FoldExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitFoldExpression(this, context); + return visitor.visitConstevalIfStatement(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the if token in this node */ - getLparenToken(): Token | undefined { + getIfToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the leftExpression of this node + * Returns the location of the exclaim token in this node */ - getLeftExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getExclaimToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the op token in this node + * Returns the location of the constval token in this node */ - getOpToken(): Token | undefined { + getConstvalToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the ellipsis token in this node + * Returns the statement of this node */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the location of the foldOp token in this node + * Returns the location of the else token in this node */ - getFoldOpToken(): Token | undefined { + getElseToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); } /** - * Returns the rightExpression of this node + * Returns the elseStatement of this node */ - getRightExpression(): ExpressionAST | undefined { - return AST.from( + getElseStatement(): StatementAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); - } - - /** - * Returns the op attribute of this node - */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 7); - } - - /** - * Returns the foldOp attribute of this node + * Returns the isNot attribute of this node */ - getFoldOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 8); + getIsNot(): boolean { + return cxx.getASTSlot(this.getHandle(), 6) !== 0; } } /** - * RightFoldExpressionAST node. + * SwitchStatementAST node. */ -export class RightFoldExpressionAST extends ExpressionAST { +export class SwitchStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4530,38 +4384,41 @@ export class RightFoldExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitRightFoldExpression(this, context); + return visitor.visitSwitchStatement(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the switch token in this node */ - getLparenToken(): Token | undefined { + getSwitchToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expression of this node + * Returns the location of the lparen token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the op token in this node + * Returns the initializer of this node */ - getOpToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getInitializer(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } /** - * Returns the location of the ellipsis token in this node + * Returns the condition of this node */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getCondition(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** @@ -4572,17 +4429,20 @@ export class RightFoldExpressionAST extends ExpressionAST { } /** - * Returns the op attribute of this node + * Returns the statement of this node */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 5); + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 5), + this.parser, + ); } } /** - * LeftFoldExpressionAST node. + * WhileStatementAST node. */ -export class LeftFoldExpressionAST extends ExpressionAST { +export class WhileStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4593,36 +4453,29 @@ export class LeftFoldExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitLeftFoldExpression(this, context); + return visitor.visitWhileStatement(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the while token in this node */ - getLparenToken(): Token | undefined { + getWhileToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the ellipsis token in this node + * Returns the location of the lparen token in this node */ - getEllipsisToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the op token in this node - */ - getOpToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the expression of this node + * Returns the condition of this node */ - getExpression(): ExpressionAST | undefined { + getCondition(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 3), + cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } @@ -4631,21 +4484,24 @@ export class LeftFoldExpressionAST extends ExpressionAST { * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the op attribute of this node + * Returns the statement of this node */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 5); - } -} - + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), + this.parser, + ); + } +} + /** - * RequiresExpressionAST node. + * DoStatementAST node. */ -export class RequiresExpressionAST extends ExpressionAST { +export class DoStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4656,85 +4512,69 @@ export class RequiresExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitRequiresExpression(this, context); + return visitor.visitDoStatement(this, context); } /** - * Returns the location of the requires token in this node + * Returns the location of the do token in this node */ - getRequiresToken(): Token | undefined { + getDoToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node + * Returns the statement of this node */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the parameterDeclarationClause of this node + * Returns the location of the while token in this node */ - getParameterDeclarationClause(): ParameterDeclarationClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getWhileToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the location of the lparen token in this node */ - getRparenToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the location of the lbrace token in this node + * Returns the expression of this node */ - getLbraceToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), + this.parser, + ); } /** - * Returns the requirementList of this node + * Returns the location of the rparen token in this node */ - getRequirementList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: RequirementAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } /** - * Returns the location of the rbrace token in this node + * Returns the location of the semicolon token in this node */ - getRbraceToken(): Token | undefined { + getSemicolonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); } } /** - * VaArgExpressionAST node. + * ForRangeStatementAST node. */ -export class VaArgExpressionAST extends ExpressionAST { +export class ForRangeStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4745,13 +4585,13 @@ export class VaArgExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitVaArgExpression(this, context); + return visitor.visitForRangeStatement(this, context); } /** - * Returns the location of the vaArg token in this node + * Returns the location of the for token in this node */ - getVaArgToken(): Token | undefined { + getForToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -4763,28 +4603,38 @@ export class VaArgExpressionAST extends ExpressionAST { } /** - * Returns the expression of this node + * Returns the initializer of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( + getInitializer(): StatementAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the comma token in this node + * Returns the rangeDeclaration of this node */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getRangeDeclaration(): DeclarationAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the typeId of this node + * Returns the location of the colon token in this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the rangeInitializer of this node + */ + getRangeInitializer(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } @@ -4793,14 +4643,24 @@ export class VaArgExpressionAST extends ExpressionAST { * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } + + /** + * Returns the statement of this node + */ + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 7), + this.parser, + ); } } /** - * SubscriptExpressionAST node. + * ForStatementAST node. */ -export class SubscriptExpressionAST extends ExpressionAST { +export class ForStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4811,116 +4671,82 @@ export class SubscriptExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSubscriptExpression(this, context); + return visitor.visitForStatement(this, context); } /** - * Returns the baseExpression of this node + * Returns the location of the for token in this node */ - getBaseExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getForToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lbracket token in this node + * Returns the location of the lparen token in this node */ - getLbracketToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the indexExpression of this node + * Returns the initializer of this node */ - getIndexExpression(): ExpressionAST | undefined { - return AST.from( + getInitializer(): StatementAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the rbracket token in this node + * Returns the condition of this node */ - getRbracketToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getCondition(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } -} -/** - * CallExpressionAST node. - */ -export class CallExpressionAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the semicolon token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitCallExpression(this, context); + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); } /** - * Returns the baseExpression of this node + * Returns the expression of this node */ - getBaseExpression(): ExpressionAST | undefined { + getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 0), + cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the expressionList of this node + * Returns the location of the rparen token in this node */ - getExpressionList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ExpressionAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the statement of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getStatement(): StatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 7), + this.parser, + ); } } /** - * TypeConstructionAST node. + * BreakStatementAST node. */ -export class TypeConstructionAST extends ExpressionAST { +export class BreakStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4931,64 +4757,28 @@ export class TypeConstructionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeConstruction(this, context); + return visitor.visitBreakStatement(this, context); } /** - * Returns the typeSpecifier of this node + * Returns the location of the break token in this node */ - getTypeSpecifier(): SpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getBreakToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node + * Returns the location of the semicolon token in this node */ - getLparenToken(): Token | undefined { + getSemicolonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } +} - /** - * Returns the expressionList of this node - */ - getExpressionList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ExpressionAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); - } -} - -/** - * BracedTypeConstructionAST node. - */ -export class BracedTypeConstructionAST extends ExpressionAST { +/** + * ContinueStatementAST node. + */ +export class ContinueStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -4999,34 +4789,28 @@ export class BracedTypeConstructionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBracedTypeConstruction(this, context); + return visitor.visitContinueStatement(this, context); } /** - * Returns the typeSpecifier of this node + * Returns the location of the continue token in this node */ - getTypeSpecifier(): SpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getContinueToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the bracedInitList of this node + * Returns the location of the semicolon token in this node */ - getBracedInitList(): BracedInitListAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } } /** - * SpliceMemberExpressionAST node. + * ReturnStatementAST node. */ -export class SpliceMemberExpressionAST extends ExpressionAST { +export class ReturnStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5037,62 +4821,80 @@ export class SpliceMemberExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSpliceMemberExpression(this, context); + return visitor.visitReturnStatement(this, context); } /** - * Returns the baseExpression of this node + * Returns the location of the return token in this node */ - getBaseExpression(): ExpressionAST | undefined { + getReturnToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the expression of this node + */ + getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 0), + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the location of the access token in this node + * Returns the location of the semicolon token in this node */ - getAccessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } +} +/** + * CoroutineReturnStatementAST node. + */ +export class CoroutineReturnStatementAST extends StatementAST { /** - * Returns the location of the template token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getTemplateToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitCoroutineReturnStatement(this, context); } /** - * Returns the splicer of this node + * Returns the location of the coreturn token in this node */ - getSplicer(): SplicerAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); + getCoreturnToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the accessOp attribute of this node + * Returns the expression of this node */ - getAccessOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 4); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the isTemplateIntroduced attribute of this node + * Returns the location of the semicolon token in this node */ - getIsTemplateIntroduced(): boolean { - return cxx.getASTSlot(this.getHandle(), 5) !== 0; + getSemicolonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * MemberExpressionAST node. + * GotoStatementAST node. */ -export class MemberExpressionAST extends ExpressionAST { +export class GotoStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5103,72 +4905,57 @@ export class MemberExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitMemberExpression(this, context); + return visitor.visitGotoStatement(this, context); } /** - * Returns the baseExpression of this node + * Returns the location of the goto token in this node */ - getBaseExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getGotoToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the access token in this node + * Returns the location of the star token in this node */ - getAccessToken(): Token | undefined { + getStarToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the nestedNameSpecifier of this node + * Returns the location of the identifier token in this node */ - getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the template token in this node + * Returns the location of the semicolon token in this node */ - getTemplateToken(): Token | undefined { + getSemicolonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the unqualifiedId of this node - */ - getUnqualifiedId(): UnqualifiedIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), - this.parser, - ); - } - - /** - * Returns the accessOp attribute of this node + * Returns the identifier attribute of this node */ - getAccessOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 5); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 4); + return cxx.getIdentifierValue(slot); } /** - * Returns the isTemplateIntroduced attribute of this node + * Returns the isIndirect attribute of this node */ - getIsTemplateIntroduced(): boolean { - return cxx.getASTSlot(this.getHandle(), 6) !== 0; + getIsIndirect(): boolean { + return cxx.getASTSlot(this.getHandle(), 5) !== 0; } } /** - * PostIncrExpressionAST node. + * DeclarationStatementAST node. */ -export class PostIncrExpressionAST extends ExpressionAST { +export class DeclarationStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5179,38 +4966,24 @@ export class PostIncrExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitPostIncrExpression(this, context); + return visitor.visitDeclarationStatement(this, context); } /** - * Returns the baseExpression of this node + * Returns the declaration of this node */ - getBaseExpression(): ExpressionAST | undefined { - return AST.from( + getDeclaration(): DeclarationAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } - - /** - * Returns the location of the op token in this node - */ - getOpToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the op attribute of this node - */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 2); - } } /** - * CppCastExpressionAST node. + * TryBlockStatementAST node. */ -export class CppCastExpressionAST extends ExpressionAST { +export class TryBlockStatementAST extends StatementAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5221,69 +4994,82 @@ export class CppCastExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitCppCastExpression(this, context); + return visitor.visitTryBlockStatement(this, context); } /** - * Returns the location of the cast token in this node + * Returns the location of the try token in this node */ - getCastToken(): Token | undefined { + getTryToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the less token in this node - */ - getLessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the typeId of this node + * Returns the statement of this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + getStatement(): CompoundStatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } /** - * Returns the location of the greater token in this node + * Returns the handlerList of this node */ - getGreaterToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getHandlerList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: HandlerAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } +} +/** + * GeneratedLiteralExpressionAST node. + */ +export class GeneratedLiteralExpressionAST extends ExpressionAST { /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); - } - - /** - * Returns the expression of this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), - this.parser, - ); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitGeneratedLiteralExpression(this, context); } /** - * Returns the location of the rparen token in this node + * Returns the location of the literal token in this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + getLiteralToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } } /** - * BuiltinBitCastExpressionAST node. + * CharLiteralExpressionAST node. */ -export class BuiltinBitCastExpressionAST extends ExpressionAST { +export class CharLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5294,62 +5080,29 @@ export class BuiltinBitCastExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBuiltinBitCastExpression(this, context); + return visitor.visitCharLiteralExpression(this, context); } /** - * Returns the location of the cast token in this node + * Returns the location of the literal token in this node */ - getCastToken(): Token | undefined { + getLiteralToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the typeId of this node - */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the location of the comma token in this node - */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); - } - - /** - * Returns the expression of this node - */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node + * Returns the literal attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + getLiteral(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 1); + return cxx.getLiteralValue(slot); } } /** - * BuiltinOffsetofExpressionAST node. + * BoolLiteralExpressionAST node. */ -export class BuiltinOffsetofExpressionAST extends ExpressionAST { +export class BoolLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5360,62 +5113,61 @@ export class BuiltinOffsetofExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBuiltinOffsetofExpression(this, context); + return visitor.visitBoolLiteralExpression(this, context); } /** - * Returns the location of the offsetof token in this node + * Returns the location of the literal token in this node */ - getOffsetofToken(): Token | undefined { + getLiteralToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the typeId of this node + * Returns the isTrue attribute of this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getIsTrue(): boolean { + return cxx.getASTSlot(this.getHandle(), 1) !== 0; } +} +/** + * IntLiteralExpressionAST node. + */ +export class IntLiteralExpressionAST extends ExpressionAST { /** - * Returns the location of the comma token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitIntLiteralExpression(this, context); } /** - * Returns the expression of this node + * Returns the location of the literal token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), - this.parser, - ); + getLiteralToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the literal attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + getLiteral(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 1); + return cxx.getLiteralValue(slot); } } /** - * TypeidExpressionAST node. + * FloatLiteralExpressionAST node. */ -export class TypeidExpressionAST extends ExpressionAST { +export class FloatLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5426,45 +5178,29 @@ export class TypeidExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeidExpression(this, context); + return visitor.visitFloatLiteralExpression(this, context); } /** - * Returns the location of the typeid token in this node + * Returns the location of the literal token in this node */ - getTypeidToken(): Token | undefined { + getLiteralToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the expression of this node - */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node + * Returns the literal attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getLiteral(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 1); + return cxx.getLiteralValue(slot); } } /** - * TypeidOfTypeExpressionAST node. + * NullptrLiteralExpressionAST node. */ -export class TypeidOfTypeExpressionAST extends ExpressionAST { +export class NullptrLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5475,45 +5211,28 @@ export class TypeidOfTypeExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeidOfTypeExpression(this, context); + return visitor.visitNullptrLiteralExpression(this, context); } /** - * Returns the location of the typeid token in this node + * Returns the location of the literal token in this node */ - getTypeidToken(): Token | undefined { + getLiteralToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the typeId of this node - */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); - } - - /** - * Returns the location of the rparen token in this node + * Returns the literal attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getLiteral(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 1); } } /** - * SpliceExpressionAST node. + * StringLiteralExpressionAST node. */ -export class SpliceExpressionAST extends ExpressionAST { +export class StringLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5524,24 +5243,29 @@ export class SpliceExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSpliceExpression(this, context); + return visitor.visitStringLiteralExpression(this, context); } /** - * Returns the splicer of this node + * Returns the location of the literal token in this node */ - getSplicer(): SplicerAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getLiteralToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the literal attribute of this node + */ + getLiteral(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 1); + return cxx.getLiteralValue(slot); } } /** - * GlobalScopeReflectExpressionAST node. + * UserDefinedStringLiteralExpressionAST node. */ -export class GlobalScopeReflectExpressionAST extends ExpressionAST { +export class UserDefinedStringLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5552,28 +5276,29 @@ export class GlobalScopeReflectExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitGlobalScopeReflectExpression(this, context); + return visitor.visitUserDefinedStringLiteralExpression(this, context); } /** - * Returns the location of the caret token in this node + * Returns the location of the literal token in this node */ - getCaretToken(): Token | undefined { + getLiteralToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the scope token in this node + * Returns the literal attribute of this node */ - getScopeToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getLiteral(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 1); + return cxx.getLiteralValue(slot); } } /** - * NamespaceReflectExpressionAST node. + * ObjectLiteralExpressionAST node. */ -export class NamespaceReflectExpressionAST extends ExpressionAST { +export class ObjectLiteralExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5584,36 +5309,155 @@ export class NamespaceReflectExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNamespaceReflectExpression(this, context); + return visitor.visitObjectLiteralExpression(this, context); } /** - * Returns the location of the caret token in this node + * Returns the location of the lparen token in this node */ - getCaretToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the typeId of this node */ - getIdentifierToken(): Token | undefined { + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } + + /** + * Returns the bracedInitList of this node + */ + getBracedInitList(): BracedInitListAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); + } +} + +/** + * ThisExpressionAST node. + */ +export class ThisExpressionAST extends ExpressionAST { + /** + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. + */ + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitThisExpression(this, context); + } + + /** + * Returns the location of the this token in this node + */ + getThisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } +} + +/** + * GenericSelectionExpressionAST node. + */ +export class GenericSelectionExpressionAST extends ExpressionAST { + /** + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. + */ + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitGenericSelectionExpression(this, context); + } + + /** + * Returns the location of the generic token in this node + */ + getGenericToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the identifier attribute of this node + * Returns the expression of this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 2); - return cxx.getIdentifierValue(slot); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the location of the comma token in this node + */ + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the genericAssociationList of this node + */ + getGenericAssociationList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: GenericAssociationAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } } /** - * TypeIdReflectExpressionAST node. + * NestedStatementExpressionAST node. */ -export class TypeIdReflectExpressionAST extends ExpressionAST { +export class NestedStatementExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5624,31 +5468,38 @@ export class TypeIdReflectExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeIdReflectExpression(this, context); + return visitor.visitNestedStatementExpression(this, context); } /** - * Returns the location of the caret token in this node + * Returns the location of the lparen token in this node */ - getCaretToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the typeId of this node + * Returns the statement of this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( + getStatement(): CompoundStatementAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } } /** - * ReflectExpressionAST node. + * NestedExpressionAST node. */ -export class ReflectExpressionAST extends ExpressionAST { +export class NestedExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5659,13 +5510,13 @@ export class ReflectExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitReflectExpression(this, context); + return visitor.visitNestedExpression(this, context); } /** - * Returns the location of the caret token in this node + * Returns the location of the lparen token in this node */ - getCaretToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -5678,12 +5529,19 @@ export class ReflectExpressionAST extends ExpressionAST { this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } } /** - * LabelAddressExpressionAST node. + * IdExpressionAST node. */ -export class LabelAddressExpressionAST extends ExpressionAST { +export class IdExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5694,36 +5552,312 @@ export class LabelAddressExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitLabelAddressExpression(this, context); + return visitor.visitIdExpression(this, context); } /** - * Returns the location of the ampAmp token in this node + * Returns the nestedNameSpecifier of this node */ - getAmpAmpToken(): Token | undefined { + getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); + } + + /** + * Returns the location of the template token in this node + */ + getTemplateToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the unqualifiedId of this node + */ + getUnqualifiedId(): UnqualifiedIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the isTemplateIntroduced attribute of this node + */ + getIsTemplateIntroduced(): boolean { + return cxx.getASTSlot(this.getHandle(), 3) !== 0; + } +} + +/** + * LambdaExpressionAST node. + */ +export class LambdaExpressionAST extends ExpressionAST { + /** + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. + */ + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitLambdaExpression(this, context); + } + + /** + * Returns the location of the lbracket token in this node + */ + getLbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the location of the captureDefault token in this node */ - getIdentifierToken(): Token | undefined { + getCaptureDefaultToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the identifier attribute of this node + * Returns the captureList of this node + */ + getCaptureList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: LambdaCaptureAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the rbracket token in this node + */ + getRbracketToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the location of the less token in this node + */ + getLessToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the templateParameterList of this node + */ + getTemplateParameterList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: TemplateParameterAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the greater token in this node + */ + getGreaterToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } + + /** + * Returns the templateRequiresClause of this node + */ + getTemplateRequiresClause(): RequiresClauseAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 7), + this.parser, + ); + } + + /** + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 8), this.parser); + } + + /** + * Returns the parameterDeclarationClause of this node + */ + getParameterDeclarationClause(): ParameterDeclarationClauseAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 9), + this.parser, + ); + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 10), this.parser); + } + + /** + * Returns the gnuAtributeList of this node + */ + getGnuAtributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the lambdaSpecifierList of this node + */ + getLambdaSpecifierList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: LambdaSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the exceptionSpecifier of this node + */ + getExceptionSpecifier(): ExceptionSpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 13), + this.parser, + ); + } + + /** + * Returns the attributeList of this node + */ + getAttributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the trailingReturnType of this node + */ + getTrailingReturnType(): TrailingReturnTypeAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 15), + this.parser, + ); + } + + /** + * Returns the requiresClause of this node + */ + getRequiresClause(): RequiresClauseAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 16), + this.parser, + ); + } + + /** + * Returns the statement of this node + */ + getStatement(): CompoundStatementAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 17), + this.parser, + ); + } + + /** + * Returns the captureDefault attribute of this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 2); - return cxx.getIdentifierValue(slot); + getCaptureDefault(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 18); } } /** - * UnaryExpressionAST node. + * FoldExpressionAST node. */ -export class UnaryExpressionAST extends ExpressionAST { +export class FoldExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5734,20 +5868,20 @@ export class UnaryExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitUnaryExpression(this, context); + return visitor.visitFoldExpression(this, context); } /** - * Returns the location of the op token in this node + * Returns the location of the lparen token in this node */ - getOpToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expression of this node + * Returns the leftExpression of this node */ - getExpression(): ExpressionAST | undefined { + getLeftExpression(): ExpressionAST | undefined { return AST.from( cxx.getASTSlot(this.getHandle(), 1), this.parser, @@ -5755,87 +5889,62 @@ export class UnaryExpressionAST extends ExpressionAST { } /** - * Returns the op attribute of this node + * Returns the location of the op token in this node */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 2); + getOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } -} -/** - * AwaitExpressionAST node. - */ -export class AwaitExpressionAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the ellipsis token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitAwaitExpression(this, context); + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the location of the await token in this node + * Returns the location of the foldOp token in this node */ - getAwaitToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getFoldOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); } /** - * Returns the expression of this node + * Returns the rightExpression of this node */ - getExpression(): ExpressionAST | undefined { + getRightExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } -} -/** - * SizeofExpressionAST node. - */ -export class SizeofExpressionAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the rparen token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitSizeofExpression(this, context); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); } /** - * Returns the location of the sizeof token in this node + * Returns the op attribute of this node */ - getSizeofToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 7); } /** - * Returns the expression of this node + * Returns the foldOp attribute of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getFoldOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 8); } } /** - * SizeofTypeExpressionAST node. + * RightFoldExpressionAST node. */ -export class SizeofTypeExpressionAST extends ExpressionAST { +export class RightFoldExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5846,45 +5955,59 @@ export class SizeofTypeExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSizeofTypeExpression(this, context); + return visitor.visitRightFoldExpression(this, context); } /** - * Returns the location of the sizeof token in this node + * Returns the location of the lparen token in this node */ - getSizeofToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the lparen token in this node + * Returns the expression of this node */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the typeId of this node + * Returns the location of the op token in this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + } + + /** + * Returns the location of the ellipsis token in this node + */ + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the op attribute of this node + */ + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 5); } } /** - * SizeofPackExpressionAST node. + * LeftFoldExpressionAST node. */ -export class SizeofPackExpressionAST extends ExpressionAST { +export class LeftFoldExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5895,13 +6018,13 @@ export class SizeofPackExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSizeofPackExpression(this, context); + return visitor.visitLeftFoldExpression(this, context); } /** - * Returns the location of the sizeof token in this node + * Returns the location of the lparen token in this node */ - getSizeofToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -5913,17 +6036,20 @@ export class SizeofPackExpressionAST extends ExpressionAST { } /** - * Returns the location of the lparen token in this node + * Returns the location of the op token in this node */ - getLparenToken(): Token | undefined { + getOpToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the expression of this node */ - getIdentifierToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** @@ -5934,18 +6060,17 @@ export class SizeofPackExpressionAST extends ExpressionAST { } /** - * Returns the identifier attribute of this node + * Returns the op attribute of this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 5); - return cxx.getIdentifierValue(slot); + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 5); } } /** - * AlignofTypeExpressionAST node. + * RequiresExpressionAST node. */ -export class AlignofTypeExpressionAST extends ExpressionAST { +export class RequiresExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -5956,13 +6081,13 @@ export class AlignofTypeExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAlignofTypeExpression(this, context); + return visitor.visitRequiresExpression(this, context); } /** - * Returns the location of the alignof token in this node + * Returns the location of the requires token in this node */ - getAlignofToken(): Token | undefined { + getRequiresToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -5974,10 +6099,10 @@ export class AlignofTypeExpressionAST extends ExpressionAST { } /** - * Returns the typeId of this node + * Returns the parameterDeclarationClause of this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( + getParameterDeclarationClause(): ParameterDeclarationClauseAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); @@ -5989,12 +6114,52 @@ export class AlignofTypeExpressionAST extends ExpressionAST { getRparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } + + /** + * Returns the location of the lbrace token in this node + */ + getLbraceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + + /** + * Returns the requirementList of this node + */ + getRequirementList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: RequirementAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the rbrace token in this node + */ + getRbraceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } } /** - * AlignofExpressionAST node. + * VaArgExpressionAST node. */ -export class AlignofExpressionAST extends ExpressionAST { +export class VaArgExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6005,31 +6170,62 @@ export class AlignofExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAlignofExpression(this, context); + return visitor.visitVaArgExpression(this, context); } /** - * Returns the location of the alignof token in this node + * Returns the location of the vaArg token in this node */ - getAlignofToken(): Token | undefined { + getVaArgToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expression of this node + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the expression of this node + */ + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the location of the comma token in this node + */ + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the typeId of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + } } /** - * NoexceptExpressionAST node. + * SubscriptExpressionAST node. */ -export class NoexceptExpressionAST extends ExpressionAST { +export class SubscriptExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6040,27 +6236,30 @@ export class NoexceptExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNoexceptExpression(this, context); + return visitor.visitSubscriptExpression(this, context); } /** - * Returns the location of the noexcept token in this node + * Returns the baseExpression of this node */ - getNoexceptToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getBaseExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the location of the lparen token in this node + * Returns the location of the lbracket token in this node */ - getLparenToken(): Token | undefined { + getLbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the expression of this node + * Returns the indexExpression of this node */ - getExpression(): ExpressionAST | undefined { + getIndexExpression(): ExpressionAST | undefined { return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, @@ -6068,17 +6267,17 @@ export class NoexceptExpressionAST extends ExpressionAST { } /** - * Returns the location of the rparen token in this node + * Returns the location of the rbracket token in this node */ - getRparenToken(): Token | undefined { + getRbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * NewExpressionAST node. + * CallExpressionAST node. */ -export class NewExpressionAST extends ExpressionAST { +export class CallExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6089,29 +6288,15 @@ export class NewExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNewExpression(this, context); - } - - /** - * Returns the location of the scope token in this node - */ - getScopeToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the location of the new token in this node - */ - getNewToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + return visitor.visitCallExpression(this, context); } /** - * Returns the newPlacement of this node + * Returns the baseExpression of this node */ - getNewPlacement(): NewPlacementAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + getBaseExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } @@ -6120,22 +6305,22 @@ export class NewExpressionAST extends ExpressionAST { * Returns the location of the lparen token in this node */ getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the typeSpecifierList of this node + * Returns the expressionList of this node */ - getTypeSpecifierList(): Iterable { + getExpressionList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: SpecifierAST | undefined; + let value: ExpressionAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -6149,38 +6334,18 @@ export class NewExpressionAST extends ExpressionAST { }; } - /** - * Returns the declarator of this node - */ - getDeclarator(): DeclaratorAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), - this.parser, - ); - } - /** * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); - } - - /** - * Returns the newInitalizer of this node - */ - getNewInitalizer(): NewInitializerAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 7), - this.parser, - ); + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * DeleteExpressionAST node. + * TypeConstructionAST node. */ -export class DeleteExpressionAST extends ExpressionAST { +export class TypeConstructionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6191,52 +6356,64 @@ export class DeleteExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDeleteExpression(this, context); + return visitor.visitTypeConstruction(this, context); } /** - * Returns the location of the scope token in this node + * Returns the typeSpecifier of this node */ - getScopeToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getTypeSpecifier(): SpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the location of the delete token in this node + * Returns the location of the lparen token in this node */ - getDeleteToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the lbracket token in this node + * Returns the expressionList of this node */ - getLbracketToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getExpressionList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: ExpressionAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the location of the rbracket token in this node + * Returns the location of the rparen token in this node */ - getRbracketToken(): Token | undefined { + getRparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } - - /** - * Returns the expression of this node - */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 4), - this.parser, - ); - } } /** - * CastExpressionAST node. + * BracedTypeConstructionAST node. */ -export class CastExpressionAST extends ExpressionAST { +export class BracedTypeConstructionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6247,48 +6424,34 @@ export class CastExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitCastExpression(this, context); - } - - /** - * Returns the location of the lparen token in this node - */ - getLparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + return visitor.visitBracedTypeConstruction(this, context); } /** - * Returns the typeId of this node + * Returns the typeSpecifier of this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + getTypeSpecifier(): SpecifierAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } /** - * Returns the location of the rparen token in this node - */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the expression of this node + * Returns the bracedInitList of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), + getBracedInitList(): BracedInitListAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } } /** - * ImplicitCastExpressionAST node. + * SpliceMemberExpressionAST node. */ -export class ImplicitCastExpressionAST extends ExpressionAST { +export class SpliceMemberExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6299,76 +6462,62 @@ export class ImplicitCastExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitImplicitCastExpression(this, context); + return visitor.visitSpliceMemberExpression(this, context); } /** - * Returns the expression of this node + * Returns the baseExpression of this node */ - getExpression(): ExpressionAST | undefined { + getBaseExpression(): ExpressionAST | undefined { return AST.from( cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } -} -/** - * BinaryExpressionAST node. - */ -export class BinaryExpressionAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the access token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitBinaryExpression(this, context); + getAccessToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the leftExpression of this node + * Returns the location of the template token in this node */ - getLeftExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getTemplateToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the op token in this node + * Returns the splicer of this node */ - getOpToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getSplicer(): SplicerAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } /** - * Returns the rightExpression of this node + * Returns the accessOp attribute of this node */ - getRightExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getAccessOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 4); } /** - * Returns the op attribute of this node + * Returns the isTemplateIntroduced attribute of this node */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 3); + getIsTemplateIntroduced(): boolean { + return cxx.getASTSlot(this.getHandle(), 5) !== 0; } } /** - * ConditionalExpressionAST node. + * MemberExpressionAST node. */ -export class ConditionalExpressionAST extends ExpressionAST { +export class MemberExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6379,13 +6528,13 @@ export class ConditionalExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitConditionalExpression(this, context); + return visitor.visitMemberExpression(this, context); } /** - * Returns the condition of this node + * Returns the baseExpression of this node */ - getCondition(): ExpressionAST | undefined { + getBaseExpression(): ExpressionAST | undefined { return AST.from( cxx.getASTSlot(this.getHandle(), 0), this.parser, @@ -6393,44 +6542,58 @@ export class ConditionalExpressionAST extends ExpressionAST { } /** - * Returns the location of the question token in this node + * Returns the location of the access token in this node */ - getQuestionToken(): Token | undefined { + getAccessToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the iftrueExpression of this node + * Returns the nestedNameSpecifier of this node */ - getIftrueExpression(): ExpressionAST | undefined { - return AST.from( + getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the colon token in this node + * Returns the location of the template token in this node */ - getColonToken(): Token | undefined { + getTemplateToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the iffalseExpression of this node + * Returns the unqualifiedId of this node */ - getIffalseExpression(): ExpressionAST | undefined { - return AST.from( + getUnqualifiedId(): UnqualifiedIdAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 4), this.parser, ); } + + /** + * Returns the accessOp attribute of this node + */ + getAccessOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 5); + } + + /** + * Returns the isTemplateIntroduced attribute of this node + */ + getIsTemplateIntroduced(): boolean { + return cxx.getASTSlot(this.getHandle(), 6) !== 0; + } } /** - * YieldExpressionAST node. + * PostIncrExpressionAST node. */ -export class YieldExpressionAST extends ExpressionAST { +export class PostIncrExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6441,31 +6604,38 @@ export class YieldExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitYieldExpression(this, context); + return visitor.visitPostIncrExpression(this, context); } /** - * Returns the location of the yield token in this node + * Returns the baseExpression of this node */ - getYieldToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getBaseExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the expression of this node + * Returns the location of the op token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the op attribute of this node + */ + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 2); } } /** - * ThrowExpressionAST node. + * CppCastExpressionAST node. */ -export class ThrowExpressionAST extends ExpressionAST { +export class CppCastExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6476,31 +6646,69 @@ export class ThrowExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitThrowExpression(this, context); + return visitor.visitCppCastExpression(this, context); } /** - * Returns the location of the throw token in this node + * Returns the location of the cast token in this node */ - getThrowToken(): Token | undefined { + getCastToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } + /** + * Returns the location of the less token in this node + */ + getLessToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the typeId of this node + */ + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the location of the greater token in this node + */ + getGreaterToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + } + /** * Returns the expression of this node */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } } /** - * AssignmentExpressionAST node. + * BuiltinBitCastExpressionAST node. */ -export class AssignmentExpressionAST extends ExpressionAST { +export class BuiltinBitCastExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6511,48 +6719,62 @@ export class AssignmentExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAssignmentExpression(this, context); + return visitor.visitBuiltinBitCastExpression(this, context); } /** - * Returns the leftExpression of this node + * Returns the location of the cast token in this node */ - getLeftExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), + getCastToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the typeId of this node + */ + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the op token in this node + * Returns the location of the comma token in this node */ - getOpToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the rightExpression of this node + * Returns the expression of this node */ - getRightExpression(): ExpressionAST | undefined { + getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + cxx.getASTSlot(this.getHandle(), 4), this.parser, ); } /** - * Returns the op attribute of this node + * Returns the location of the rparen token in this node */ - getOp(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 3); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); } } /** - * PackExpansionExpressionAST node. + * BuiltinOffsetofExpressionAST node. */ -export class PackExpansionExpressionAST extends ExpressionAST { +export class BuiltinOffsetofExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6563,85 +6785,62 @@ export class PackExpansionExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitPackExpansionExpression(this, context); + return visitor.visitBuiltinOffsetofExpression(this, context); } /** - * Returns the expression of this node + * Returns the location of the offsetof token in this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getOffsetofToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the ellipsis token in this node + * Returns the location of the lparen token in this node */ - getEllipsisToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } -} -/** - * DesignatedInitializerClauseAST node. - */ -export class DesignatedInitializerClauseAST extends ExpressionAST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the typeId of this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitDesignatedInitializerClause(this, context); + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } /** - * Returns the designatorList of this node + * Returns the location of the comma token in this node */ - getDesignatorList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: DesignatorAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the initializer of this node + * Returns the expression of this node */ - getInitializer(): ExpressionAST | undefined { + getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + cxx.getASTSlot(this.getHandle(), 4), this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + } } /** - * TypeTraitExpressionAST node. + * TypeidExpressionAST node. */ -export class TypeTraitExpressionAST extends ExpressionAST { +export class TypeidExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6652,13 +6851,13 @@ export class TypeTraitExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeTraitExpression(this, context); + return visitor.visitTypeidExpression(this, context); } /** - * Returns the location of the typeTrait token in this node + * Returns the location of the typeid token in this node */ - getTypeTraitToken(): Token | undefined { + getTypeidToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -6670,29 +6869,13 @@ export class TypeTraitExpressionAST extends ExpressionAST { } /** - * Returns the typeIdList of this node + * Returns the expression of this node */ - getTypeIdList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: TypeIdAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } /** @@ -6704,9 +6887,9 @@ export class TypeTraitExpressionAST extends ExpressionAST { } /** - * ConditionExpressionAST node. + * TypeidOfTypeExpressionAST node. */ -export class ConditionExpressionAST extends ExpressionAST { +export class TypeidOfTypeExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6717,86 +6900,45 @@ export class ConditionExpressionAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitConditionExpression(this, context); + return visitor.visitTypeidOfTypeExpression(this, context); } /** - * Returns the attributeList of this node + * Returns the location of the typeid token in this node */ - getAttributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getTypeidToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the declSpecifierList of this node + * Returns the location of the lparen token in this node */ - getDeclSpecifierList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: SpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the declarator of this node + * Returns the typeId of this node */ - getDeclarator(): DeclaratorAST | undefined { - return AST.from( + getTypeId(): TypeIdAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the initializer of this node + * Returns the location of the rparen token in this node */ - getInitializer(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * EqualInitializerAST node. + * SpliceExpressionAST node. */ -export class EqualInitializerAST extends ExpressionAST { +export class SpliceExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6807,31 +6949,24 @@ export class EqualInitializerAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitEqualInitializer(this, context); - } - - /** - * Returns the location of the equal token in this node - */ - getEqualToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + return visitor.visitSpliceExpression(this, context); } /** - * Returns the expression of this node + * Returns the splicer of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + getSplicer(): SplicerAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } } /** - * BracedInitListAST node. + * GlobalScopeReflectExpressionAST node. */ -export class BracedInitListAST extends ExpressionAST { +export class GlobalScopeReflectExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6842,61 +6977,28 @@ export class BracedInitListAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBracedInitList(this, context); + return visitor.visitGlobalScopeReflectExpression(this, context); } /** - * Returns the location of the lbrace token in this node + * Returns the location of the caret token in this node */ - getLbraceToken(): Token | undefined { + getCaretToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expressionList of this node - */ - getExpressionList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ExpressionAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the location of the comma token in this node - */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the location of the rbrace token in this node + * Returns the location of the scope token in this node */ - getRbraceToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + getScopeToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } } /** - * ParenInitializerAST node. + * NamespaceReflectExpressionAST node. */ -export class ParenInitializerAST extends ExpressionAST { +export class NamespaceReflectExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6907,54 +7009,36 @@ export class ParenInitializerAST extends ExpressionAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitParenInitializer(this, context); + return visitor.visitNamespaceReflectExpression(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the caret token in this node */ - getLparenToken(): Token | undefined { + getCaretToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expressionList of this node + * Returns the location of the identifier token in this node */ - getExpressionList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ExpressionAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the identifier attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 2); + return cxx.getIdentifierValue(slot); } } /** - * DefaultGenericAssociationAST node. + * TypeIdReflectExpressionAST node. */ -export class DefaultGenericAssociationAST extends GenericAssociationAST { +export class TypeIdReflectExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -6965,38 +7049,31 @@ export class DefaultGenericAssociationAST extends GenericAssociationAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDefaultGenericAssociation(this, context); + return visitor.visitTypeIdReflectExpression(this, context); } /** - * Returns the location of the default token in this node + * Returns the location of the caret token in this node */ - getDefaultToken(): Token | undefined { + getCaretToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the colon token in this node - */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the expression of this node + * Returns the typeId of this node */ - getExpression(): ExpressionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } } /** - * TypeGenericAssociationAST node. + * ReflectExpressionAST node. */ -export class TypeGenericAssociationAST extends GenericAssociationAST { +export class ReflectExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7007,24 +7084,14 @@ export class TypeGenericAssociationAST extends GenericAssociationAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeGenericAssociation(this, context); - } - - /** - * Returns the typeId of this node - */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + return visitor.visitReflectExpression(this, context); } /** - * Returns the location of the colon token in this node + * Returns the location of the caret token in this node */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getCaretToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** @@ -7032,16 +7099,16 @@ export class TypeGenericAssociationAST extends GenericAssociationAST { */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 2), + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } } /** - * DotDesignatorAST node. + * LabelAddressExpressionAST node. */ -export class DotDesignatorAST extends DesignatorAST { +export class LabelAddressExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7052,13 +7119,13 @@ export class DotDesignatorAST extends DesignatorAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitDotDesignator(this, context); + return visitor.visitLabelAddressExpression(this, context); } /** - * Returns the location of the dot token in this node + * Returns the location of the ampAmp token in this node */ - getDotToken(): Token | undefined { + getAmpAmpToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -7079,9 +7146,9 @@ export class DotDesignatorAST extends DesignatorAST { } /** - * SubscriptDesignatorAST node. + * UnaryExpressionAST node. */ -export class SubscriptDesignatorAST extends DesignatorAST { +export class UnaryExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7092,13 +7159,13 @@ export class SubscriptDesignatorAST extends DesignatorAST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSubscriptDesignator(this, context); + return visitor.visitUnaryExpression(this, context); } /** - * Returns the location of the lbracket token in this node + * Returns the location of the op token in this node */ - getLbracketToken(): Token | undefined { + getOpToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } @@ -7113,17 +7180,17 @@ export class SubscriptDesignatorAST extends DesignatorAST { } /** - * Returns the location of the rbracket token in this node + * Returns the op attribute of this node */ - getRbracketToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 2); } } /** - * SplicerAST node. + * AwaitExpressionAST node. */ -export class SplicerAST extends AST { +export class AwaitExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7134,117 +7201,31 @@ export class SplicerAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitSplicer(this, context); + return visitor.visitAwaitExpression(this, context); } /** - * Returns the location of the lbracket token in this node + * Returns the location of the await token in this node */ - getLbracketToken(): Token | undefined { + getAwaitToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } - /** - * Returns the location of the colon token in this node - */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the location of the ellipsis token in this node - */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - /** * Returns the expression of this node */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 3), + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } - - /** - * Returns the location of the secondColon token in this node - */ - getSecondColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); - } - - /** - * Returns the location of the rbracket token in this node - */ - getRbracketToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); - } -} - -/** - * GlobalModuleFragmentAST node. - */ -export class GlobalModuleFragmentAST extends AST { - /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. - */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitGlobalModuleFragment(this, context); - } - - /** - * Returns the location of the module token in this node - */ - getModuleToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); - } - - /** - * Returns the location of the semicolon token in this node - */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the declarationList of this node - */ - getDeclarationList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: DeclarationAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } } /** - * PrivateModuleFragmentAST node. + * SizeofExpressionAST node. */ -export class PrivateModuleFragmentAST extends AST { +export class SizeofExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7255,68 +7236,31 @@ export class PrivateModuleFragmentAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitPrivateModuleFragment(this, context); + return visitor.visitSizeofExpression(this, context); } /** - * Returns the location of the module token in this node + * Returns the location of the sizeof token in this node */ - getModuleToken(): Token | undefined { + getSizeofToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the colon token in this node - */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the location of the private token in this node - */ - getPrivateToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the location of the semicolon token in this node - */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); - } - - /** - * Returns the declarationList of this node + * Returns the expression of this node */ - getDeclarationList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: DeclarationAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } } /** - * ModuleDeclarationAST node. + * SizeofTypeExpressionAST node. */ -export class ModuleDeclarationAST extends AST { +export class SizeofTypeExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7327,81 +7271,45 @@ export class ModuleDeclarationAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitModuleDeclaration(this, context); + return visitor.visitSizeofTypeExpression(this, context); } /** - * Returns the location of the export token in this node + * Returns the location of the sizeof token in this node */ - getExportToken(): Token | undefined { + getSizeofToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the module token in this node + * Returns the location of the lparen token in this node */ - getModuleToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the moduleName of this node + * Returns the typeId of this node */ - getModuleName(): ModuleNameAST | undefined { - return AST.from( + getTypeId(): TypeIdAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the modulePartition of this node - */ - getModulePartition(): ModulePartitionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); - } - - /** - * Returns the attributeList of this node - */ - getAttributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; - } - - /** - * Returns the location of the semicolon token in this node + * Returns the location of the rparen token in this node */ - getSemicolonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 5), this.parser); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * ModuleNameAST node. + * SizeofPackExpressionAST node. */ -export class ModuleNameAST extends AST { +export class SizeofPackExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7412,39 +7320,57 @@ export class ModuleNameAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitModuleName(this, context); + return visitor.visitSizeofPackExpression(this, context); } /** - * Returns the moduleQualifier of this node + * Returns the location of the sizeof token in this node */ - getModuleQualifier(): ModuleQualifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getSizeofToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the location of the ellipsis token in this node + */ + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the location of the lparen token in this node + */ + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** * Returns the location of the identifier token in this node */ getIdentifierToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); } /** * Returns the identifier attribute of this node */ getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 2); + const slot = cxx.getASTSlot(this.getHandle(), 5); return cxx.getIdentifierValue(slot); } } /** - * ModuleQualifierAST node. + * AlignofTypeExpressionAST node. */ -export class ModuleQualifierAST extends AST { +export class AlignofTypeExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7455,46 +7381,45 @@ export class ModuleQualifierAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitModuleQualifier(this, context); + return visitor.visitAlignofTypeExpression(this, context); } /** - * Returns the moduleQualifier of this node + * Returns the location of the alignof token in this node */ - getModuleQualifier(): ModuleQualifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getAlignofToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the location of the lparen token in this node */ - getIdentifierToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the dot token in this node + * Returns the typeId of this node */ - getDotToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } /** - * Returns the identifier attribute of this node + * Returns the location of the rparen token in this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 3); - return cxx.getIdentifierValue(slot); + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * ModulePartitionAST node. + * AlignofExpressionAST node. */ -export class ModulePartitionAST extends AST { +export class AlignofExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7505,21 +7430,21 @@ export class ModulePartitionAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitModulePartition(this, context); + return visitor.visitAlignofExpression(this, context); } /** - * Returns the location of the colon token in this node + * Returns the location of the alignof token in this node */ - getColonToken(): Token | undefined { + getAlignofToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the moduleName of this node + * Returns the expression of this node */ - getModuleName(): ModuleNameAST | undefined { - return AST.from( + getExpression(): ExpressionAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 1), this.parser, ); @@ -7527,9 +7452,9 @@ export class ModulePartitionAST extends AST { } /** - * ImportNameAST node. + * NoexceptExpressionAST node. */ -export class ImportNameAST extends AST { +export class NoexceptExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7540,41 +7465,45 @@ export class ImportNameAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitImportName(this, context); + return visitor.visitNoexceptExpression(this, context); } /** - * Returns the location of the header token in this node + * Returns the location of the noexcept token in this node */ - getHeaderToken(): Token | undefined { + getNoexceptToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the modulePartition of this node + * Returns the location of the lparen token in this node */ - getModulePartition(): ModulePartitionAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the moduleName of this node + * Returns the expression of this node */ - getModuleName(): ModuleNameAST | undefined { - return AST.from( + getExpression(): ExpressionAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); + } } /** - * InitDeclaratorAST node. + * NewExpressionAST node. */ -export class InitDeclaratorAST extends AST { +export class NewExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7585,70 +7514,53 @@ export class InitDeclaratorAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitInitDeclarator(this, context); + return visitor.visitNewExpression(this, context); } /** - * Returns the declarator of this node + * Returns the location of the scope token in this node */ - getDeclarator(): DeclaratorAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getScopeToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the requiresClause of this node + * Returns the location of the new token in this node */ - getRequiresClause(): RequiresClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getNewToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the initializer of this node + * Returns the newPlacement of this node */ - getInitializer(): ExpressionAST | undefined { - return AST.from( + getNewPlacement(): NewPlacementAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } -} -/** - * DeclaratorAST node. - */ -export class DeclaratorAST extends AST { /** - * Traverse this node using the given visitor. - * @param visitor the visitor. - * @param context the context. - * @returns the result of the visit. + * Returns the location of the lparen token in this node */ - accept( - visitor: ASTVisitor, - context: Context, - ): Result { - return visitor.visitDeclarator(this, context); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the ptrOpList of this node + * Returns the typeSpecifierList of this node */ - getPtrOpList(): Iterable { + getTypeSpecifierList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: PtrOperatorAST | undefined; + let value: SpecifierAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -7663,46 +7575,37 @@ export class DeclaratorAST extends AST { } /** - * Returns the coreDeclarator of this node + * Returns the declarator of this node */ - getCoreDeclarator(): CoreDeclaratorAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + getDeclarator(): DeclaratorAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 5), this.parser, ); } /** - * Returns the declaratorChunkList of this node + * Returns the location of the rparen token in this node */ - getDeclaratorChunkList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: DeclaratorChunkAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + } + + /** + * Returns the newInitalizer of this node + */ + getNewInitalizer(): NewInitializerAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 7), + this.parser, + ); } } /** - * UsingDeclaratorAST node. + * DeleteExpressionAST node. */ -export class UsingDeclaratorAST extends AST { +export class DeleteExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7713,55 +7616,52 @@ export class UsingDeclaratorAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitUsingDeclarator(this, context); + return visitor.visitDeleteExpression(this, context); } /** - * Returns the location of the typename token in this node + * Returns the location of the scope token in this node */ - getTypenameToken(): Token | undefined { + getScopeToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the nestedNameSpecifier of this node + * Returns the location of the delete token in this node */ - getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getDeleteToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the unqualifiedId of this node + * Returns the location of the lbracket token in this node */ - getUnqualifiedId(): UnqualifiedIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 2), - this.parser, - ); + getLbracketToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the location of the ellipsis token in this node + * Returns the location of the rbracket token in this node */ - getEllipsisToken(): Token | undefined { + getRbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the isPack attribute of this node + * Returns the expression of this node */ - getIsPack(): boolean { - return cxx.getASTSlot(this.getHandle(), 4) !== 0; + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 4), + this.parser, + ); } } /** - * EnumeratorAST node. + * CastExpressionAST node. */ -export class EnumeratorAST extends AST { +export class CastExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7772,46 +7672,30 @@ export class EnumeratorAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitEnumerator(this, context); + return visitor.visitCastExpression(this, context); } /** - * Returns the location of the identifier token in this node + * Returns the location of the lparen token in this node */ - getIdentifierToken(): Token | undefined { + getLparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the attributeList of this node + * Returns the typeId of this node */ - getAttributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the location of the equal token in this node + * Returns the location of the rparen token in this node */ - getEqualToken(): Token | undefined { + getRparenToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } @@ -7824,20 +7708,40 @@ export class EnumeratorAST extends AST { this.parser, ); } +} +/** + * ImplicitCastExpressionAST node. + */ +export class ImplicitCastExpressionAST extends ExpressionAST { /** - * Returns the identifier attribute of this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 4); - return cxx.getIdentifierValue(slot); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitImplicitCastExpression(this, context); + } + + /** + * Returns the expression of this node + */ + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } } /** - * TypeIdAST node. + * BinaryExpressionAST node. */ -export class TypeIdAST extends AST { +export class BinaryExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7848,50 +7752,48 @@ export class TypeIdAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeId(this, context); + return visitor.visitBinaryExpression(this, context); } /** - * Returns the typeSpecifierList of this node + * Returns the leftExpression of this node */ - getTypeSpecifierList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: SpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getLeftExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the declarator of this node + * Returns the location of the op token in this node */ - getDeclarator(): DeclaratorAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + getOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the rightExpression of this node + */ + getRightExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } + + /** + * Returns the op attribute of this node + */ + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 3); + } } /** - * HandlerAST node. + * ConditionalExpressionAST node. */ -export class HandlerAST extends AST { +export class ConditionalExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7902,45 +7804,48 @@ export class HandlerAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitHandler(this, context); + return visitor.visitConditionalExpression(this, context); } /** - * Returns the location of the catch token in this node + * Returns the condition of this node */ - getCatchToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getCondition(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the location of the lparen token in this node + * Returns the location of the question token in this node */ - getLparenToken(): Token | undefined { + getQuestionToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the exceptionDeclaration of this node + * Returns the iftrueExpression of this node */ - getExceptionDeclaration(): ExceptionDeclarationAST | undefined { - return AST.from( + getIftrueExpression(): ExpressionAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 2), this.parser, ); } /** - * Returns the location of the rparen token in this node + * Returns the location of the colon token in this node */ - getRparenToken(): Token | undefined { + getColonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } /** - * Returns the statement of this node + * Returns the iffalseExpression of this node */ - getStatement(): CompoundStatementAST | undefined { - return AST.from( + getIffalseExpression(): ExpressionAST | undefined { + return AST.from( cxx.getASTSlot(this.getHandle(), 4), this.parser, ); @@ -7948,9 +7853,9 @@ export class HandlerAST extends AST { } /** - * BaseSpecifierAST node. + * YieldExpressionAST node. */ -export class BaseSpecifierAST extends AST { +export class YieldExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -7961,116 +7866,118 @@ export class BaseSpecifierAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitBaseSpecifier(this, context); - } - - /** - * Returns the attributeList of this node - */ - getAttributeList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: AttributeSpecifierAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + return visitor.visitYieldExpression(this, context); } /** - * Returns the location of the virtualOrAccess token in this node + * Returns the location of the yield token in this node */ - getVirtualOrAccessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getYieldToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the otherVirtualOrAccess token in this node + * Returns the expression of this node */ - getOtherVirtualOrAccessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } +} +/** + * ThrowExpressionAST node. + */ +export class ThrowExpressionAST extends ExpressionAST { /** - * Returns the nestedNameSpecifier of this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 3), - this.parser, - ); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitThrowExpression(this, context); } /** - * Returns the location of the template token in this node + * Returns the location of the throw token in this node */ - getTemplateToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + getThrowToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the unqualifiedId of this node + * Returns the expression of this node */ - getUnqualifiedId(): UnqualifiedIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 5), + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } +} +/** + * AssignmentExpressionAST node. + */ +export class AssignmentExpressionAST extends ExpressionAST { /** - * Returns the location of the ellipsis token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 6), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitAssignmentExpression(this, context); } /** - * Returns the isTemplateIntroduced attribute of this node + * Returns the leftExpression of this node */ - getIsTemplateIntroduced(): boolean { - return cxx.getASTSlot(this.getHandle(), 7) !== 0; + getLeftExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the isVirtual attribute of this node + * Returns the location of the op token in this node */ - getIsVirtual(): boolean { - return cxx.getASTSlot(this.getHandle(), 8) !== 0; + getOpToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the isVariadic attribute of this node + * Returns the rightExpression of this node */ - getIsVariadic(): boolean { - return cxx.getASTSlot(this.getHandle(), 9) !== 0; + getRightExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } /** - * Returns the accessSpecifier attribute of this node + * Returns the op attribute of this node */ - getAccessSpecifier(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 10); + getOp(): TokenKind { + return cxx.getASTSlot(this.getHandle(), 3); } } /** - * RequiresClauseAST node. + * PackExpansionExpressionAST node. */ -export class RequiresClauseAST extends AST { +export class PackExpansionExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8081,14 +7988,7 @@ export class RequiresClauseAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitRequiresClause(this, context); - } - - /** - * Returns the location of the requires token in this node - */ - getRequiresToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + return visitor.visitPackExpansionExpression(this, context); } /** @@ -8096,16 +7996,23 @@ export class RequiresClauseAST extends AST { */ getExpression(): ExpressionAST | undefined { return AST.from( - cxx.getASTSlot(this.getHandle(), 1), + cxx.getASTSlot(this.getHandle(), 0), this.parser, ); } + + /** + * Returns the location of the ellipsis token in this node + */ + getEllipsisToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } } /** - * ParameterDeclarationClauseAST node. + * DesignatedInitializerClauseAST node. */ -export class ParameterDeclarationClauseAST extends AST { +export class DesignatedInitializerClauseAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8116,22 +8023,22 @@ export class ParameterDeclarationClauseAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitParameterDeclarationClause(this, context); + return visitor.visitDesignatedInitializerClause(this, context); } /** - * Returns the parameterDeclarationList of this node + * Returns the designatorList of this node */ - getParameterDeclarationList(): Iterable { + getDesignatorList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ParameterDeclarationAST | undefined; + let value: DesignatorAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -8146,31 +8053,20 @@ export class ParameterDeclarationClauseAST extends AST { } /** - * Returns the location of the comma token in this node - */ - getCommaToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); - } - - /** - * Returns the location of the ellipsis token in this node - */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); - } - - /** - * Returns the isVariadic attribute of this node + * Returns the initializer of this node */ - getIsVariadic(): boolean { - return cxx.getASTSlot(this.getHandle(), 3) !== 0; + getInitializer(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } } /** - * TrailingReturnTypeAST node. + * TypeTraitExpressionAST node. */ -export class TrailingReturnTypeAST extends AST { +export class TypeTraitExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8181,31 +8077,61 @@ export class TrailingReturnTypeAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTrailingReturnType(this, context); + return visitor.visitTypeTraitExpression(this, context); } /** - * Returns the location of the minusGreater token in this node + * Returns the location of the typeTrait token in this node */ - getMinusGreaterToken(): Token | undefined { + getTypeTraitToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the typeId of this node + * Returns the location of the lparen token in this node */ - getTypeId(): TypeIdAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getLparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + } + + /** + * Returns the typeIdList of this node + */ + getTypeIdList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: TypeIdAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the location of the rparen token in this node + */ + getRparenToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * LambdaSpecifierAST node. + * ConditionExpressionAST node. */ -export class LambdaSpecifierAST extends AST { +export class ConditionExpressionAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8216,28 +8142,86 @@ export class LambdaSpecifierAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitLambdaSpecifier(this, context); + return visitor.visitConditionExpression(this, context); } /** - * Returns the location of the specifier token in this node + * Returns the attributeList of this node */ - getSpecifierToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getAttributeList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: AttributeSpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; } /** - * Returns the specifier attribute of this node + * Returns the declSpecifierList of this node */ - getSpecifier(): TokenKind { - return cxx.getASTSlot(this.getHandle(), 1); + getDeclSpecifierList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: SpecifierAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + + /** + * Returns the declarator of this node + */ + getDeclarator(): DeclaratorAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); + } + + /** + * Returns the initializer of this node + */ + getInitializer(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 3), + this.parser, + ); } } /** - * TypeConstraintAST node. + * EqualInitializerAST node. */ -export class TypeConstraintAST extends AST { +export class EqualInitializerAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8248,46 +8232,64 @@ export class TypeConstraintAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitTypeConstraint(this, context); + return visitor.visitEqualInitializer(this, context); } /** - * Returns the nestedNameSpecifier of this node + * Returns the location of the equal token in this node */ - getNestedNameSpecifier(): NestedNameSpecifierAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), + getEqualToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + } + + /** + * Returns the expression of this node + */ + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), this.parser, ); } +} +/** + * BracedInitListAST node. + */ +export class BracedInitListAST extends ExpressionAST { /** - * Returns the location of the identifier token in this node + * Traverse this node using the given visitor. + * @param visitor the visitor. + * @param context the context. + * @returns the result of the visit. */ - getIdentifierToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + accept( + visitor: ASTVisitor, + context: Context, + ): Result { + return visitor.visitBracedInitList(this, context); } /** - * Returns the location of the less token in this node + * Returns the location of the lbrace token in this node */ - getLessToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getLbraceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the templateArgumentList of this node + * Returns the expressionList of this node */ - getTemplateArgumentList(): Iterable { + getExpressionList(): Iterable { let it = cxx.getASTSlot(this.getHandle(), 0); - let value: TemplateArgumentAST | undefined; + let value: ExpressionAST | undefined; let done = false; const p = this.parser; function advance() { done = it === 0; if (done) return; const ast = cxx.getListValue(it); - value = AST.from(ast, p); + value = AST.from(ast, p); it = cxx.getListNext(it); } function next() { @@ -8302,25 +8304,24 @@ export class TypeConstraintAST extends AST { } /** - * Returns the location of the greater token in this node + * Returns the location of the comma token in this node */ - getGreaterToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 4), this.parser); + getCommaToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } /** - * Returns the identifier attribute of this node + * Returns the location of the rbrace token in this node */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 5); - return cxx.getIdentifierValue(slot); + getRbraceToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 3), this.parser); } } /** - * AttributeArgumentClauseAST node. + * ParenInitializerAST node. */ -export class AttributeArgumentClauseAST extends AST { +export class ParenInitializerAST extends ExpressionAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8331,7 +8332,7 @@ export class AttributeArgumentClauseAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAttributeArgumentClause(this, context); + return visitor.visitParenInitializer(this, context); } /** @@ -8341,18 +8342,44 @@ export class AttributeArgumentClauseAST extends AST { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } + /** + * Returns the expressionList of this node + */ + getExpressionList(): Iterable { + let it = cxx.getASTSlot(this.getHandle(), 0); + let value: ExpressionAST | undefined; + let done = false; + const p = this.parser; + function advance() { + done = it === 0; + if (done) return; + const ast = cxx.getListValue(it); + value = AST.from(ast, p); + it = cxx.getListNext(it); + } + function next() { + advance(); + return { done, value }; + } + return { + [Symbol.iterator]() { + return { next }; + }, + }; + } + /** * Returns the location of the rparen token in this node */ getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } } /** - * AttributeAST node. + * DefaultGenericAssociationAST node. */ -export class AttributeAST extends AST { +export class DefaultGenericAssociationAST extends GenericAssociationAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8363,41 +8390,38 @@ export class AttributeAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAttribute(this, context); + return visitor.visitDefaultGenericAssociation(this, context); } /** - * Returns the attributeToken of this node + * Returns the location of the default token in this node */ - getAttributeToken(): AttributeTokenAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 0), - this.parser, - ); + getDefaultToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the attributeArgumentClause of this node + * Returns the location of the colon token in this node */ - getAttributeArgumentClause(): AttributeArgumentClauseAST | undefined { - return AST.from( - cxx.getASTSlot(this.getHandle(), 1), - this.parser, - ); + getColonToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the ellipsis token in this node + * Returns the expression of this node */ - getEllipsisToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } } /** - * AttributeUsingPrefixAST node. + * TypeGenericAssociationAST node. */ -export class AttributeUsingPrefixAST extends AST { +export class TypeGenericAssociationAST extends GenericAssociationAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8408,35 +8432,41 @@ export class AttributeUsingPrefixAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitAttributeUsingPrefix(this, context); + return visitor.visitTypeGenericAssociation(this, context); } /** - * Returns the location of the using token in this node + * Returns the typeId of this node */ - getUsingToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); + getTypeId(): TypeIdAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 0), + this.parser, + ); } /** - * Returns the location of the attributeNamespace token in this node + * Returns the location of the colon token in this node */ - getAttributeNamespaceToken(): Token | undefined { + getColonToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the colon token in this node + * Returns the expression of this node */ - getColonToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 2), + this.parser, + ); } } /** - * NewPlacementAST node. + * DotDesignatorAST node. */ -export class NewPlacementAST extends AST { +export class DotDesignatorAST extends DesignatorAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8447,54 +8477,36 @@ export class NewPlacementAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNewPlacement(this, context); + return visitor.visitDotDesignator(this, context); } /** - * Returns the location of the lparen token in this node + * Returns the location of the dot token in this node */ - getLparenToken(): Token | undefined { + getDotToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the expressionList of this node + * Returns the location of the identifier token in this node */ - getExpressionList(): Iterable { - let it = cxx.getASTSlot(this.getHandle(), 0); - let value: ExpressionAST | undefined; - let done = false; - const p = this.parser; - function advance() { - done = it === 0; - if (done) return; - const ast = cxx.getListValue(it); - value = AST.from(ast, p); - it = cxx.getListNext(it); - } - function next() { - advance(); - return { done, value }; - } - return { - [Symbol.iterator]() { - return { next }; - }, - }; + getIdentifierToken(): Token | undefined { + return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); } /** - * Returns the location of the rparen token in this node + * Returns the identifier attribute of this node */ - getRparenToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); + getIdentifier(): string | undefined { + const slot = cxx.getASTSlot(this.getHandle(), 2); + return cxx.getIdentifierValue(slot); } } /** - * NestedNamespaceSpecifierAST node. + * SubscriptDesignatorAST node. */ -export class NestedNamespaceSpecifierAST extends AST { +export class SubscriptDesignatorAST extends DesignatorAST { /** * Traverse this node using the given visitor. * @param visitor the visitor. @@ -8505,44 +8517,32 @@ export class NestedNamespaceSpecifierAST extends AST { visitor: ASTVisitor, context: Context, ): Result { - return visitor.visitNestedNamespaceSpecifier(this, context); + return visitor.visitSubscriptDesignator(this, context); } /** - * Returns the location of the inline token in this node + * Returns the location of the lbracket token in this node */ - getInlineToken(): Token | undefined { + getLbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser); } /** - * Returns the location of the identifier token in this node + * Returns the expression of this node */ - getIdentifierToken(): Token | undefined { - return Token.from(cxx.getASTSlot(this.getHandle(), 1), this.parser); + getExpression(): ExpressionAST | undefined { + return AST.from( + cxx.getASTSlot(this.getHandle(), 1), + this.parser, + ); } /** - * Returns the location of the scope token in this node + * Returns the location of the rbracket token in this node */ - getScopeToken(): Token | undefined { + getRbracketToken(): Token | undefined { return Token.from(cxx.getASTSlot(this.getHandle(), 2), this.parser); } - - /** - * Returns the identifier attribute of this node - */ - getIdentifier(): string | undefined { - const slot = cxx.getASTSlot(this.getHandle(), 3); - return cxx.getIdentifierValue(slot); - } - - /** - * Returns the isInline attribute of this node - */ - getIsInline(): boolean { - return cxx.getASTSlot(this.getHandle(), 4) !== 0; - } } /** @@ -13277,6 +13277,31 @@ const AST_CONSTRUCTORS: Array< AsmQualifierAST, AsmClobberAST, AsmGotoLabelAST, + SplicerAST, + GlobalModuleFragmentAST, + PrivateModuleFragmentAST, + ModuleDeclarationAST, + ModuleNameAST, + ModuleQualifierAST, + ModulePartitionAST, + ImportNameAST, + InitDeclaratorAST, + DeclaratorAST, + UsingDeclaratorAST, + EnumeratorAST, + TypeIdAST, + HandlerAST, + BaseSpecifierAST, + RequiresClauseAST, + ParameterDeclarationClauseAST, + TrailingReturnTypeAST, + LambdaSpecifierAST, + TypeConstraintAST, + AttributeArgumentClauseAST, + AttributeAST, + AttributeUsingPrefixAST, + NewPlacementAST, + NestedNamespaceSpecifierAST, LabeledStatementAST, CaseStatementAST, DefaultStatementAST, @@ -13362,31 +13387,6 @@ const AST_CONSTRUCTORS: Array< TypeGenericAssociationAST, DotDesignatorAST, SubscriptDesignatorAST, - SplicerAST, - GlobalModuleFragmentAST, - PrivateModuleFragmentAST, - ModuleDeclarationAST, - ModuleNameAST, - ModuleQualifierAST, - ModulePartitionAST, - ImportNameAST, - InitDeclaratorAST, - DeclaratorAST, - UsingDeclaratorAST, - EnumeratorAST, - TypeIdAST, - HandlerAST, - BaseSpecifierAST, - RequiresClauseAST, - ParameterDeclarationClauseAST, - TrailingReturnTypeAST, - LambdaSpecifierAST, - TypeConstraintAST, - AttributeArgumentClauseAST, - AttributeAST, - AttributeUsingPrefixAST, - NewPlacementAST, - NestedNamespaceSpecifierAST, TemplateTypeParameterAST, NonTypeTemplateParameterAST, TypenameTypeParameterAST, diff --git a/packages/cxx-frontend/src/ASTKind.ts b/packages/cxx-frontend/src/ASTKind.ts index 92acb127..79ec2479 100644 --- a/packages/cxx-frontend/src/ASTKind.ts +++ b/packages/cxx-frontend/src/ASTKind.ts @@ -50,10 +50,37 @@ export enum ASTKind { AccessDeclaration, ForRangeDeclaration, StructuredBindingDeclaration, + + // AST AsmOperand, AsmQualifier, AsmClobber, AsmGotoLabel, + Splicer, + GlobalModuleFragment, + PrivateModuleFragment, + ModuleDeclaration, + ModuleName, + ModuleQualifier, + ModulePartition, + ImportName, + InitDeclarator, + Declarator, + UsingDeclarator, + Enumerator, + TypeId, + Handler, + BaseSpecifier, + RequiresClause, + ParameterDeclarationClause, + TrailingReturnType, + LambdaSpecifier, + TypeConstraint, + AttributeArgumentClause, + Attribute, + AttributeUsingPrefix, + NewPlacement, + NestedNamespaceSpecifier, // StatementAST LabeledStatement, @@ -148,33 +175,6 @@ export enum ASTKind { DotDesignator, SubscriptDesignator, - // AST - Splicer, - GlobalModuleFragment, - PrivateModuleFragment, - ModuleDeclaration, - ModuleName, - ModuleQualifier, - ModulePartition, - ImportName, - InitDeclarator, - Declarator, - UsingDeclarator, - Enumerator, - TypeId, - Handler, - BaseSpecifier, - RequiresClause, - ParameterDeclarationClause, - TrailingReturnType, - LambdaSpecifier, - TypeConstraint, - AttributeArgumentClause, - Attribute, - AttributeUsingPrefix, - NewPlacement, - NestedNamespaceSpecifier, - // TemplateParameterAST TemplateTypeParameter, NonTypeTemplateParameter, diff --git a/packages/cxx-frontend/src/ASTVisitor.ts b/packages/cxx-frontend/src/ASTVisitor.ts index e18094fd..377cce14 100644 --- a/packages/cxx-frontend/src/ASTVisitor.ts +++ b/packages/cxx-frontend/src/ASTVisitor.ts @@ -393,1292 +393,1292 @@ export abstract class ASTVisitor { ): Result; /** - * Visit LabeledStatement node. + * Visit Splicer node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitLabeledStatement( - node: ast.LabeledStatementAST, - context: Context, - ): Result; + abstract visitSplicer(node: ast.SplicerAST, context: Context): Result; /** - * Visit CaseStatement node. + * Visit GlobalModuleFragment node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCaseStatement( - node: ast.CaseStatementAST, + abstract visitGlobalModuleFragment( + node: ast.GlobalModuleFragmentAST, context: Context, ): Result; /** - * Visit DefaultStatement node. + * Visit PrivateModuleFragment node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDefaultStatement( - node: ast.DefaultStatementAST, + abstract visitPrivateModuleFragment( + node: ast.PrivateModuleFragmentAST, context: Context, ): Result; /** - * Visit ExpressionStatement node. + * Visit ModuleDeclaration node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitExpressionStatement( - node: ast.ExpressionStatementAST, + abstract visitModuleDeclaration( + node: ast.ModuleDeclarationAST, context: Context, ): Result; /** - * Visit CompoundStatement node. + * Visit ModuleName node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCompoundStatement( - node: ast.CompoundStatementAST, - context: Context, - ): Result; + abstract visitModuleName(node: ast.ModuleNameAST, context: Context): Result; /** - * Visit IfStatement node. + * Visit ModuleQualifier node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitIfStatement(node: ast.IfStatementAST, context: Context): Result; + abstract visitModuleQualifier( + node: ast.ModuleQualifierAST, + context: Context, + ): Result; /** - * Visit ConstevalIfStatement node. + * Visit ModulePartition node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitConstevalIfStatement( - node: ast.ConstevalIfStatementAST, + abstract visitModulePartition( + node: ast.ModulePartitionAST, context: Context, ): Result; /** - * Visit SwitchStatement node. + * Visit ImportName node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSwitchStatement( - node: ast.SwitchStatementAST, - context: Context, - ): Result; + abstract visitImportName(node: ast.ImportNameAST, context: Context): Result; /** - * Visit WhileStatement node. + * Visit InitDeclarator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitWhileStatement( - node: ast.WhileStatementAST, + abstract visitInitDeclarator( + node: ast.InitDeclaratorAST, context: Context, ): Result; /** - * Visit DoStatement node. + * Visit Declarator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDoStatement(node: ast.DoStatementAST, context: Context): Result; + abstract visitDeclarator(node: ast.DeclaratorAST, context: Context): Result; /** - * Visit ForRangeStatement node. + * Visit UsingDeclarator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitForRangeStatement( - node: ast.ForRangeStatementAST, + abstract visitUsingDeclarator( + node: ast.UsingDeclaratorAST, context: Context, ): Result; /** - * Visit ForStatement node. + * Visit Enumerator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitForStatement( - node: ast.ForStatementAST, - context: Context, - ): Result; + abstract visitEnumerator(node: ast.EnumeratorAST, context: Context): Result; /** - * Visit BreakStatement node. + * Visit TypeId node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBreakStatement( - node: ast.BreakStatementAST, - context: Context, - ): Result; + abstract visitTypeId(node: ast.TypeIdAST, context: Context): Result; /** - * Visit ContinueStatement node. + * Visit Handler node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitContinueStatement( - node: ast.ContinueStatementAST, - context: Context, - ): Result; + abstract visitHandler(node: ast.HandlerAST, context: Context): Result; /** - * Visit ReturnStatement node. + * Visit BaseSpecifier node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitReturnStatement( - node: ast.ReturnStatementAST, + abstract visitBaseSpecifier( + node: ast.BaseSpecifierAST, context: Context, ): Result; /** - * Visit CoroutineReturnStatement node. + * Visit RequiresClause node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCoroutineReturnStatement( - node: ast.CoroutineReturnStatementAST, + abstract visitRequiresClause( + node: ast.RequiresClauseAST, context: Context, ): Result; /** - * Visit GotoStatement node. + * Visit ParameterDeclarationClause node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitGotoStatement( - node: ast.GotoStatementAST, + abstract visitParameterDeclarationClause( + node: ast.ParameterDeclarationClauseAST, context: Context, ): Result; /** - * Visit DeclarationStatement node. + * Visit TrailingReturnType node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDeclarationStatement( - node: ast.DeclarationStatementAST, + abstract visitTrailingReturnType( + node: ast.TrailingReturnTypeAST, context: Context, ): Result; /** - * Visit TryBlockStatement node. + * Visit LambdaSpecifier node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTryBlockStatement( - node: ast.TryBlockStatementAST, + abstract visitLambdaSpecifier( + node: ast.LambdaSpecifierAST, context: Context, ): Result; /** - * Visit GeneratedLiteralExpression node. + * Visit TypeConstraint node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitGeneratedLiteralExpression( - node: ast.GeneratedLiteralExpressionAST, + abstract visitTypeConstraint( + node: ast.TypeConstraintAST, context: Context, ): Result; /** - * Visit CharLiteralExpression node. + * Visit AttributeArgumentClause node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCharLiteralExpression( - node: ast.CharLiteralExpressionAST, + abstract visitAttributeArgumentClause( + node: ast.AttributeArgumentClauseAST, context: Context, ): Result; /** - * Visit BoolLiteralExpression node. + * Visit Attribute node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBoolLiteralExpression( - node: ast.BoolLiteralExpressionAST, - context: Context, - ): Result; + abstract visitAttribute(node: ast.AttributeAST, context: Context): Result; /** - * Visit IntLiteralExpression node. + * Visit AttributeUsingPrefix node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitIntLiteralExpression( - node: ast.IntLiteralExpressionAST, + abstract visitAttributeUsingPrefix( + node: ast.AttributeUsingPrefixAST, context: Context, ): Result; /** - * Visit FloatLiteralExpression node. + * Visit NewPlacement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitFloatLiteralExpression( - node: ast.FloatLiteralExpressionAST, + abstract visitNewPlacement( + node: ast.NewPlacementAST, context: Context, ): Result; /** - * Visit NullptrLiteralExpression node. + * Visit NestedNamespaceSpecifier node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNullptrLiteralExpression( - node: ast.NullptrLiteralExpressionAST, + abstract visitNestedNamespaceSpecifier( + node: ast.NestedNamespaceSpecifierAST, context: Context, ): Result; /** - * Visit StringLiteralExpression node. + * Visit LabeledStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitStringLiteralExpression( - node: ast.StringLiteralExpressionAST, + abstract visitLabeledStatement( + node: ast.LabeledStatementAST, context: Context, ): Result; /** - * Visit UserDefinedStringLiteralExpression node. + * Visit CaseStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitUserDefinedStringLiteralExpression( - node: ast.UserDefinedStringLiteralExpressionAST, + abstract visitCaseStatement( + node: ast.CaseStatementAST, context: Context, ): Result; /** - * Visit ObjectLiteralExpression node. + * Visit DefaultStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitObjectLiteralExpression( - node: ast.ObjectLiteralExpressionAST, + abstract visitDefaultStatement( + node: ast.DefaultStatementAST, context: Context, ): Result; /** - * Visit ThisExpression node. + * Visit ExpressionStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitThisExpression( - node: ast.ThisExpressionAST, + abstract visitExpressionStatement( + node: ast.ExpressionStatementAST, context: Context, ): Result; /** - * Visit GenericSelectionExpression node. + * Visit CompoundStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitGenericSelectionExpression( - node: ast.GenericSelectionExpressionAST, + abstract visitCompoundStatement( + node: ast.CompoundStatementAST, context: Context, ): Result; /** - * Visit NestedStatementExpression node. + * Visit IfStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNestedStatementExpression( - node: ast.NestedStatementExpressionAST, - context: Context, - ): Result; + abstract visitIfStatement(node: ast.IfStatementAST, context: Context): Result; /** - * Visit NestedExpression node. + * Visit ConstevalIfStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNestedExpression( - node: ast.NestedExpressionAST, + abstract visitConstevalIfStatement( + node: ast.ConstevalIfStatementAST, context: Context, ): Result; /** - * Visit IdExpression node. + * Visit SwitchStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitIdExpression( - node: ast.IdExpressionAST, + abstract visitSwitchStatement( + node: ast.SwitchStatementAST, context: Context, ): Result; /** - * Visit LambdaExpression node. + * Visit WhileStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitLambdaExpression( - node: ast.LambdaExpressionAST, + abstract visitWhileStatement( + node: ast.WhileStatementAST, context: Context, ): Result; /** - * Visit FoldExpression node. + * Visit DoStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitFoldExpression( - node: ast.FoldExpressionAST, - context: Context, - ): Result; + abstract visitDoStatement(node: ast.DoStatementAST, context: Context): Result; /** - * Visit RightFoldExpression node. + * Visit ForRangeStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitRightFoldExpression( - node: ast.RightFoldExpressionAST, + abstract visitForRangeStatement( + node: ast.ForRangeStatementAST, context: Context, ): Result; /** - * Visit LeftFoldExpression node. + * Visit ForStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitLeftFoldExpression( - node: ast.LeftFoldExpressionAST, + abstract visitForStatement( + node: ast.ForStatementAST, context: Context, ): Result; /** - * Visit RequiresExpression node. + * Visit BreakStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitRequiresExpression( - node: ast.RequiresExpressionAST, + abstract visitBreakStatement( + node: ast.BreakStatementAST, context: Context, ): Result; /** - * Visit VaArgExpression node. + * Visit ContinueStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitVaArgExpression( - node: ast.VaArgExpressionAST, + abstract visitContinueStatement( + node: ast.ContinueStatementAST, context: Context, ): Result; /** - * Visit SubscriptExpression node. + * Visit ReturnStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSubscriptExpression( - node: ast.SubscriptExpressionAST, + abstract visitReturnStatement( + node: ast.ReturnStatementAST, context: Context, ): Result; /** - * Visit CallExpression node. + * Visit CoroutineReturnStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCallExpression( - node: ast.CallExpressionAST, + abstract visitCoroutineReturnStatement( + node: ast.CoroutineReturnStatementAST, context: Context, ): Result; /** - * Visit TypeConstruction node. + * Visit GotoStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeConstruction( - node: ast.TypeConstructionAST, + abstract visitGotoStatement( + node: ast.GotoStatementAST, context: Context, ): Result; /** - * Visit BracedTypeConstruction node. + * Visit DeclarationStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBracedTypeConstruction( - node: ast.BracedTypeConstructionAST, + abstract visitDeclarationStatement( + node: ast.DeclarationStatementAST, context: Context, ): Result; /** - * Visit SpliceMemberExpression node. + * Visit TryBlockStatement node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSpliceMemberExpression( - node: ast.SpliceMemberExpressionAST, + abstract visitTryBlockStatement( + node: ast.TryBlockStatementAST, context: Context, ): Result; /** - * Visit MemberExpression node. + * Visit GeneratedLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitMemberExpression( - node: ast.MemberExpressionAST, + abstract visitGeneratedLiteralExpression( + node: ast.GeneratedLiteralExpressionAST, context: Context, ): Result; /** - * Visit PostIncrExpression node. + * Visit CharLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitPostIncrExpression( - node: ast.PostIncrExpressionAST, + abstract visitCharLiteralExpression( + node: ast.CharLiteralExpressionAST, context: Context, ): Result; /** - * Visit CppCastExpression node. + * Visit BoolLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCppCastExpression( - node: ast.CppCastExpressionAST, + abstract visitBoolLiteralExpression( + node: ast.BoolLiteralExpressionAST, context: Context, ): Result; /** - * Visit BuiltinBitCastExpression node. + * Visit IntLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBuiltinBitCastExpression( - node: ast.BuiltinBitCastExpressionAST, + abstract visitIntLiteralExpression( + node: ast.IntLiteralExpressionAST, context: Context, ): Result; /** - * Visit BuiltinOffsetofExpression node. + * Visit FloatLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBuiltinOffsetofExpression( - node: ast.BuiltinOffsetofExpressionAST, + abstract visitFloatLiteralExpression( + node: ast.FloatLiteralExpressionAST, context: Context, ): Result; /** - * Visit TypeidExpression node. + * Visit NullptrLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeidExpression( - node: ast.TypeidExpressionAST, + abstract visitNullptrLiteralExpression( + node: ast.NullptrLiteralExpressionAST, context: Context, ): Result; /** - * Visit TypeidOfTypeExpression node. + * Visit StringLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeidOfTypeExpression( - node: ast.TypeidOfTypeExpressionAST, + abstract visitStringLiteralExpression( + node: ast.StringLiteralExpressionAST, context: Context, ): Result; /** - * Visit SpliceExpression node. + * Visit UserDefinedStringLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSpliceExpression( - node: ast.SpliceExpressionAST, + abstract visitUserDefinedStringLiteralExpression( + node: ast.UserDefinedStringLiteralExpressionAST, context: Context, ): Result; /** - * Visit GlobalScopeReflectExpression node. + * Visit ObjectLiteralExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitGlobalScopeReflectExpression( - node: ast.GlobalScopeReflectExpressionAST, + abstract visitObjectLiteralExpression( + node: ast.ObjectLiteralExpressionAST, context: Context, ): Result; /** - * Visit NamespaceReflectExpression node. + * Visit ThisExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNamespaceReflectExpression( - node: ast.NamespaceReflectExpressionAST, + abstract visitThisExpression( + node: ast.ThisExpressionAST, context: Context, ): Result; /** - * Visit TypeIdReflectExpression node. + * Visit GenericSelectionExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeIdReflectExpression( - node: ast.TypeIdReflectExpressionAST, + abstract visitGenericSelectionExpression( + node: ast.GenericSelectionExpressionAST, context: Context, ): Result; /** - * Visit ReflectExpression node. + * Visit NestedStatementExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitReflectExpression( - node: ast.ReflectExpressionAST, + abstract visitNestedStatementExpression( + node: ast.NestedStatementExpressionAST, context: Context, ): Result; /** - * Visit LabelAddressExpression node. + * Visit NestedExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitLabelAddressExpression( - node: ast.LabelAddressExpressionAST, + abstract visitNestedExpression( + node: ast.NestedExpressionAST, context: Context, ): Result; /** - * Visit UnaryExpression node. + * Visit IdExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitUnaryExpression( - node: ast.UnaryExpressionAST, + abstract visitIdExpression( + node: ast.IdExpressionAST, context: Context, ): Result; /** - * Visit AwaitExpression node. + * Visit LambdaExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAwaitExpression( - node: ast.AwaitExpressionAST, + abstract visitLambdaExpression( + node: ast.LambdaExpressionAST, context: Context, ): Result; /** - * Visit SizeofExpression node. + * Visit FoldExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSizeofExpression( - node: ast.SizeofExpressionAST, + abstract visitFoldExpression( + node: ast.FoldExpressionAST, context: Context, ): Result; /** - * Visit SizeofTypeExpression node. + * Visit RightFoldExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSizeofTypeExpression( - node: ast.SizeofTypeExpressionAST, + abstract visitRightFoldExpression( + node: ast.RightFoldExpressionAST, context: Context, ): Result; /** - * Visit SizeofPackExpression node. + * Visit LeftFoldExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSizeofPackExpression( - node: ast.SizeofPackExpressionAST, + abstract visitLeftFoldExpression( + node: ast.LeftFoldExpressionAST, context: Context, ): Result; /** - * Visit AlignofTypeExpression node. + * Visit RequiresExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAlignofTypeExpression( - node: ast.AlignofTypeExpressionAST, + abstract visitRequiresExpression( + node: ast.RequiresExpressionAST, context: Context, ): Result; /** - * Visit AlignofExpression node. + * Visit VaArgExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAlignofExpression( - node: ast.AlignofExpressionAST, + abstract visitVaArgExpression( + node: ast.VaArgExpressionAST, context: Context, ): Result; /** - * Visit NoexceptExpression node. + * Visit SubscriptExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNoexceptExpression( - node: ast.NoexceptExpressionAST, + abstract visitSubscriptExpression( + node: ast.SubscriptExpressionAST, context: Context, ): Result; /** - * Visit NewExpression node. + * Visit CallExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNewExpression( - node: ast.NewExpressionAST, + abstract visitCallExpression( + node: ast.CallExpressionAST, context: Context, ): Result; /** - * Visit DeleteExpression node. + * Visit TypeConstruction node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDeleteExpression( - node: ast.DeleteExpressionAST, + abstract visitTypeConstruction( + node: ast.TypeConstructionAST, context: Context, ): Result; /** - * Visit CastExpression node. + * Visit BracedTypeConstruction node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitCastExpression( - node: ast.CastExpressionAST, + abstract visitBracedTypeConstruction( + node: ast.BracedTypeConstructionAST, context: Context, ): Result; /** - * Visit ImplicitCastExpression node. + * Visit SpliceMemberExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitImplicitCastExpression( - node: ast.ImplicitCastExpressionAST, + abstract visitSpliceMemberExpression( + node: ast.SpliceMemberExpressionAST, context: Context, ): Result; /** - * Visit BinaryExpression node. + * Visit MemberExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBinaryExpression( - node: ast.BinaryExpressionAST, + abstract visitMemberExpression( + node: ast.MemberExpressionAST, context: Context, ): Result; /** - * Visit ConditionalExpression node. + * Visit PostIncrExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitConditionalExpression( - node: ast.ConditionalExpressionAST, + abstract visitPostIncrExpression( + node: ast.PostIncrExpressionAST, context: Context, ): Result; /** - * Visit YieldExpression node. + * Visit CppCastExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitYieldExpression( - node: ast.YieldExpressionAST, + abstract visitCppCastExpression( + node: ast.CppCastExpressionAST, context: Context, ): Result; /** - * Visit ThrowExpression node. + * Visit BuiltinBitCastExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitThrowExpression( - node: ast.ThrowExpressionAST, + abstract visitBuiltinBitCastExpression( + node: ast.BuiltinBitCastExpressionAST, context: Context, ): Result; /** - * Visit AssignmentExpression node. + * Visit BuiltinOffsetofExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAssignmentExpression( - node: ast.AssignmentExpressionAST, + abstract visitBuiltinOffsetofExpression( + node: ast.BuiltinOffsetofExpressionAST, context: Context, ): Result; /** - * Visit PackExpansionExpression node. + * Visit TypeidExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitPackExpansionExpression( - node: ast.PackExpansionExpressionAST, + abstract visitTypeidExpression( + node: ast.TypeidExpressionAST, context: Context, ): Result; /** - * Visit DesignatedInitializerClause node. + * Visit TypeidOfTypeExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDesignatedInitializerClause( - node: ast.DesignatedInitializerClauseAST, + abstract visitTypeidOfTypeExpression( + node: ast.TypeidOfTypeExpressionAST, context: Context, ): Result; /** - * Visit TypeTraitExpression node. + * Visit SpliceExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeTraitExpression( - node: ast.TypeTraitExpressionAST, + abstract visitSpliceExpression( + node: ast.SpliceExpressionAST, context: Context, ): Result; /** - * Visit ConditionExpression node. + * Visit GlobalScopeReflectExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitConditionExpression( - node: ast.ConditionExpressionAST, + abstract visitGlobalScopeReflectExpression( + node: ast.GlobalScopeReflectExpressionAST, context: Context, ): Result; /** - * Visit EqualInitializer node. + * Visit NamespaceReflectExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitEqualInitializer( - node: ast.EqualInitializerAST, + abstract visitNamespaceReflectExpression( + node: ast.NamespaceReflectExpressionAST, context: Context, ): Result; /** - * Visit BracedInitList node. + * Visit TypeIdReflectExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBracedInitList( - node: ast.BracedInitListAST, + abstract visitTypeIdReflectExpression( + node: ast.TypeIdReflectExpressionAST, context: Context, ): Result; /** - * Visit ParenInitializer node. + * Visit ReflectExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitParenInitializer( - node: ast.ParenInitializerAST, + abstract visitReflectExpression( + node: ast.ReflectExpressionAST, context: Context, ): Result; /** - * Visit DefaultGenericAssociation node. + * Visit LabelAddressExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDefaultGenericAssociation( - node: ast.DefaultGenericAssociationAST, + abstract visitLabelAddressExpression( + node: ast.LabelAddressExpressionAST, context: Context, ): Result; /** - * Visit TypeGenericAssociation node. + * Visit UnaryExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeGenericAssociation( - node: ast.TypeGenericAssociationAST, + abstract visitUnaryExpression( + node: ast.UnaryExpressionAST, context: Context, ): Result; /** - * Visit DotDesignator node. + * Visit AwaitExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDotDesignator( - node: ast.DotDesignatorAST, + abstract visitAwaitExpression( + node: ast.AwaitExpressionAST, context: Context, ): Result; /** - * Visit SubscriptDesignator node. + * Visit SizeofExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSubscriptDesignator( - node: ast.SubscriptDesignatorAST, + abstract visitSizeofExpression( + node: ast.SizeofExpressionAST, context: Context, ): Result; /** - * Visit Splicer node. + * Visit SizeofTypeExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitSplicer(node: ast.SplicerAST, context: Context): Result; + abstract visitSizeofTypeExpression( + node: ast.SizeofTypeExpressionAST, + context: Context, + ): Result; /** - * Visit GlobalModuleFragment node. + * Visit SizeofPackExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitGlobalModuleFragment( - node: ast.GlobalModuleFragmentAST, + abstract visitSizeofPackExpression( + node: ast.SizeofPackExpressionAST, context: Context, ): Result; /** - * Visit PrivateModuleFragment node. + * Visit AlignofTypeExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitPrivateModuleFragment( - node: ast.PrivateModuleFragmentAST, + abstract visitAlignofTypeExpression( + node: ast.AlignofTypeExpressionAST, context: Context, ): Result; /** - * Visit ModuleDeclaration node. + * Visit AlignofExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitModuleDeclaration( - node: ast.ModuleDeclarationAST, + abstract visitAlignofExpression( + node: ast.AlignofExpressionAST, context: Context, ): Result; /** - * Visit ModuleName node. + * Visit NoexceptExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitModuleName(node: ast.ModuleNameAST, context: Context): Result; + abstract visitNoexceptExpression( + node: ast.NoexceptExpressionAST, + context: Context, + ): Result; /** - * Visit ModuleQualifier node. + * Visit NewExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitModuleQualifier( - node: ast.ModuleQualifierAST, + abstract visitNewExpression( + node: ast.NewExpressionAST, context: Context, ): Result; /** - * Visit ModulePartition node. + * Visit DeleteExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitModulePartition( - node: ast.ModulePartitionAST, + abstract visitDeleteExpression( + node: ast.DeleteExpressionAST, context: Context, ): Result; /** - * Visit ImportName node. + * Visit CastExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitImportName(node: ast.ImportNameAST, context: Context): Result; + abstract visitCastExpression( + node: ast.CastExpressionAST, + context: Context, + ): Result; /** - * Visit InitDeclarator node. + * Visit ImplicitCastExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitInitDeclarator( - node: ast.InitDeclaratorAST, + abstract visitImplicitCastExpression( + node: ast.ImplicitCastExpressionAST, context: Context, ): Result; /** - * Visit Declarator node. + * Visit BinaryExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitDeclarator(node: ast.DeclaratorAST, context: Context): Result; + abstract visitBinaryExpression( + node: ast.BinaryExpressionAST, + context: Context, + ): Result; /** - * Visit UsingDeclarator node. + * Visit ConditionalExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitUsingDeclarator( - node: ast.UsingDeclaratorAST, + abstract visitConditionalExpression( + node: ast.ConditionalExpressionAST, context: Context, ): Result; /** - * Visit Enumerator node. + * Visit YieldExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitEnumerator(node: ast.EnumeratorAST, context: Context): Result; + abstract visitYieldExpression( + node: ast.YieldExpressionAST, + context: Context, + ): Result; /** - * Visit TypeId node. + * Visit ThrowExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeId(node: ast.TypeIdAST, context: Context): Result; + abstract visitThrowExpression( + node: ast.ThrowExpressionAST, + context: Context, + ): Result; /** - * Visit Handler node. + * Visit AssignmentExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitHandler(node: ast.HandlerAST, context: Context): Result; + abstract visitAssignmentExpression( + node: ast.AssignmentExpressionAST, + context: Context, + ): Result; /** - * Visit BaseSpecifier node. + * Visit PackExpansionExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitBaseSpecifier( - node: ast.BaseSpecifierAST, + abstract visitPackExpansionExpression( + node: ast.PackExpansionExpressionAST, context: Context, ): Result; /** - * Visit RequiresClause node. + * Visit DesignatedInitializerClause node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitRequiresClause( - node: ast.RequiresClauseAST, + abstract visitDesignatedInitializerClause( + node: ast.DesignatedInitializerClauseAST, context: Context, ): Result; /** - * Visit ParameterDeclarationClause node. + * Visit TypeTraitExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitParameterDeclarationClause( - node: ast.ParameterDeclarationClauseAST, + abstract visitTypeTraitExpression( + node: ast.TypeTraitExpressionAST, context: Context, ): Result; /** - * Visit TrailingReturnType node. + * Visit ConditionExpression node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTrailingReturnType( - node: ast.TrailingReturnTypeAST, + abstract visitConditionExpression( + node: ast.ConditionExpressionAST, context: Context, ): Result; /** - * Visit LambdaSpecifier node. + * Visit EqualInitializer node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitLambdaSpecifier( - node: ast.LambdaSpecifierAST, + abstract visitEqualInitializer( + node: ast.EqualInitializerAST, context: Context, ): Result; /** - * Visit TypeConstraint node. + * Visit BracedInitList node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitTypeConstraint( - node: ast.TypeConstraintAST, + abstract visitBracedInitList( + node: ast.BracedInitListAST, context: Context, ): Result; /** - * Visit AttributeArgumentClause node. + * Visit ParenInitializer node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAttributeArgumentClause( - node: ast.AttributeArgumentClauseAST, + abstract visitParenInitializer( + node: ast.ParenInitializerAST, context: Context, ): Result; /** - * Visit Attribute node. + * Visit DefaultGenericAssociation node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAttribute(node: ast.AttributeAST, context: Context): Result; + abstract visitDefaultGenericAssociation( + node: ast.DefaultGenericAssociationAST, + context: Context, + ): Result; /** - * Visit AttributeUsingPrefix node. + * Visit TypeGenericAssociation node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitAttributeUsingPrefix( - node: ast.AttributeUsingPrefixAST, + abstract visitTypeGenericAssociation( + node: ast.TypeGenericAssociationAST, context: Context, ): Result; /** - * Visit NewPlacement node. + * Visit DotDesignator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNewPlacement( - node: ast.NewPlacementAST, + abstract visitDotDesignator( + node: ast.DotDesignatorAST, context: Context, ): Result; /** - * Visit NestedNamespaceSpecifier node. + * Visit SubscriptDesignator node. * * @param node The node to visit. * @param context The context. * @returns The result of the visit. */ - abstract visitNestedNamespaceSpecifier( - node: ast.NestedNamespaceSpecifierAST, + abstract visitSubscriptDesignator( + node: ast.SubscriptDesignatorAST, context: Context, ): Result; diff --git a/packages/cxx-frontend/src/RecursiveASTVisitor.ts b/packages/cxx-frontend/src/RecursiveASTVisitor.ts index 2e4521e9..f702158b 100644 --- a/packages/cxx-frontend/src/RecursiveASTVisitor.ts +++ b/packages/cxx-frontend/src/RecursiveASTVisitor.ts @@ -507,1365 +507,1365 @@ export class RecursiveASTVisitor extends ASTVisitor { visitAsmGotoLabel(node: ast.AsmGotoLabelAST, context: Context): void {} /** - * Visit a LabeledStatement node. - * - * @param node The node to visit. - * @param context The context. - */ - visitLabeledStatement( - node: ast.LabeledStatementAST, - context: Context, - ): void {} - - /** - * Visit a CaseStatement node. + * Visit a Splicer node. * * @param node The node to visit. * @param context The context. */ - visitCaseStatement(node: ast.CaseStatementAST, context: Context): void { + visitSplicer(node: ast.SplicerAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a DefaultStatement node. + * Visit a GlobalModuleFragment node. * * @param node The node to visit. * @param context The context. */ - visitDefaultStatement( - node: ast.DefaultStatementAST, + visitGlobalModuleFragment( + node: ast.GlobalModuleFragmentAST, context: Context, - ): void {} + ): void { + for (const element of node.getDeclarationList()) { + this.accept(element, context); + } + } /** - * Visit a ExpressionStatement node. + * Visit a PrivateModuleFragment node. * * @param node The node to visit. * @param context The context. */ - visitExpressionStatement( - node: ast.ExpressionStatementAST, + visitPrivateModuleFragment( + node: ast.PrivateModuleFragmentAST, context: Context, ): void { - this.accept(node.getExpression(), context); + for (const element of node.getDeclarationList()) { + this.accept(element, context); + } } /** - * Visit a CompoundStatement node. + * Visit a ModuleDeclaration node. * * @param node The node to visit. * @param context The context. */ - visitCompoundStatement( - node: ast.CompoundStatementAST, + visitModuleDeclaration( + node: ast.ModuleDeclarationAST, context: Context, ): void { - for (const element of node.getStatementList()) { + this.accept(node.getModuleName(), context); + this.accept(node.getModulePartition(), context); + for (const element of node.getAttributeList()) { this.accept(element, context); } } /** - * Visit a IfStatement node. + * Visit a ModuleName node. * * @param node The node to visit. * @param context The context. */ - visitIfStatement(node: ast.IfStatementAST, context: Context): void { - this.accept(node.getInitializer(), context); - this.accept(node.getCondition(), context); - this.accept(node.getStatement(), context); - this.accept(node.getElseStatement(), context); + visitModuleName(node: ast.ModuleNameAST, context: Context): void { + this.accept(node.getModuleQualifier(), context); } /** - * Visit a ConstevalIfStatement node. + * Visit a ModuleQualifier node. * * @param node The node to visit. * @param context The context. */ - visitConstevalIfStatement( - node: ast.ConstevalIfStatementAST, - context: Context, - ): void { - this.accept(node.getStatement(), context); - this.accept(node.getElseStatement(), context); + visitModuleQualifier(node: ast.ModuleQualifierAST, context: Context): void { + this.accept(node.getModuleQualifier(), context); } /** - * Visit a SwitchStatement node. + * Visit a ModulePartition node. * * @param node The node to visit. * @param context The context. */ - visitSwitchStatement(node: ast.SwitchStatementAST, context: Context): void { - this.accept(node.getInitializer(), context); - this.accept(node.getCondition(), context); - this.accept(node.getStatement(), context); + visitModulePartition(node: ast.ModulePartitionAST, context: Context): void { + this.accept(node.getModuleName(), context); } /** - * Visit a WhileStatement node. + * Visit a ImportName node. * * @param node The node to visit. * @param context The context. */ - visitWhileStatement(node: ast.WhileStatementAST, context: Context): void { - this.accept(node.getCondition(), context); - this.accept(node.getStatement(), context); + visitImportName(node: ast.ImportNameAST, context: Context): void { + this.accept(node.getModulePartition(), context); + this.accept(node.getModuleName(), context); } /** - * Visit a DoStatement node. + * Visit a InitDeclarator node. * * @param node The node to visit. * @param context The context. */ - visitDoStatement(node: ast.DoStatementAST, context: Context): void { - this.accept(node.getStatement(), context); - this.accept(node.getExpression(), context); + visitInitDeclarator(node: ast.InitDeclaratorAST, context: Context): void { + this.accept(node.getDeclarator(), context); + this.accept(node.getRequiresClause(), context); + this.accept(node.getInitializer(), context); } /** - * Visit a ForRangeStatement node. + * Visit a Declarator node. * * @param node The node to visit. * @param context The context. */ - visitForRangeStatement( - node: ast.ForRangeStatementAST, - context: Context, - ): void { - this.accept(node.getInitializer(), context); - this.accept(node.getRangeDeclaration(), context); - this.accept(node.getRangeInitializer(), context); - this.accept(node.getStatement(), context); + visitDeclarator(node: ast.DeclaratorAST, context: Context): void { + for (const element of node.getPtrOpList()) { + this.accept(element, context); + } + this.accept(node.getCoreDeclarator(), context); + for (const element of node.getDeclaratorChunkList()) { + this.accept(element, context); + } } /** - * Visit a ForStatement node. + * Visit a UsingDeclarator node. * * @param node The node to visit. * @param context The context. */ - visitForStatement(node: ast.ForStatementAST, context: Context): void { - this.accept(node.getInitializer(), context); - this.accept(node.getCondition(), context); - this.accept(node.getExpression(), context); - this.accept(node.getStatement(), context); + visitUsingDeclarator(node: ast.UsingDeclaratorAST, context: Context): void { + this.accept(node.getNestedNameSpecifier(), context); + this.accept(node.getUnqualifiedId(), context); } /** - * Visit a BreakStatement node. + * Visit a Enumerator node. * * @param node The node to visit. * @param context The context. */ - visitBreakStatement(node: ast.BreakStatementAST, context: Context): void {} + visitEnumerator(node: ast.EnumeratorAST, context: Context): void { + for (const element of node.getAttributeList()) { + this.accept(element, context); + } + this.accept(node.getExpression(), context); + } /** - * Visit a ContinueStatement node. + * Visit a TypeId node. * * @param node The node to visit. * @param context The context. */ - visitContinueStatement( - node: ast.ContinueStatementAST, - context: Context, - ): void {} + visitTypeId(node: ast.TypeIdAST, context: Context): void { + for (const element of node.getTypeSpecifierList()) { + this.accept(element, context); + } + this.accept(node.getDeclarator(), context); + } /** - * Visit a ReturnStatement node. + * Visit a Handler node. * * @param node The node to visit. * @param context The context. */ - visitReturnStatement(node: ast.ReturnStatementAST, context: Context): void { - this.accept(node.getExpression(), context); + visitHandler(node: ast.HandlerAST, context: Context): void { + this.accept(node.getExceptionDeclaration(), context); + this.accept(node.getStatement(), context); } /** - * Visit a CoroutineReturnStatement node. + * Visit a BaseSpecifier node. * * @param node The node to visit. * @param context The context. */ - visitCoroutineReturnStatement( - node: ast.CoroutineReturnStatementAST, - context: Context, - ): void { - this.accept(node.getExpression(), context); + visitBaseSpecifier(node: ast.BaseSpecifierAST, context: Context): void { + for (const element of node.getAttributeList()) { + this.accept(element, context); + } + this.accept(node.getNestedNameSpecifier(), context); + this.accept(node.getUnqualifiedId(), context); } /** - * Visit a GotoStatement node. + * Visit a RequiresClause node. * * @param node The node to visit. * @param context The context. */ - visitGotoStatement(node: ast.GotoStatementAST, context: Context): void {} + visitRequiresClause(node: ast.RequiresClauseAST, context: Context): void { + this.accept(node.getExpression(), context); + } /** - * Visit a DeclarationStatement node. + * Visit a ParameterDeclarationClause node. * * @param node The node to visit. * @param context The context. */ - visitDeclarationStatement( - node: ast.DeclarationStatementAST, + visitParameterDeclarationClause( + node: ast.ParameterDeclarationClauseAST, context: Context, ): void { - this.accept(node.getDeclaration(), context); + for (const element of node.getParameterDeclarationList()) { + this.accept(element, context); + } } /** - * Visit a TryBlockStatement node. + * Visit a TrailingReturnType node. * * @param node The node to visit. * @param context The context. */ - visitTryBlockStatement( - node: ast.TryBlockStatementAST, + visitTrailingReturnType( + node: ast.TrailingReturnTypeAST, context: Context, ): void { - this.accept(node.getStatement(), context); - for (const element of node.getHandlerList()) { - this.accept(element, context); - } + this.accept(node.getTypeId(), context); } /** - * Visit a GeneratedLiteralExpression node. + * Visit a LambdaSpecifier node. * * @param node The node to visit. * @param context The context. */ - visitGeneratedLiteralExpression( - node: ast.GeneratedLiteralExpressionAST, - context: Context, - ): void {} + visitLambdaSpecifier(node: ast.LambdaSpecifierAST, context: Context): void {} /** - * Visit a CharLiteralExpression node. + * Visit a TypeConstraint node. * * @param node The node to visit. * @param context The context. */ - visitCharLiteralExpression( - node: ast.CharLiteralExpressionAST, - context: Context, - ): void {} + visitTypeConstraint(node: ast.TypeConstraintAST, context: Context): void { + this.accept(node.getNestedNameSpecifier(), context); + for (const element of node.getTemplateArgumentList()) { + this.accept(element, context); + } + } /** - * Visit a BoolLiteralExpression node. + * Visit a AttributeArgumentClause node. * * @param node The node to visit. * @param context The context. */ - visitBoolLiteralExpression( - node: ast.BoolLiteralExpressionAST, + visitAttributeArgumentClause( + node: ast.AttributeArgumentClauseAST, context: Context, ): void {} /** - * Visit a IntLiteralExpression node. + * Visit a Attribute node. * * @param node The node to visit. * @param context The context. */ - visitIntLiteralExpression( - node: ast.IntLiteralExpressionAST, - context: Context, - ): void {} + visitAttribute(node: ast.AttributeAST, context: Context): void { + this.accept(node.getAttributeToken(), context); + this.accept(node.getAttributeArgumentClause(), context); + } /** - * Visit a FloatLiteralExpression node. + * Visit a AttributeUsingPrefix node. * * @param node The node to visit. * @param context The context. */ - visitFloatLiteralExpression( - node: ast.FloatLiteralExpressionAST, + visitAttributeUsingPrefix( + node: ast.AttributeUsingPrefixAST, context: Context, ): void {} /** - * Visit a NullptrLiteralExpression node. + * Visit a NewPlacement node. * * @param node The node to visit. * @param context The context. */ - visitNullptrLiteralExpression( - node: ast.NullptrLiteralExpressionAST, - context: Context, - ): void {} + visitNewPlacement(node: ast.NewPlacementAST, context: Context): void { + for (const element of node.getExpressionList()) { + this.accept(element, context); + } + } /** - * Visit a StringLiteralExpression node. + * Visit a NestedNamespaceSpecifier node. * * @param node The node to visit. * @param context The context. */ - visitStringLiteralExpression( - node: ast.StringLiteralExpressionAST, + visitNestedNamespaceSpecifier( + node: ast.NestedNamespaceSpecifierAST, context: Context, ): void {} /** - * Visit a UserDefinedStringLiteralExpression node. + * Visit a LabeledStatement node. * * @param node The node to visit. * @param context The context. */ - visitUserDefinedStringLiteralExpression( - node: ast.UserDefinedStringLiteralExpressionAST, + visitLabeledStatement( + node: ast.LabeledStatementAST, context: Context, ): void {} /** - * Visit a ObjectLiteralExpression node. + * Visit a CaseStatement node. * * @param node The node to visit. * @param context The context. */ - visitObjectLiteralExpression( - node: ast.ObjectLiteralExpressionAST, - context: Context, - ): void { - this.accept(node.getTypeId(), context); - this.accept(node.getBracedInitList(), context); + visitCaseStatement(node: ast.CaseStatementAST, context: Context): void { + this.accept(node.getExpression(), context); } /** - * Visit a ThisExpression node. + * Visit a DefaultStatement node. * * @param node The node to visit. * @param context The context. */ - visitThisExpression(node: ast.ThisExpressionAST, context: Context): void {} + visitDefaultStatement( + node: ast.DefaultStatementAST, + context: Context, + ): void {} /** - * Visit a GenericSelectionExpression node. + * Visit a ExpressionStatement node. * * @param node The node to visit. * @param context The context. */ - visitGenericSelectionExpression( - node: ast.GenericSelectionExpressionAST, + visitExpressionStatement( + node: ast.ExpressionStatementAST, context: Context, ): void { this.accept(node.getExpression(), context); - for (const element of node.getGenericAssociationList()) { - this.accept(element, context); - } } /** - * Visit a NestedStatementExpression node. + * Visit a CompoundStatement node. * * @param node The node to visit. * @param context The context. */ - visitNestedStatementExpression( - node: ast.NestedStatementExpressionAST, + visitCompoundStatement( + node: ast.CompoundStatementAST, context: Context, ): void { - this.accept(node.getStatement(), context); + for (const element of node.getStatementList()) { + this.accept(element, context); + } } /** - * Visit a NestedExpression node. + * Visit a IfStatement node. * * @param node The node to visit. * @param context The context. */ - visitNestedExpression(node: ast.NestedExpressionAST, context: Context): void { - this.accept(node.getExpression(), context); + visitIfStatement(node: ast.IfStatementAST, context: Context): void { + this.accept(node.getInitializer(), context); + this.accept(node.getCondition(), context); + this.accept(node.getStatement(), context); + this.accept(node.getElseStatement(), context); } /** - * Visit a IdExpression node. + * Visit a ConstevalIfStatement node. * * @param node The node to visit. * @param context The context. */ - visitIdExpression(node: ast.IdExpressionAST, context: Context): void { - this.accept(node.getNestedNameSpecifier(), context); - this.accept(node.getUnqualifiedId(), context); + visitConstevalIfStatement( + node: ast.ConstevalIfStatementAST, + context: Context, + ): void { + this.accept(node.getStatement(), context); + this.accept(node.getElseStatement(), context); } /** - * Visit a LambdaExpression node. + * Visit a SwitchStatement node. * * @param node The node to visit. * @param context The context. */ - visitLambdaExpression(node: ast.LambdaExpressionAST, context: Context): void { - for (const element of node.getCaptureList()) { - this.accept(element, context); - } - for (const element of node.getTemplateParameterList()) { - this.accept(element, context); - } - this.accept(node.getTemplateRequiresClause(), context); - this.accept(node.getParameterDeclarationClause(), context); - for (const element of node.getGnuAtributeList()) { - this.accept(element, context); - } - for (const element of node.getLambdaSpecifierList()) { - this.accept(element, context); - } - this.accept(node.getExceptionSpecifier(), context); - for (const element of node.getAttributeList()) { - this.accept(element, context); - } - this.accept(node.getTrailingReturnType(), context); - this.accept(node.getRequiresClause(), context); + visitSwitchStatement(node: ast.SwitchStatementAST, context: Context): void { + this.accept(node.getInitializer(), context); + this.accept(node.getCondition(), context); this.accept(node.getStatement(), context); } /** - * Visit a FoldExpression node. + * Visit a WhileStatement node. * * @param node The node to visit. * @param context The context. */ - visitFoldExpression(node: ast.FoldExpressionAST, context: Context): void { - this.accept(node.getLeftExpression(), context); - this.accept(node.getRightExpression(), context); + visitWhileStatement(node: ast.WhileStatementAST, context: Context): void { + this.accept(node.getCondition(), context); + this.accept(node.getStatement(), context); } /** - * Visit a RightFoldExpression node. + * Visit a DoStatement node. * * @param node The node to visit. * @param context The context. */ - visitRightFoldExpression( - node: ast.RightFoldExpressionAST, - context: Context, - ): void { + visitDoStatement(node: ast.DoStatementAST, context: Context): void { + this.accept(node.getStatement(), context); this.accept(node.getExpression(), context); } /** - * Visit a LeftFoldExpression node. + * Visit a ForRangeStatement node. * * @param node The node to visit. * @param context The context. */ - visitLeftFoldExpression( - node: ast.LeftFoldExpressionAST, + visitForRangeStatement( + node: ast.ForRangeStatementAST, context: Context, ): void { + this.accept(node.getInitializer(), context); + this.accept(node.getRangeDeclaration(), context); + this.accept(node.getRangeInitializer(), context); + this.accept(node.getStatement(), context); + } + + /** + * Visit a ForStatement node. + * + * @param node The node to visit. + * @param context The context. + */ + visitForStatement(node: ast.ForStatementAST, context: Context): void { + this.accept(node.getInitializer(), context); + this.accept(node.getCondition(), context); this.accept(node.getExpression(), context); + this.accept(node.getStatement(), context); } /** - * Visit a RequiresExpression node. + * Visit a BreakStatement node. * * @param node The node to visit. * @param context The context. */ - visitRequiresExpression( - node: ast.RequiresExpressionAST, + visitBreakStatement(node: ast.BreakStatementAST, context: Context): void {} + + /** + * Visit a ContinueStatement node. + * + * @param node The node to visit. + * @param context The context. + */ + visitContinueStatement( + node: ast.ContinueStatementAST, context: Context, - ): void { - this.accept(node.getParameterDeclarationClause(), context); - for (const element of node.getRequirementList()) { - this.accept(element, context); - } - } + ): void {} /** - * Visit a VaArgExpression node. + * Visit a ReturnStatement node. * * @param node The node to visit. * @param context The context. */ - visitVaArgExpression(node: ast.VaArgExpressionAST, context: Context): void { + visitReturnStatement(node: ast.ReturnStatementAST, context: Context): void { this.accept(node.getExpression(), context); - this.accept(node.getTypeId(), context); } /** - * Visit a SubscriptExpression node. + * Visit a CoroutineReturnStatement node. * * @param node The node to visit. * @param context The context. */ - visitSubscriptExpression( - node: ast.SubscriptExpressionAST, + visitCoroutineReturnStatement( + node: ast.CoroutineReturnStatementAST, context: Context, ): void { - this.accept(node.getBaseExpression(), context); - this.accept(node.getIndexExpression(), context); + this.accept(node.getExpression(), context); } /** - * Visit a CallExpression node. + * Visit a GotoStatement node. * * @param node The node to visit. * @param context The context. */ - visitCallExpression(node: ast.CallExpressionAST, context: Context): void { - this.accept(node.getBaseExpression(), context); - for (const element of node.getExpressionList()) { - this.accept(element, context); - } - } + visitGotoStatement(node: ast.GotoStatementAST, context: Context): void {} /** - * Visit a TypeConstruction node. + * Visit a DeclarationStatement node. * * @param node The node to visit. * @param context The context. */ - visitTypeConstruction(node: ast.TypeConstructionAST, context: Context): void { - this.accept(node.getTypeSpecifier(), context); - for (const element of node.getExpressionList()) { - this.accept(element, context); - } + visitDeclarationStatement( + node: ast.DeclarationStatementAST, + context: Context, + ): void { + this.accept(node.getDeclaration(), context); } /** - * Visit a BracedTypeConstruction node. + * Visit a TryBlockStatement node. * * @param node The node to visit. * @param context The context. */ - visitBracedTypeConstruction( - node: ast.BracedTypeConstructionAST, + visitTryBlockStatement( + node: ast.TryBlockStatementAST, context: Context, ): void { - this.accept(node.getTypeSpecifier(), context); - this.accept(node.getBracedInitList(), context); + this.accept(node.getStatement(), context); + for (const element of node.getHandlerList()) { + this.accept(element, context); + } } /** - * Visit a SpliceMemberExpression node. + * Visit a GeneratedLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitSpliceMemberExpression( - node: ast.SpliceMemberExpressionAST, + visitGeneratedLiteralExpression( + node: ast.GeneratedLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getBaseExpression(), context); - this.accept(node.getSplicer(), context); - } + ): void {} /** - * Visit a MemberExpression node. + * Visit a CharLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitMemberExpression(node: ast.MemberExpressionAST, context: Context): void { - this.accept(node.getBaseExpression(), context); - this.accept(node.getNestedNameSpecifier(), context); - this.accept(node.getUnqualifiedId(), context); - } + visitCharLiteralExpression( + node: ast.CharLiteralExpressionAST, + context: Context, + ): void {} /** - * Visit a PostIncrExpression node. + * Visit a BoolLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitPostIncrExpression( - node: ast.PostIncrExpressionAST, + visitBoolLiteralExpression( + node: ast.BoolLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getBaseExpression(), context); - } + ): void {} /** - * Visit a CppCastExpression node. + * Visit a IntLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitCppCastExpression( - node: ast.CppCastExpressionAST, + visitIntLiteralExpression( + node: ast.IntLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getTypeId(), context); - this.accept(node.getExpression(), context); - } + ): void {} /** - * Visit a BuiltinBitCastExpression node. + * Visit a FloatLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitBuiltinBitCastExpression( - node: ast.BuiltinBitCastExpressionAST, + visitFloatLiteralExpression( + node: ast.FloatLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getTypeId(), context); - this.accept(node.getExpression(), context); - } + ): void {} /** - * Visit a BuiltinOffsetofExpression node. + * Visit a NullptrLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitBuiltinOffsetofExpression( - node: ast.BuiltinOffsetofExpressionAST, + visitNullptrLiteralExpression( + node: ast.NullptrLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getTypeId(), context); - this.accept(node.getExpression(), context); - } + ): void {} /** - * Visit a TypeidExpression node. + * Visit a StringLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeidExpression(node: ast.TypeidExpressionAST, context: Context): void { - this.accept(node.getExpression(), context); - } + visitStringLiteralExpression( + node: ast.StringLiteralExpressionAST, + context: Context, + ): void {} /** - * Visit a TypeidOfTypeExpression node. + * Visit a UserDefinedStringLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeidOfTypeExpression( - node: ast.TypeidOfTypeExpressionAST, + visitUserDefinedStringLiteralExpression( + node: ast.UserDefinedStringLiteralExpressionAST, context: Context, - ): void { - this.accept(node.getTypeId(), context); - } + ): void {} /** - * Visit a SpliceExpression node. + * Visit a ObjectLiteralExpression node. * * @param node The node to visit. * @param context The context. */ - visitSpliceExpression(node: ast.SpliceExpressionAST, context: Context): void { - this.accept(node.getSplicer(), context); + visitObjectLiteralExpression( + node: ast.ObjectLiteralExpressionAST, + context: Context, + ): void { + this.accept(node.getTypeId(), context); + this.accept(node.getBracedInitList(), context); } /** - * Visit a GlobalScopeReflectExpression node. + * Visit a ThisExpression node. * * @param node The node to visit. * @param context The context. */ - visitGlobalScopeReflectExpression( - node: ast.GlobalScopeReflectExpressionAST, - context: Context, - ): void {} + visitThisExpression(node: ast.ThisExpressionAST, context: Context): void {} /** - * Visit a NamespaceReflectExpression node. + * Visit a GenericSelectionExpression node. * * @param node The node to visit. * @param context The context. */ - visitNamespaceReflectExpression( - node: ast.NamespaceReflectExpressionAST, + visitGenericSelectionExpression( + node: ast.GenericSelectionExpressionAST, context: Context, - ): void {} + ): void { + this.accept(node.getExpression(), context); + for (const element of node.getGenericAssociationList()) { + this.accept(element, context); + } + } /** - * Visit a TypeIdReflectExpression node. + * Visit a NestedStatementExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeIdReflectExpression( - node: ast.TypeIdReflectExpressionAST, + visitNestedStatementExpression( + node: ast.NestedStatementExpressionAST, context: Context, ): void { - this.accept(node.getTypeId(), context); + this.accept(node.getStatement(), context); } /** - * Visit a ReflectExpression node. + * Visit a NestedExpression node. * * @param node The node to visit. * @param context The context. */ - visitReflectExpression( - node: ast.ReflectExpressionAST, - context: Context, - ): void { + visitNestedExpression(node: ast.NestedExpressionAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a LabelAddressExpression node. + * Visit a IdExpression node. * * @param node The node to visit. * @param context The context. */ - visitLabelAddressExpression( - node: ast.LabelAddressExpressionAST, - context: Context, - ): void {} + visitIdExpression(node: ast.IdExpressionAST, context: Context): void { + this.accept(node.getNestedNameSpecifier(), context); + this.accept(node.getUnqualifiedId(), context); + } /** - * Visit a UnaryExpression node. + * Visit a LambdaExpression node. * * @param node The node to visit. * @param context The context. */ - visitUnaryExpression(node: ast.UnaryExpressionAST, context: Context): void { - this.accept(node.getExpression(), context); + visitLambdaExpression(node: ast.LambdaExpressionAST, context: Context): void { + for (const element of node.getCaptureList()) { + this.accept(element, context); + } + for (const element of node.getTemplateParameterList()) { + this.accept(element, context); + } + this.accept(node.getTemplateRequiresClause(), context); + this.accept(node.getParameterDeclarationClause(), context); + for (const element of node.getGnuAtributeList()) { + this.accept(element, context); + } + for (const element of node.getLambdaSpecifierList()) { + this.accept(element, context); + } + this.accept(node.getExceptionSpecifier(), context); + for (const element of node.getAttributeList()) { + this.accept(element, context); + } + this.accept(node.getTrailingReturnType(), context); + this.accept(node.getRequiresClause(), context); + this.accept(node.getStatement(), context); } /** - * Visit a AwaitExpression node. + * Visit a FoldExpression node. * * @param node The node to visit. * @param context The context. */ - visitAwaitExpression(node: ast.AwaitExpressionAST, context: Context): void { - this.accept(node.getExpression(), context); + visitFoldExpression(node: ast.FoldExpressionAST, context: Context): void { + this.accept(node.getLeftExpression(), context); + this.accept(node.getRightExpression(), context); } /** - * Visit a SizeofExpression node. + * Visit a RightFoldExpression node. * * @param node The node to visit. * @param context The context. */ - visitSizeofExpression(node: ast.SizeofExpressionAST, context: Context): void { + visitRightFoldExpression( + node: ast.RightFoldExpressionAST, + context: Context, + ): void { this.accept(node.getExpression(), context); } /** - * Visit a SizeofTypeExpression node. + * Visit a LeftFoldExpression node. * * @param node The node to visit. * @param context The context. */ - visitSizeofTypeExpression( - node: ast.SizeofTypeExpressionAST, + visitLeftFoldExpression( + node: ast.LeftFoldExpressionAST, context: Context, ): void { - this.accept(node.getTypeId(), context); + this.accept(node.getExpression(), context); } /** - * Visit a SizeofPackExpression node. - * - * @param node The node to visit. - * @param context The context. - */ - visitSizeofPackExpression( - node: ast.SizeofPackExpressionAST, - context: Context, - ): void {} - - /** - * Visit a AlignofTypeExpression node. + * Visit a RequiresExpression node. * * @param node The node to visit. * @param context The context. */ - visitAlignofTypeExpression( - node: ast.AlignofTypeExpressionAST, + visitRequiresExpression( + node: ast.RequiresExpressionAST, context: Context, ): void { - this.accept(node.getTypeId(), context); + this.accept(node.getParameterDeclarationClause(), context); + for (const element of node.getRequirementList()) { + this.accept(element, context); + } } /** - * Visit a AlignofExpression node. + * Visit a VaArgExpression node. * * @param node The node to visit. * @param context The context. */ - visitAlignofExpression( - node: ast.AlignofExpressionAST, - context: Context, - ): void { + visitVaArgExpression(node: ast.VaArgExpressionAST, context: Context): void { this.accept(node.getExpression(), context); + this.accept(node.getTypeId(), context); } /** - * Visit a NoexceptExpression node. + * Visit a SubscriptExpression node. * * @param node The node to visit. * @param context The context. */ - visitNoexceptExpression( - node: ast.NoexceptExpressionAST, + visitSubscriptExpression( + node: ast.SubscriptExpressionAST, context: Context, ): void { - this.accept(node.getExpression(), context); + this.accept(node.getBaseExpression(), context); + this.accept(node.getIndexExpression(), context); } /** - * Visit a NewExpression node. + * Visit a CallExpression node. * * @param node The node to visit. * @param context The context. */ - visitNewExpression(node: ast.NewExpressionAST, context: Context): void { - this.accept(node.getNewPlacement(), context); - for (const element of node.getTypeSpecifierList()) { + visitCallExpression(node: ast.CallExpressionAST, context: Context): void { + this.accept(node.getBaseExpression(), context); + for (const element of node.getExpressionList()) { this.accept(element, context); } - this.accept(node.getDeclarator(), context); - this.accept(node.getNewInitalizer(), context); } /** - * Visit a DeleteExpression node. + * Visit a TypeConstruction node. * * @param node The node to visit. * @param context The context. */ - visitDeleteExpression(node: ast.DeleteExpressionAST, context: Context): void { - this.accept(node.getExpression(), context); + visitTypeConstruction(node: ast.TypeConstructionAST, context: Context): void { + this.accept(node.getTypeSpecifier(), context); + for (const element of node.getExpressionList()) { + this.accept(element, context); + } } /** - * Visit a CastExpression node. + * Visit a BracedTypeConstruction node. * * @param node The node to visit. * @param context The context. */ - visitCastExpression(node: ast.CastExpressionAST, context: Context): void { - this.accept(node.getTypeId(), context); - this.accept(node.getExpression(), context); + visitBracedTypeConstruction( + node: ast.BracedTypeConstructionAST, + context: Context, + ): void { + this.accept(node.getTypeSpecifier(), context); + this.accept(node.getBracedInitList(), context); } /** - * Visit a ImplicitCastExpression node. + * Visit a SpliceMemberExpression node. * * @param node The node to visit. * @param context The context. */ - visitImplicitCastExpression( - node: ast.ImplicitCastExpressionAST, + visitSpliceMemberExpression( + node: ast.SpliceMemberExpressionAST, context: Context, ): void { - this.accept(node.getExpression(), context); + this.accept(node.getBaseExpression(), context); + this.accept(node.getSplicer(), context); } /** - * Visit a BinaryExpression node. + * Visit a MemberExpression node. * * @param node The node to visit. * @param context The context. */ - visitBinaryExpression(node: ast.BinaryExpressionAST, context: Context): void { - this.accept(node.getLeftExpression(), context); - this.accept(node.getRightExpression(), context); + visitMemberExpression(node: ast.MemberExpressionAST, context: Context): void { + this.accept(node.getBaseExpression(), context); + this.accept(node.getNestedNameSpecifier(), context); + this.accept(node.getUnqualifiedId(), context); } /** - * Visit a ConditionalExpression node. + * Visit a PostIncrExpression node. * * @param node The node to visit. * @param context The context. */ - visitConditionalExpression( - node: ast.ConditionalExpressionAST, + visitPostIncrExpression( + node: ast.PostIncrExpressionAST, context: Context, ): void { - this.accept(node.getCondition(), context); - this.accept(node.getIftrueExpression(), context); - this.accept(node.getIffalseExpression(), context); + this.accept(node.getBaseExpression(), context); } /** - * Visit a YieldExpression node. + * Visit a CppCastExpression node. * * @param node The node to visit. * @param context The context. */ - visitYieldExpression(node: ast.YieldExpressionAST, context: Context): void { + visitCppCastExpression( + node: ast.CppCastExpressionAST, + context: Context, + ): void { + this.accept(node.getTypeId(), context); this.accept(node.getExpression(), context); } /** - * Visit a ThrowExpression node. + * Visit a BuiltinBitCastExpression node. * * @param node The node to visit. * @param context The context. */ - visitThrowExpression(node: ast.ThrowExpressionAST, context: Context): void { + visitBuiltinBitCastExpression( + node: ast.BuiltinBitCastExpressionAST, + context: Context, + ): void { + this.accept(node.getTypeId(), context); this.accept(node.getExpression(), context); } /** - * Visit a AssignmentExpression node. + * Visit a BuiltinOffsetofExpression node. * * @param node The node to visit. * @param context The context. */ - visitAssignmentExpression( - node: ast.AssignmentExpressionAST, + visitBuiltinOffsetofExpression( + node: ast.BuiltinOffsetofExpressionAST, context: Context, ): void { - this.accept(node.getLeftExpression(), context); - this.accept(node.getRightExpression(), context); + this.accept(node.getTypeId(), context); + this.accept(node.getExpression(), context); } /** - * Visit a PackExpansionExpression node. + * Visit a TypeidExpression node. * * @param node The node to visit. * @param context The context. */ - visitPackExpansionExpression( - node: ast.PackExpansionExpressionAST, - context: Context, - ): void { + visitTypeidExpression(node: ast.TypeidExpressionAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a DesignatedInitializerClause node. + * Visit a TypeidOfTypeExpression node. * * @param node The node to visit. * @param context The context. */ - visitDesignatedInitializerClause( - node: ast.DesignatedInitializerClauseAST, + visitTypeidOfTypeExpression( + node: ast.TypeidOfTypeExpressionAST, context: Context, ): void { - for (const element of node.getDesignatorList()) { - this.accept(element, context); - } - this.accept(node.getInitializer(), context); + this.accept(node.getTypeId(), context); } /** - * Visit a TypeTraitExpression node. + * Visit a SpliceExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeTraitExpression( - node: ast.TypeTraitExpressionAST, - context: Context, - ): void { - for (const element of node.getTypeIdList()) { - this.accept(element, context); - } + visitSpliceExpression(node: ast.SpliceExpressionAST, context: Context): void { + this.accept(node.getSplicer(), context); } /** - * Visit a ConditionExpression node. + * Visit a GlobalScopeReflectExpression node. * * @param node The node to visit. * @param context The context. */ - visitConditionExpression( - node: ast.ConditionExpressionAST, + visitGlobalScopeReflectExpression( + node: ast.GlobalScopeReflectExpressionAST, context: Context, - ): void { - for (const element of node.getAttributeList()) { - this.accept(element, context); - } - for (const element of node.getDeclSpecifierList()) { - this.accept(element, context); - } - this.accept(node.getDeclarator(), context); - this.accept(node.getInitializer(), context); - } + ): void {} /** - * Visit a EqualInitializer node. + * Visit a NamespaceReflectExpression node. * * @param node The node to visit. * @param context The context. */ - visitEqualInitializer(node: ast.EqualInitializerAST, context: Context): void { - this.accept(node.getExpression(), context); - } + visitNamespaceReflectExpression( + node: ast.NamespaceReflectExpressionAST, + context: Context, + ): void {} /** - * Visit a BracedInitList node. + * Visit a TypeIdReflectExpression node. * * @param node The node to visit. * @param context The context. */ - visitBracedInitList(node: ast.BracedInitListAST, context: Context): void { - for (const element of node.getExpressionList()) { - this.accept(element, context); - } + visitTypeIdReflectExpression( + node: ast.TypeIdReflectExpressionAST, + context: Context, + ): void { + this.accept(node.getTypeId(), context); } /** - * Visit a ParenInitializer node. + * Visit a ReflectExpression node. * * @param node The node to visit. * @param context The context. */ - visitParenInitializer(node: ast.ParenInitializerAST, context: Context): void { - for (const element of node.getExpressionList()) { - this.accept(element, context); - } + visitReflectExpression( + node: ast.ReflectExpressionAST, + context: Context, + ): void { + this.accept(node.getExpression(), context); } /** - * Visit a DefaultGenericAssociation node. + * Visit a LabelAddressExpression node. * * @param node The node to visit. * @param context The context. */ - visitDefaultGenericAssociation( - node: ast.DefaultGenericAssociationAST, + visitLabelAddressExpression( + node: ast.LabelAddressExpressionAST, context: Context, - ): void { - this.accept(node.getExpression(), context); - } + ): void {} /** - * Visit a TypeGenericAssociation node. + * Visit a UnaryExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeGenericAssociation( - node: ast.TypeGenericAssociationAST, - context: Context, - ): void { - this.accept(node.getTypeId(), context); + visitUnaryExpression(node: ast.UnaryExpressionAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a DotDesignator node. + * Visit a AwaitExpression node. * * @param node The node to visit. * @param context The context. */ - visitDotDesignator(node: ast.DotDesignatorAST, context: Context): void {} + visitAwaitExpression(node: ast.AwaitExpressionAST, context: Context): void { + this.accept(node.getExpression(), context); + } /** - * Visit a SubscriptDesignator node. + * Visit a SizeofExpression node. * * @param node The node to visit. * @param context The context. */ - visitSubscriptDesignator( - node: ast.SubscriptDesignatorAST, - context: Context, - ): void { + visitSizeofExpression(node: ast.SizeofExpressionAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a Splicer node. + * Visit a SizeofTypeExpression node. * * @param node The node to visit. * @param context The context. */ - visitSplicer(node: ast.SplicerAST, context: Context): void { - this.accept(node.getExpression(), context); + visitSizeofTypeExpression( + node: ast.SizeofTypeExpressionAST, + context: Context, + ): void { + this.accept(node.getTypeId(), context); } /** - * Visit a GlobalModuleFragment node. + * Visit a SizeofPackExpression node. * * @param node The node to visit. * @param context The context. */ - visitGlobalModuleFragment( - node: ast.GlobalModuleFragmentAST, + visitSizeofPackExpression( + node: ast.SizeofPackExpressionAST, context: Context, - ): void { - for (const element of node.getDeclarationList()) { - this.accept(element, context); - } - } + ): void {} /** - * Visit a PrivateModuleFragment node. + * Visit a AlignofTypeExpression node. * * @param node The node to visit. * @param context The context. */ - visitPrivateModuleFragment( - node: ast.PrivateModuleFragmentAST, + visitAlignofTypeExpression( + node: ast.AlignofTypeExpressionAST, context: Context, ): void { - for (const element of node.getDeclarationList()) { - this.accept(element, context); - } + this.accept(node.getTypeId(), context); } /** - * Visit a ModuleDeclaration node. + * Visit a AlignofExpression node. * * @param node The node to visit. * @param context The context. */ - visitModuleDeclaration( - node: ast.ModuleDeclarationAST, + visitAlignofExpression( + node: ast.AlignofExpressionAST, context: Context, ): void { - this.accept(node.getModuleName(), context); - this.accept(node.getModulePartition(), context); - for (const element of node.getAttributeList()) { - this.accept(element, context); - } + this.accept(node.getExpression(), context); } /** - * Visit a ModuleName node. + * Visit a NoexceptExpression node. * * @param node The node to visit. * @param context The context. */ - visitModuleName(node: ast.ModuleNameAST, context: Context): void { - this.accept(node.getModuleQualifier(), context); + visitNoexceptExpression( + node: ast.NoexceptExpressionAST, + context: Context, + ): void { + this.accept(node.getExpression(), context); } /** - * Visit a ModuleQualifier node. + * Visit a NewExpression node. * * @param node The node to visit. * @param context The context. */ - visitModuleQualifier(node: ast.ModuleQualifierAST, context: Context): void { - this.accept(node.getModuleQualifier(), context); + visitNewExpression(node: ast.NewExpressionAST, context: Context): void { + this.accept(node.getNewPlacement(), context); + for (const element of node.getTypeSpecifierList()) { + this.accept(element, context); + } + this.accept(node.getDeclarator(), context); + this.accept(node.getNewInitalizer(), context); } /** - * Visit a ModulePartition node. + * Visit a DeleteExpression node. * * @param node The node to visit. * @param context The context. */ - visitModulePartition(node: ast.ModulePartitionAST, context: Context): void { - this.accept(node.getModuleName(), context); + visitDeleteExpression(node: ast.DeleteExpressionAST, context: Context): void { + this.accept(node.getExpression(), context); } /** - * Visit a ImportName node. + * Visit a CastExpression node. * * @param node The node to visit. * @param context The context. */ - visitImportName(node: ast.ImportNameAST, context: Context): void { - this.accept(node.getModulePartition(), context); - this.accept(node.getModuleName(), context); + visitCastExpression(node: ast.CastExpressionAST, context: Context): void { + this.accept(node.getTypeId(), context); + this.accept(node.getExpression(), context); } /** - * Visit a InitDeclarator node. + * Visit a ImplicitCastExpression node. * * @param node The node to visit. * @param context The context. */ - visitInitDeclarator(node: ast.InitDeclaratorAST, context: Context): void { - this.accept(node.getDeclarator(), context); - this.accept(node.getRequiresClause(), context); - this.accept(node.getInitializer(), context); + visitImplicitCastExpression( + node: ast.ImplicitCastExpressionAST, + context: Context, + ): void { + this.accept(node.getExpression(), context); } /** - * Visit a Declarator node. + * Visit a BinaryExpression node. * * @param node The node to visit. * @param context The context. */ - visitDeclarator(node: ast.DeclaratorAST, context: Context): void { - for (const element of node.getPtrOpList()) { - this.accept(element, context); - } - this.accept(node.getCoreDeclarator(), context); - for (const element of node.getDeclaratorChunkList()) { - this.accept(element, context); - } + visitBinaryExpression(node: ast.BinaryExpressionAST, context: Context): void { + this.accept(node.getLeftExpression(), context); + this.accept(node.getRightExpression(), context); } /** - * Visit a UsingDeclarator node. + * Visit a ConditionalExpression node. * * @param node The node to visit. * @param context The context. */ - visitUsingDeclarator(node: ast.UsingDeclaratorAST, context: Context): void { - this.accept(node.getNestedNameSpecifier(), context); - this.accept(node.getUnqualifiedId(), context); + visitConditionalExpression( + node: ast.ConditionalExpressionAST, + context: Context, + ): void { + this.accept(node.getCondition(), context); + this.accept(node.getIftrueExpression(), context); + this.accept(node.getIffalseExpression(), context); } /** - * Visit a Enumerator node. + * Visit a YieldExpression node. * * @param node The node to visit. * @param context The context. */ - visitEnumerator(node: ast.EnumeratorAST, context: Context): void { - for (const element of node.getAttributeList()) { - this.accept(element, context); - } + visitYieldExpression(node: ast.YieldExpressionAST, context: Context): void { this.accept(node.getExpression(), context); } /** - * Visit a TypeId node. + * Visit a ThrowExpression node. * * @param node The node to visit. * @param context The context. */ - visitTypeId(node: ast.TypeIdAST, context: Context): void { - for (const element of node.getTypeSpecifierList()) { - this.accept(element, context); - } - this.accept(node.getDeclarator(), context); + visitThrowExpression(node: ast.ThrowExpressionAST, context: Context): void { + this.accept(node.getExpression(), context); } /** - * Visit a Handler node. + * Visit a AssignmentExpression node. * * @param node The node to visit. * @param context The context. */ - visitHandler(node: ast.HandlerAST, context: Context): void { - this.accept(node.getExceptionDeclaration(), context); - this.accept(node.getStatement(), context); + visitAssignmentExpression( + node: ast.AssignmentExpressionAST, + context: Context, + ): void { + this.accept(node.getLeftExpression(), context); + this.accept(node.getRightExpression(), context); } /** - * Visit a BaseSpecifier node. + * Visit a PackExpansionExpression node. * * @param node The node to visit. * @param context The context. */ - visitBaseSpecifier(node: ast.BaseSpecifierAST, context: Context): void { - for (const element of node.getAttributeList()) { - this.accept(element, context); - } - this.accept(node.getNestedNameSpecifier(), context); - this.accept(node.getUnqualifiedId(), context); + visitPackExpansionExpression( + node: ast.PackExpansionExpressionAST, + context: Context, + ): void { + this.accept(node.getExpression(), context); } /** - * Visit a RequiresClause node. + * Visit a DesignatedInitializerClause node. * * @param node The node to visit. * @param context The context. */ - visitRequiresClause(node: ast.RequiresClauseAST, context: Context): void { - this.accept(node.getExpression(), context); + visitDesignatedInitializerClause( + node: ast.DesignatedInitializerClauseAST, + context: Context, + ): void { + for (const element of node.getDesignatorList()) { + this.accept(element, context); + } + this.accept(node.getInitializer(), context); } /** - * Visit a ParameterDeclarationClause node. + * Visit a TypeTraitExpression node. * * @param node The node to visit. * @param context The context. */ - visitParameterDeclarationClause( - node: ast.ParameterDeclarationClauseAST, + visitTypeTraitExpression( + node: ast.TypeTraitExpressionAST, context: Context, ): void { - for (const element of node.getParameterDeclarationList()) { + for (const element of node.getTypeIdList()) { this.accept(element, context); } } /** - * Visit a TrailingReturnType node. + * Visit a ConditionExpression node. * * @param node The node to visit. * @param context The context. */ - visitTrailingReturnType( - node: ast.TrailingReturnTypeAST, + visitConditionExpression( + node: ast.ConditionExpressionAST, context: Context, ): void { - this.accept(node.getTypeId(), context); + for (const element of node.getAttributeList()) { + this.accept(element, context); + } + for (const element of node.getDeclSpecifierList()) { + this.accept(element, context); + } + this.accept(node.getDeclarator(), context); + this.accept(node.getInitializer(), context); } /** - * Visit a LambdaSpecifier node. + * Visit a EqualInitializer node. * * @param node The node to visit. * @param context The context. */ - visitLambdaSpecifier(node: ast.LambdaSpecifierAST, context: Context): void {} + visitEqualInitializer(node: ast.EqualInitializerAST, context: Context): void { + this.accept(node.getExpression(), context); + } /** - * Visit a TypeConstraint node. + * Visit a BracedInitList node. * * @param node The node to visit. * @param context The context. */ - visitTypeConstraint(node: ast.TypeConstraintAST, context: Context): void { - this.accept(node.getNestedNameSpecifier(), context); - for (const element of node.getTemplateArgumentList()) { + visitBracedInitList(node: ast.BracedInitListAST, context: Context): void { + for (const element of node.getExpressionList()) { this.accept(element, context); } } /** - * Visit a AttributeArgumentClause node. + * Visit a ParenInitializer node. * * @param node The node to visit. * @param context The context. */ - visitAttributeArgumentClause( - node: ast.AttributeArgumentClauseAST, - context: Context, - ): void {} + visitParenInitializer(node: ast.ParenInitializerAST, context: Context): void { + for (const element of node.getExpressionList()) { + this.accept(element, context); + } + } /** - * Visit a Attribute node. + * Visit a DefaultGenericAssociation node. * * @param node The node to visit. * @param context The context. */ - visitAttribute(node: ast.AttributeAST, context: Context): void { - this.accept(node.getAttributeToken(), context); - this.accept(node.getAttributeArgumentClause(), context); + visitDefaultGenericAssociation( + node: ast.DefaultGenericAssociationAST, + context: Context, + ): void { + this.accept(node.getExpression(), context); } /** - * Visit a AttributeUsingPrefix node. + * Visit a TypeGenericAssociation node. * * @param node The node to visit. * @param context The context. */ - visitAttributeUsingPrefix( - node: ast.AttributeUsingPrefixAST, + visitTypeGenericAssociation( + node: ast.TypeGenericAssociationAST, context: Context, - ): void {} + ): void { + this.accept(node.getTypeId(), context); + this.accept(node.getExpression(), context); + } /** - * Visit a NewPlacement node. + * Visit a DotDesignator node. * * @param node The node to visit. * @param context The context. */ - visitNewPlacement(node: ast.NewPlacementAST, context: Context): void { - for (const element of node.getExpressionList()) { - this.accept(element, context); - } - } + visitDotDesignator(node: ast.DotDesignatorAST, context: Context): void {} /** - * Visit a NestedNamespaceSpecifier node. + * Visit a SubscriptDesignator node. * * @param node The node to visit. * @param context The context. */ - visitNestedNamespaceSpecifier( - node: ast.NestedNamespaceSpecifierAST, + visitSubscriptDesignator( + node: ast.SubscriptDesignatorAST, context: Context, - ): void {} + ): void { + this.accept(node.getExpression(), context); + } /** * Visit a TemplateTypeParameter node. diff --git a/src/mlir/cxx/mlir/codegen.h b/src/mlir/cxx/mlir/codegen.h index 25e1a5c9..6521857a 100644 --- a/src/mlir/cxx/mlir/codegen.h +++ b/src/mlir/cxx/mlir/codegen.h @@ -104,66 +104,132 @@ class Codegen { // run on the base nodes [[nodiscard]] auto operator()(UnitAST* ast) -> UnitResult; - [[nodiscard]] auto operator()(DeclarationAST* ast) -> DeclarationResult; + + [[nodiscard]] auto declaration(DeclarationAST* ast) -> DeclarationResult; void statement(StatementAST* ast); + [[nodiscard]] auto expression(ExpressionAST* ast) -> ExpressionResult; - [[nodiscard]] auto operator()(TemplateParameterAST* ast) + [[nodiscard]] auto templateParameter(TemplateParameterAST* ast) -> TemplateParameterResult; - [[nodiscard]] auto operator()(SpecifierAST* ast) -> SpecifierResult; - [[nodiscard]] auto operator()(PtrOperatorAST* ast) -> PtrOperatorResult; - [[nodiscard]] auto operator()(CoreDeclaratorAST* ast) -> CoreDeclaratorResult; - [[nodiscard]] auto operator()(DeclaratorChunkAST* ast) + + [[nodiscard]] auto specifier(SpecifierAST* ast) -> SpecifierResult; + + [[nodiscard]] auto ptrOperator(PtrOperatorAST* ast) -> PtrOperatorResult; + + [[nodiscard]] auto coreDeclarator(CoreDeclaratorAST* ast) + -> CoreDeclaratorResult; + + [[nodiscard]] auto declaratorChunk(DeclaratorChunkAST* ast) -> DeclaratorChunkResult; - [[nodiscard]] auto operator()(UnqualifiedIdAST* ast) -> UnqualifiedIdResult; - [[nodiscard]] auto operator()(NestedNameSpecifierAST* ast) + + [[nodiscard]] auto unqualifiedId(UnqualifiedIdAST* ast) + -> UnqualifiedIdResult; + + [[nodiscard]] auto nestedNameSpecifier(NestedNameSpecifierAST* ast) -> NestedNameSpecifierResult; - [[nodiscard]] auto operator()(FunctionBodyAST* ast) -> FunctionBodyResult; - [[nodiscard]] auto operator()(TemplateArgumentAST* ast) + + [[nodiscard]] auto functionBody(FunctionBodyAST* ast) -> FunctionBodyResult; + + [[nodiscard]] auto templateArgument(TemplateArgumentAST* ast) -> TemplateArgumentResult; - [[nodiscard]] auto operator()(ExceptionSpecifierAST* ast) + + [[nodiscard]] auto exceptionSpecifier(ExceptionSpecifierAST* ast) -> ExceptionSpecifierResult; - [[nodiscard]] auto operator()(RequirementAST* ast) -> RequirementResult; - [[nodiscard]] auto operator()(NewInitializerAST* ast) -> NewInitializerResult; - [[nodiscard]] auto operator()(MemInitializerAST* ast) -> MemInitializerResult; - [[nodiscard]] auto operator()(LambdaCaptureAST* ast) -> LambdaCaptureResult; - [[nodiscard]] auto operator()(ExceptionDeclarationAST* ast) + + [[nodiscard]] auto requirement(RequirementAST* ast) -> RequirementResult; + + [[nodiscard]] auto newInitializer(NewInitializerAST* ast) + -> NewInitializerResult; + + [[nodiscard]] auto memInitializer(MemInitializerAST* ast) + -> MemInitializerResult; + + [[nodiscard]] auto lambdaCapture(LambdaCaptureAST* ast) + -> LambdaCaptureResult; + + [[nodiscard]] auto exceptionDeclaration(ExceptionDeclarationAST* ast) -> ExceptionDeclarationResult; - [[nodiscard]] auto operator()(AttributeSpecifierAST* ast) + + [[nodiscard]] auto attributeSpecifier(AttributeSpecifierAST* ast) -> AttributeSpecifierResult; - [[nodiscard]] auto operator()(AttributeTokenAST* ast) -> AttributeTokenResult; + + [[nodiscard]] auto attributeToken(AttributeTokenAST* ast) + -> AttributeTokenResult; // run on the misc nodes - auto operator()(SplicerAST* ast) -> SplicerResult; - auto operator()(GlobalModuleFragmentAST* ast) -> GlobalModuleFragmentResult; - auto operator()(PrivateModuleFragmentAST* ast) -> PrivateModuleFragmentResult; - auto operator()(ModuleDeclarationAST* ast) -> ModuleDeclarationResult; - auto operator()(ModuleNameAST* ast) -> ModuleNameResult; - auto operator()(ModuleQualifierAST* ast) -> ModuleQualifierResult; - auto operator()(ModulePartitionAST* ast) -> ModulePartitionResult; - auto operator()(ImportNameAST* ast) -> ImportNameResult; - auto operator()(InitDeclaratorAST* ast) -> InitDeclaratorResult; - auto operator()(DeclaratorAST* ast) -> DeclaratorResult; - auto operator()(UsingDeclaratorAST* ast) -> UsingDeclaratorResult; - auto operator()(EnumeratorAST* ast) -> EnumeratorResult; - auto operator()(TypeIdAST* ast) -> TypeIdResult; - auto operator()(HandlerAST* ast) -> HandlerResult; - auto operator()(BaseSpecifierAST* ast) -> BaseSpecifierResult; - auto operator()(RequiresClauseAST* ast) -> RequiresClauseResult; - auto operator()(ParameterDeclarationClauseAST* ast) - -> ParameterDeclarationClauseResult; - auto operator()(TrailingReturnTypeAST* ast) -> TrailingReturnTypeResult; - auto operator()(LambdaSpecifierAST* ast) -> LambdaSpecifierResult; - auto operator()(TypeConstraintAST* ast) -> TypeConstraintResult; - auto operator()(AttributeArgumentClauseAST* ast) + [[nodiscard]] auto splicer(SplicerAST* ast) -> SplicerResult; + + [[nodiscard]] auto globalModuleFragment(GlobalModuleFragmentAST* ast) + -> GlobalModuleFragmentResult; + + [[nodiscard]] auto privateModuleFragment(PrivateModuleFragmentAST* ast) + -> PrivateModuleFragmentResult; + + [[nodiscard]] auto moduleDeclaration(ModuleDeclarationAST* ast) + -> ModuleDeclarationResult; + + [[nodiscard]] auto moduleName(ModuleNameAST* ast) -> ModuleNameResult; + + [[nodiscard]] auto moduleQualifier(ModuleQualifierAST* ast) + -> ModuleQualifierResult; + + [[nodiscard]] auto modulePartition(ModulePartitionAST* ast) + -> ModulePartitionResult; + + [[nodiscard]] auto importName(ImportNameAST* ast) -> ImportNameResult; + + [[nodiscard]] auto initDeclarator(InitDeclaratorAST* ast) + -> InitDeclaratorResult; + + [[nodiscard]] auto declarator(DeclaratorAST* ast) -> DeclaratorResult; + + [[nodiscard]] auto usingDeclarator(UsingDeclaratorAST* ast) + -> UsingDeclaratorResult; + + [[nodiscard]] auto enumerator(EnumeratorAST* ast) -> EnumeratorResult; + + [[nodiscard]] auto typeId(TypeIdAST* ast) -> TypeIdResult; + + [[nodiscard]] auto handler(HandlerAST* ast) -> HandlerResult; + + [[nodiscard]] auto baseSpecifier(BaseSpecifierAST* ast) + -> BaseSpecifierResult; + + [[nodiscard]] auto requiresClause(RequiresClauseAST* ast) + -> RequiresClauseResult; + + [[nodiscard]] auto parameterDeclarationClause( + ParameterDeclarationClauseAST* ast) -> ParameterDeclarationClauseResult; + + [[nodiscard]] auto trailingReturnType(TrailingReturnTypeAST* ast) + -> TrailingReturnTypeResult; + + [[nodiscard]] auto lambdaSpecifier(LambdaSpecifierAST* ast) + -> LambdaSpecifierResult; + + [[nodiscard]] auto typeConstraint(TypeConstraintAST* ast) + -> TypeConstraintResult; + + [[nodiscard]] auto attributeArgumentClause(AttributeArgumentClauseAST* ast) -> AttributeArgumentClauseResult; - auto operator()(AttributeAST* ast) -> AttributeResult; - auto operator()(AttributeUsingPrefixAST* ast) -> AttributeUsingPrefixResult; - auto operator()(NewPlacementAST* ast) -> NewPlacementResult; - auto operator()(NestedNamespaceSpecifierAST* ast) + + [[nodiscard]] auto attribute(AttributeAST* ast) -> AttributeResult; + + [[nodiscard]] auto attributeUsingPrefix(AttributeUsingPrefixAST* ast) + -> AttributeUsingPrefixResult; + + [[nodiscard]] auto newPlacement(NewPlacementAST* ast) -> NewPlacementResult; + + [[nodiscard]] auto nestedNamespaceSpecifier(NestedNamespaceSpecifierAST* ast) -> NestedNamespaceSpecifierResult; + void asmOperand(AsmOperandAST* ast); + void asmQualifier(AsmQualifierAST* ast); + void asmClobber(AsmClobberAST* ast); + void asmGotoLabel(AsmGotoLabelAST* ast); + private: [[nodiscard]] auto getLocation(SourceLocation loc) -> mlir::Location; diff --git a/src/mlir/cxx/mlir/codegen_declarations.cc b/src/mlir/cxx/mlir/codegen_declarations.cc index 7f550844..71f3d79a 100644 --- a/src/mlir/cxx/mlir/codegen_declarations.cc +++ b/src/mlir/cxx/mlir/codegen_declarations.cc @@ -62,10 +62,6 @@ struct Codegen::DeclarationVisitor { auto operator()(AccessDeclarationAST* ast) -> DeclarationResult; auto operator()(ForRangeDeclarationAST* ast) -> DeclarationResult; auto operator()(StructuredBindingDeclarationAST* ast) -> DeclarationResult; - auto operator()(AsmOperandAST* ast) -> DeclarationResult; - auto operator()(AsmQualifierAST* ast) -> DeclarationResult; - auto operator()(AsmClobberAST* ast) -> DeclarationResult; - auto operator()(AsmGotoLabelAST* ast) -> DeclarationResult; }; struct Codegen::FunctionBodyVisitor { @@ -86,7 +82,7 @@ struct Codegen::TemplateParameterVisitor { auto operator()(ConstraintTypeParameterAST* ast) -> TemplateParameterResult; }; -auto Codegen::operator()(DeclarationAST* ast) -> DeclarationResult { +auto Codegen::declaration(DeclarationAST* ast) -> DeclarationResult { // if (ast) return visit(DeclarationVisitor{*this}, ast); // restrict for now to declarations that are not definitions @@ -100,45 +96,51 @@ auto Codegen::operator()(DeclarationAST* ast) -> DeclarationResult { return {}; } -auto Codegen::operator()(TemplateParameterAST* ast) -> TemplateParameterResult { +auto Codegen::templateParameter(TemplateParameterAST* ast) + -> TemplateParameterResult { if (ast) return visit(TemplateParameterVisitor{*this}, ast); return {}; } -auto Codegen::operator()(FunctionBodyAST* ast) -> FunctionBodyResult { +auto Codegen::functionBody(FunctionBodyAST* ast) -> FunctionBodyResult { if (ast) return visit(FunctionBodyVisitor{*this}, ast); return {}; } -auto Codegen::operator()(NestedNamespaceSpecifierAST* ast) +auto Codegen::nestedNamespaceSpecifier(NestedNamespaceSpecifierAST* ast) -> NestedNamespaceSpecifierResult { if (!ast) return {}; return {}; } -auto Codegen::operator()(TypeConstraintAST* ast) -> TypeConstraintResult { +auto Codegen::typeConstraint(TypeConstraintAST* ast) -> TypeConstraintResult { if (!ast) return {}; - auto nestedNameSpecifierResult = operator()(ast->nestedNameSpecifier); + auto nestedNameSpecifierResult = + nestedNameSpecifier(ast->nestedNameSpecifier); for (auto node : ListView{ast->templateArgumentList}) { - auto value = operator()(node); + auto value = templateArgument(node); } return {}; } -auto Codegen::operator()(UsingDeclaratorAST* ast) -> UsingDeclaratorResult { +auto Codegen::usingDeclarator(UsingDeclaratorAST* ast) + -> UsingDeclaratorResult { if (!ast) return {}; - auto nestedNameSpecifierResult = operator()(ast->nestedNameSpecifier); - auto unqualifiedIdResult = operator()(ast->unqualifiedId); + auto nestedNameSpecifierResult = + nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = unqualifiedId(ast->unqualifiedId); return {}; } -auto Codegen::operator()(LambdaSpecifierAST* ast) -> LambdaSpecifierResult { +auto Codegen::lambdaSpecifier(LambdaSpecifierAST* ast) + -> LambdaSpecifierResult { if (!ast) return {}; return {}; @@ -168,27 +170,27 @@ auto Codegen::DeclarationVisitor::operator()(SimpleDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(AsmDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->asmQualifierList}) { - auto value = gen(node); + gen.asmQualifier(node); } for (auto node : ListView{ast->outputOperandList}) { - auto value = gen(node); + gen.asmOperand(node); } for (auto node : ListView{ast->inputOperandList}) { - auto value = gen(node); + gen.asmOperand(node); } for (auto node : ListView{ast->clobberList}) { - auto value = gen(node); + gen.asmClobber(node); } for (auto node : ListView{ast->gotoLabelList}) { - auto value = gen(node); + gen.asmGotoLabel(node); } return {}; @@ -196,8 +198,10 @@ auto Codegen::DeclarationVisitor::operator()(AsmDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(NamespaceAliasDefinitionAST* ast) -> DeclarationResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } @@ -205,7 +209,7 @@ auto Codegen::DeclarationVisitor::operator()(NamespaceAliasDefinitionAST* ast) auto Codegen::DeclarationVisitor::operator()(UsingDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->usingDeclaratorList}) { - auto value = gen(node); + auto value = gen.usingDeclarator(node); } return {}; @@ -213,7 +217,7 @@ auto Codegen::DeclarationVisitor::operator()(UsingDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(UsingEnumDeclarationAST* ast) -> DeclarationResult { - auto enumTypeSpecifierResult = gen(ast->enumTypeSpecifier); + auto enumTypeSpecifierResult = gen.specifier(ast->enumTypeSpecifier); return {}; } @@ -221,11 +225,13 @@ auto Codegen::DeclarationVisitor::operator()(UsingEnumDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(UsingDirectiveAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } @@ -240,14 +246,14 @@ auto Codegen::DeclarationVisitor::operator()(StaticAssertDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(AliasDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->gnuAttributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } @@ -255,14 +261,16 @@ auto Codegen::DeclarationVisitor::operator()(AliasDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(OpaqueEnumDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); for (auto node : ListView{ast->typeSpecifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } return {}; @@ -339,7 +347,7 @@ auto Codegen::DeclarationVisitor::operator()(FunctionDefinitionAST* ast) std::swap(gen.exitValue_, exitValue); // generate code for the function body - auto functionBodyResult = gen(ast->functionBody); + auto functionBodyResult = gen.functionBody(ast->functionBody); // terminate the function body @@ -383,11 +391,12 @@ auto Codegen::DeclarationVisitor::operator()(FunctionDefinitionAST* ast) auto Codegen::DeclarationVisitor::operator()(TemplateDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->templateParameterList}) { - auto value = gen(node); + auto value = gen.templateParameter(node); } - auto requiresClauseResult = gen(ast->requiresClause); - auto declarationResult = gen(ast->declaration); + auto requiresClauseResult = gen.requiresClause(ast->requiresClause); + + auto declarationResult = gen.declaration(ast->declaration); return {}; } @@ -401,23 +410,26 @@ auto Codegen::DeclarationVisitor::operator()(ConceptDefinitionAST* ast) auto Codegen::DeclarationVisitor::operator()(DeductionGuideAST* ast) -> DeclarationResult { - auto explicitSpecifierResult = gen(ast->explicitSpecifier); - auto parameterDeclarationClauseResult = gen(ast->parameterDeclarationClause); - auto templateIdResult = gen(ast->templateId); + auto explicitSpecifierResult = gen.specifier(ast->explicitSpecifier); + + auto parameterDeclarationClauseResult = + gen.parameterDeclarationClause(ast->parameterDeclarationClause); + + auto templateIdResult = gen.unqualifiedId(ast->templateId); return {}; } auto Codegen::DeclarationVisitor::operator()(ExplicitInstantiationAST* ast) -> DeclarationResult { - auto declarationResult = gen(ast->declaration); + auto declarationResult = gen.declaration(ast->declaration); return {}; } auto Codegen::DeclarationVisitor::operator()(ExportDeclarationAST* ast) -> DeclarationResult { - auto declarationResult = gen(ast->declaration); + auto declarationResult = gen.declaration(ast->declaration); return {}; } @@ -425,7 +437,7 @@ auto Codegen::DeclarationVisitor::operator()(ExportDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(ExportCompoundDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } return {}; @@ -434,7 +446,7 @@ auto Codegen::DeclarationVisitor::operator()(ExportCompoundDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(LinkageSpecificationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } return {}; @@ -443,19 +455,19 @@ auto Codegen::DeclarationVisitor::operator()(LinkageSpecificationAST* ast) auto Codegen::DeclarationVisitor::operator()(NamespaceDefinitionAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->nestedNamespaceSpecifierList}) { - auto value = gen(node); + auto value = gen.nestedNamespaceSpecifier(node); } for (auto node : ListView{ast->extraAttributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } return {}; @@ -469,7 +481,7 @@ auto Codegen::DeclarationVisitor::operator()(EmptyDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(AttributeDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } return {}; @@ -477,10 +489,10 @@ auto Codegen::DeclarationVisitor::operator()(AttributeDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(ModuleImportDeclarationAST* ast) -> DeclarationResult { - auto importNameResult = gen(ast->importName); + auto importNameResult = gen.importName(ast->importName); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } return {}; @@ -489,14 +501,14 @@ auto Codegen::DeclarationVisitor::operator()(ModuleImportDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()(ParameterDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->typeSpecifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } - auto declaratorResult = gen(ast->declarator); + auto declaratorResult = gen.declarator(ast->declarator); auto expressionResult = gen.expression(ast->expression); return {}; @@ -515,15 +527,15 @@ auto Codegen::DeclarationVisitor::operator()(ForRangeDeclarationAST* ast) auto Codegen::DeclarationVisitor::operator()( StructuredBindingDeclarationAST* ast) -> DeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->declSpecifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } for (auto node : ListView{ast->bindingList}) { - auto value = gen(node); + auto value = gen.unqualifiedId(node); } auto initializerResult = gen.expression(ast->initializer); @@ -531,28 +543,6 @@ auto Codegen::DeclarationVisitor::operator()( return {}; } -auto Codegen::DeclarationVisitor::operator()(AsmOperandAST* ast) - -> DeclarationResult { - auto expressionResult = gen.expression(ast->expression); - - return {}; -} - -auto Codegen::DeclarationVisitor::operator()(AsmQualifierAST* ast) - -> DeclarationResult { - return {}; -} - -auto Codegen::DeclarationVisitor::operator()(AsmClobberAST* ast) - -> DeclarationResult { - return {}; -} - -auto Codegen::DeclarationVisitor::operator()(AsmGotoLabelAST* ast) - -> DeclarationResult { - return {}; -} - auto Codegen::FunctionBodyVisitor::operator()(DefaultFunctionBodyAST* ast) -> FunctionBodyResult { return {}; @@ -599,10 +589,11 @@ auto Codegen::FunctionBodyVisitor::operator()(DeleteFunctionBodyAST* ast) auto Codegen::TemplateParameterVisitor::operator()( TemplateTypeParameterAST* ast) -> TemplateParameterResult { for (auto node : ListView{ast->templateParameterList}) { - auto value = gen(node); + auto value = gen.templateParameter(node); } - auto requiresClauseResult = gen(ast->requiresClause); + auto requiresClauseResult = gen.requiresClause(ast->requiresClause); + auto idExpressionResult = gen.expression(ast->idExpression); return {}; @@ -610,24 +601,33 @@ auto Codegen::TemplateParameterVisitor::operator()( auto Codegen::TemplateParameterVisitor::operator()( NonTypeTemplateParameterAST* ast) -> TemplateParameterResult { - auto declarationResult = gen(ast->declaration); + auto declarationResult = gen.declaration(ast->declaration); return {}; } auto Codegen::TemplateParameterVisitor::operator()( TypenameTypeParameterAST* ast) -> TemplateParameterResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } auto Codegen::TemplateParameterVisitor::operator()( ConstraintTypeParameterAST* ast) -> TemplateParameterResult { - auto typeConstraintResult = gen(ast->typeConstraint); - auto typeIdResult = gen(ast->typeId); + auto typeConstraintResult = gen.typeConstraint(ast->typeConstraint); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } +void Codegen::asmOperand(AsmOperandAST* ast) { + auto expressionResult = expression(ast->expression); +} + +void Codegen::asmQualifier(AsmQualifierAST* ast) {} + +void Codegen::asmClobber(AsmClobberAST* ast) {} + +void Codegen::asmGotoLabel(AsmGotoLabelAST* ast) {} } // namespace cxx \ No newline at end of file diff --git a/src/mlir/cxx/mlir/codegen_declarators.cc b/src/mlir/cxx/mlir/codegen_declarators.cc index 44de3dae..151fabc5 100644 --- a/src/mlir/cxx/mlir/codegen_declarators.cc +++ b/src/mlir/cxx/mlir/codegen_declarators.cc @@ -115,69 +115,70 @@ struct Codegen::RequirementVisitor { [[nodiscard]] auto operator()(NestedRequirementAST* ast) -> RequirementResult; }; -auto Codegen::operator()(InitDeclaratorAST* ast) -> InitDeclaratorResult { +auto Codegen::initDeclarator(InitDeclaratorAST* ast) -> InitDeclaratorResult { if (!ast) return {}; - auto declaratorResult = operator()(ast->declarator); - auto requiresClauseResult = operator()(ast->requiresClause); + auto declaratorResult = declarator(ast->declarator); + auto requiresClauseResult = requiresClause(ast->requiresClause); auto initializerResult = expression(ast->initializer); return {}; } -auto Codegen::operator()(DeclaratorAST* ast) -> DeclaratorResult { +auto Codegen::declarator(DeclaratorAST* ast) -> DeclaratorResult { if (!ast) return {}; for (auto node : ListView{ast->ptrOpList}) { - auto value = operator()(node); + auto value = ptrOperator(node); } - auto coreDeclaratorResult = operator()(ast->coreDeclarator); + auto coreDeclaratorResult = coreDeclarator(ast->coreDeclarator); for (auto node : ListView{ast->declaratorChunkList}) { - auto value = operator()(node); + auto value = declaratorChunk(node); } return {}; } -auto Codegen::operator()(PtrOperatorAST* ast) -> PtrOperatorResult { +auto Codegen::ptrOperator(PtrOperatorAST* ast) -> PtrOperatorResult { if (ast) return visit(PtrOperatorVisitor{*this}, ast); return {}; } -auto Codegen::operator()(CoreDeclaratorAST* ast) -> CoreDeclaratorResult { +auto Codegen::coreDeclarator(CoreDeclaratorAST* ast) -> CoreDeclaratorResult { if (ast) return visit(CoreDeclaratorVisitor{*this}, ast); return {}; } -auto Codegen::operator()(DeclaratorChunkAST* ast) -> DeclaratorChunkResult { +auto Codegen::declaratorChunk(DeclaratorChunkAST* ast) + -> DeclaratorChunkResult { if (ast) return visit(DeclaratorChunkVisitor{*this}, ast); return {}; } -auto Codegen::operator()(ExceptionSpecifierAST* ast) +auto Codegen::exceptionSpecifier(ExceptionSpecifierAST* ast) -> ExceptionSpecifierResult { if (ast) return visit(ExceptionSpecifierVisitor{*this}, ast); return {}; } -auto Codegen::operator()(RequirementAST* ast) -> RequirementResult { +auto Codegen::requirement(RequirementAST* ast) -> RequirementResult { if (ast) return visit(RequirementVisitor{*this}, ast); return {}; } -auto Codegen::operator()(MemInitializerAST* ast) -> MemInitializerResult { +auto Codegen::memInitializer(MemInitializerAST* ast) -> MemInitializerResult { if (ast) return visit(MemInitializerVisitor{*this}, ast); return {}; } -auto Codegen::operator()(LambdaCaptureAST* ast) -> LambdaCaptureResult { +auto Codegen::lambdaCapture(LambdaCaptureAST* ast) -> LambdaCaptureResult { if (ast) return visit(LambdaCaptureVisitor{*this}, ast); return {}; } -auto Codegen::operator()(RequiresClauseAST* ast) -> RequiresClauseResult { +auto Codegen::requiresClause(RequiresClauseAST* ast) -> RequiresClauseResult { if (!ast) return {}; auto expressionResult = expression(ast->expression); @@ -185,22 +186,22 @@ auto Codegen::operator()(RequiresClauseAST* ast) -> RequiresClauseResult { return {}; } -auto Codegen::operator()(ParameterDeclarationClauseAST* ast) +auto Codegen::parameterDeclarationClause(ParameterDeclarationClauseAST* ast) -> ParameterDeclarationClauseResult { if (!ast) return {}; for (auto node : ListView{ast->parameterDeclarationList}) { - auto value = operator()(node); + auto value = declaration(node); } return {}; } -auto Codegen::operator()(TrailingReturnTypeAST* ast) +auto Codegen::trailingReturnType(TrailingReturnTypeAST* ast) -> TrailingReturnTypeResult { if (!ast) return {}; - auto typeIdResult = operator()(ast->typeId); + auto typeIdResult = typeId(ast->typeId); return {}; } @@ -208,11 +209,11 @@ auto Codegen::operator()(TrailingReturnTypeAST* ast) auto Codegen::PtrOperatorVisitor::operator()(PointerOperatorAST* ast) -> PtrOperatorResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->cvQualifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } return {}; @@ -221,7 +222,7 @@ auto Codegen::PtrOperatorVisitor::operator()(PointerOperatorAST* ast) auto Codegen::PtrOperatorVisitor::operator()(ReferenceOperatorAST* ast) -> PtrOperatorResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } return {}; @@ -229,14 +230,15 @@ auto Codegen::PtrOperatorVisitor::operator()(ReferenceOperatorAST* ast) auto Codegen::PtrOperatorVisitor::operator()(PtrToMemberOperatorAST* ast) -> PtrOperatorResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->cvQualifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } return {}; @@ -244,7 +246,7 @@ auto Codegen::PtrOperatorVisitor::operator()(PtrToMemberOperatorAST* ast) auto Codegen::CoreDeclaratorVisitor::operator()(BitfieldDeclaratorAST* ast) -> CoreDeclaratorResult { - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); auto sizeExpressionResult = gen.expression(ast->sizeExpression); return {}; @@ -252,18 +254,19 @@ auto Codegen::CoreDeclaratorVisitor::operator()(BitfieldDeclaratorAST* ast) auto Codegen::CoreDeclaratorVisitor::operator()(ParameterPackAST* ast) -> CoreDeclaratorResult { - auto coreDeclaratorResult = gen(ast->coreDeclarator); + auto coreDeclaratorResult = gen.coreDeclarator(ast->coreDeclarator); return {}; } auto Codegen::CoreDeclaratorVisitor::operator()(IdDeclaratorAST* ast) -> CoreDeclaratorResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } return {}; @@ -271,26 +274,29 @@ auto Codegen::CoreDeclaratorVisitor::operator()(IdDeclaratorAST* ast) auto Codegen::CoreDeclaratorVisitor::operator()(NestedDeclaratorAST* ast) -> CoreDeclaratorResult { - auto declaratorResult = gen(ast->declarator); + auto declaratorResult = gen.declarator(ast->declarator); return {}; } auto Codegen::DeclaratorChunkVisitor::operator()( FunctionDeclaratorChunkAST* ast) -> DeclaratorChunkResult { - auto parameterDeclarationClauseResult = gen(ast->parameterDeclarationClause); + auto parameterDeclarationClauseResult = + gen.parameterDeclarationClause(ast->parameterDeclarationClause); for (auto node : ListView{ast->cvQualifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } - auto exceptionSpecifierResult = gen(ast->exceptionSpecifier); + auto exceptionSpecifierResult = + gen.exceptionSpecifier(ast->exceptionSpecifier); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto trailingReturnTypeResult = gen(ast->trailingReturnType); + auto trailingReturnTypeResult = + gen.trailingReturnType(ast->trailingReturnType); return {}; } @@ -300,7 +306,7 @@ auto Codegen::DeclaratorChunkVisitor::operator()(ArrayDeclaratorChunkAST* ast) auto expressionResult = gen.expression(ast->expression); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } return {}; @@ -328,15 +334,17 @@ auto Codegen::RequirementVisitor::operator()(SimpleRequirementAST* ast) auto Codegen::RequirementVisitor::operator()(CompoundRequirementAST* ast) -> RequirementResult { auto expressionResult = gen.expression(ast->expression); - auto typeConstraintResult = gen(ast->typeConstraint); + + auto typeConstraintResult = gen.typeConstraint(ast->typeConstraint); return {}; } auto Codegen::RequirementVisitor::operator()(TypeRequirementAST* ast) -> RequirementResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } @@ -350,8 +358,9 @@ auto Codegen::RequirementVisitor::operator()(NestedRequirementAST* ast) auto Codegen::MemInitializerVisitor::operator()(ParenMemInitializerAST* ast) -> MemInitializerResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); for (auto node : ListView{ast->expressionList}) { auto value = gen.expression(node); @@ -362,8 +371,9 @@ auto Codegen::MemInitializerVisitor::operator()(ParenMemInitializerAST* ast) auto Codegen::MemInitializerVisitor::operator()(BracedMemInitializerAST* ast) -> MemInitializerResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); auto bracedInitListResult = gen.expression(ast->bracedInitList); return {}; diff --git a/src/mlir/cxx/mlir/codegen_expressions.cc b/src/mlir/cxx/mlir/codegen_expressions.cc index 03288caf..7b789e99 100644 --- a/src/mlir/cxx/mlir/codegen_expressions.cc +++ b/src/mlir/cxx/mlir/codegen_expressions.cc @@ -105,12 +105,12 @@ auto Codegen::expression(ExpressionAST* ast) -> ExpressionResult { return {}; } -auto Codegen::operator()(NewInitializerAST* ast) -> NewInitializerResult { +auto Codegen::newInitializer(NewInitializerAST* ast) -> NewInitializerResult { if (ast) return visit(NewInitializerVisitor{*this}, ast); return {}; } -auto Codegen::operator()(NewPlacementAST* ast) -> NewPlacementResult { +auto Codegen::newPlacement(NewPlacementAST* ast) -> NewPlacementResult { if (!ast) return {}; for (auto node : ListView{ast->expressionList}) { @@ -228,7 +228,7 @@ auto Codegen::ExpressionVisitor::operator()(IdExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); + auto nestedNameSpecifierResult = gen.nestedNameSpecifier(ast->nestedNameSpecifier); auto unqualifiedIdResult = gen(ast->unqualifiedId); if (auto id = ast_cast(ast->unqualifiedId); @@ -344,7 +344,7 @@ auto Codegen::ExpressionVisitor::operator()(VaArgExpressionAST* ast) #if false auto expressionResult = gen.expression(ast->expression); - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); #endif return {op}; @@ -435,7 +435,7 @@ auto Codegen::ExpressionVisitor::operator()(MemberExpressionAST* ast) #if false auto baseExpressionResult = gen.expression(ast->baseExpression); - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); + auto nestedNameSpecifierResult = gen.nestedNameSpecifier(ast->nestedNameSpecifier); auto unqualifiedIdResult = gen(ast->unqualifiedId); #endif @@ -460,7 +460,7 @@ auto Codegen::ExpressionVisitor::operator()(CppCastExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); auto expressionResult = gen.expression(ast->expression); #endif @@ -473,7 +473,7 @@ auto Codegen::ExpressionVisitor::operator()(BuiltinBitCastExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); auto expressionResult = gen.expression(ast->expression); #endif @@ -486,7 +486,7 @@ auto Codegen::ExpressionVisitor::operator()(BuiltinOffsetofExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); auto expressionResult = gen.expression(ast->expression); #endif @@ -511,7 +511,7 @@ auto Codegen::ExpressionVisitor::operator()(TypeidOfTypeExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); #endif return {op}; @@ -550,7 +550,7 @@ auto Codegen::ExpressionVisitor::operator()(TypeIdReflectExpressionAST* ast) auto op = gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {op}; } @@ -617,7 +617,7 @@ auto Codegen::ExpressionVisitor::operator()(SizeofTypeExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); #endif return {op}; @@ -637,7 +637,7 @@ auto Codegen::ExpressionVisitor::operator()(AlignofTypeExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); #endif return {op}; @@ -679,7 +679,7 @@ auto Codegen::ExpressionVisitor::operator()(NewExpressionAST* ast) auto value = gen(node); } - auto declaratorResult = gen(ast->declarator); + auto declaratorResult = gen.declarator(ast->declarator); auto newInitalizerResult = gen(ast->newInitalizer); #endif @@ -704,7 +704,7 @@ auto Codegen::ExpressionVisitor::operator()(CastExpressionAST* ast) gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind())); #if false - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); auto expressionResult = gen.expression(ast->expression); #endif @@ -851,7 +851,7 @@ auto Codegen::ExpressionVisitor::operator()(ConditionExpressionAST* ast) auto value = gen(node); } - auto declaratorResult = gen(ast->declarator); + auto declaratorResult = gen.declarator(ast->declarator); auto initializerResult = gen.expression(ast->initializer); #endif diff --git a/src/mlir/cxx/mlir/codegen_names.cc b/src/mlir/cxx/mlir/codegen_names.cc index fdd046ed..b4fef2c2 100644 --- a/src/mlir/cxx/mlir/codegen_names.cc +++ b/src/mlir/cxx/mlir/codegen_names.cc @@ -59,18 +59,19 @@ struct Codegen::TemplateArgumentVisitor { auto operator()(ExpressionTemplateArgumentAST* ast) -> TemplateArgumentResult; }; -auto Codegen::operator()(UnqualifiedIdAST* ast) -> UnqualifiedIdResult { +auto Codegen::unqualifiedId(UnqualifiedIdAST* ast) -> UnqualifiedIdResult { if (ast) return visit(UnqualifiedIdVisitor{*this}, ast); return {}; } -auto Codegen::operator()(NestedNameSpecifierAST* ast) +auto Codegen::nestedNameSpecifier(NestedNameSpecifierAST* ast) -> NestedNameSpecifierResult { if (ast) return visit(NestedNameSpecifierVisitor{*this}, ast); return {}; } -auto Codegen::operator()(TemplateArgumentAST* ast) -> TemplateArgumentResult { +auto Codegen::templateArgument(TemplateArgumentAST* ast) + -> TemplateArgumentResult { if (ast) return visit(TemplateArgumentVisitor{*this}, ast); return {}; } @@ -82,14 +83,14 @@ auto Codegen::UnqualifiedIdVisitor::operator()(NameIdAST* ast) auto Codegen::UnqualifiedIdVisitor::operator()(DestructorIdAST* ast) -> UnqualifiedIdResult { - auto idResult = gen(ast->id); + auto idResult = gen.unqualifiedId(ast->id); return {}; } auto Codegen::UnqualifiedIdVisitor::operator()(DecltypeIdAST* ast) -> UnqualifiedIdResult { - auto decltypeSpecifierResult = gen(ast->decltypeSpecifier); + auto decltypeSpecifierResult = gen.specifier(ast->decltypeSpecifier); return {}; } @@ -106,7 +107,7 @@ auto Codegen::UnqualifiedIdVisitor::operator()(LiteralOperatorIdAST* ast) auto Codegen::UnqualifiedIdVisitor::operator()(ConversionFunctionIdAST* ast) -> UnqualifiedIdResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } @@ -114,7 +115,7 @@ auto Codegen::UnqualifiedIdVisitor::operator()(ConversionFunctionIdAST* ast) auto Codegen::UnqualifiedIdVisitor::operator()(SimpleTemplateIdAST* ast) -> UnqualifiedIdResult { for (auto node : ListView{ast->templateArgumentList}) { - auto value = gen(node); + auto value = gen.templateArgument(node); } return {}; @@ -122,10 +123,10 @@ auto Codegen::UnqualifiedIdVisitor::operator()(SimpleTemplateIdAST* ast) auto Codegen::UnqualifiedIdVisitor::operator()( LiteralOperatorTemplateIdAST* ast) -> UnqualifiedIdResult { - auto literalOperatorIdResult = gen(ast->literalOperatorId); + auto literalOperatorIdResult = gen.unqualifiedId(ast->literalOperatorId); for (auto node : ListView{ast->templateArgumentList}) { - auto value = gen(node); + auto value = gen.templateArgument(node); } return {}; @@ -133,10 +134,10 @@ auto Codegen::UnqualifiedIdVisitor::operator()( auto Codegen::UnqualifiedIdVisitor::operator()( OperatorFunctionTemplateIdAST* ast) -> UnqualifiedIdResult { - auto operatorFunctionIdResult = gen(ast->operatorFunctionId); + auto operatorFunctionIdResult = gen.unqualifiedId(ast->operatorFunctionId); for (auto node : ListView{ast->templateArgumentList}) { - auto value = gen(node); + auto value = gen.templateArgument(node); } return {}; @@ -149,29 +150,31 @@ auto Codegen::NestedNameSpecifierVisitor::operator()( auto Codegen::NestedNameSpecifierVisitor::operator()( SimpleNestedNameSpecifierAST* ast) -> NestedNameSpecifierResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); return {}; } auto Codegen::NestedNameSpecifierVisitor::operator()( DecltypeNestedNameSpecifierAST* ast) -> NestedNameSpecifierResult { - auto decltypeSpecifierResult = gen(ast->decltypeSpecifier); + auto decltypeSpecifierResult = gen.specifier(ast->decltypeSpecifier); return {}; } auto Codegen::NestedNameSpecifierVisitor::operator()( TemplateNestedNameSpecifierAST* ast) -> NestedNameSpecifierResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto templateIdResult = gen(ast->templateId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto templateIdResult = gen.unqualifiedId(ast->templateId); return {}; } auto Codegen::TemplateArgumentVisitor::operator()(TypeTemplateArgumentAST* ast) -> TemplateArgumentResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } diff --git a/src/mlir/cxx/mlir/codegen_specifiers.cc b/src/mlir/cxx/mlir/codegen_specifiers.cc index 56797b3a..3095ec5d 100644 --- a/src/mlir/cxx/mlir/codegen_specifiers.cc +++ b/src/mlir/cxx/mlir/codegen_specifiers.cc @@ -86,11 +86,11 @@ struct Codegen::AttributeTokenVisitor { auto operator()(SimpleAttributeTokenAST* ast) -> AttributeTokenResult; }; -auto Codegen::operator()(EnumeratorAST* ast) -> EnumeratorResult { +auto Codegen::enumerator(EnumeratorAST* ast) -> EnumeratorResult { if (!ast) return {}; for (auto node : ListView{ast->attributeList}) { - auto value = operator()(node); + auto value = attributeSpecifier(node); } auto expressionResult = expression(ast->expression); @@ -98,59 +98,62 @@ auto Codegen::operator()(EnumeratorAST* ast) -> EnumeratorResult { return {}; } -auto Codegen::operator()(BaseSpecifierAST* ast) -> BaseSpecifierResult { +auto Codegen::baseSpecifier(BaseSpecifierAST* ast) -> BaseSpecifierResult { if (!ast) return {}; for (auto node : ListView{ast->attributeList}) { - auto value = operator()(node); + auto value = attributeSpecifier(node); } - auto nestedNameSpecifierResult = operator()(ast->nestedNameSpecifier); - auto unqualifiedIdResult = operator()(ast->unqualifiedId); + auto nestedNameSpecifierResult = + nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = unqualifiedId(ast->unqualifiedId); return {}; } -auto Codegen::operator()(SpecifierAST* ast) -> SpecifierResult { +auto Codegen::specifier(SpecifierAST* ast) -> SpecifierResult { if (ast) return visit(SpecifierVisitor{*this}, ast); return {}; } -auto Codegen::operator()(AttributeSpecifierAST* ast) +auto Codegen::attributeSpecifier(AttributeSpecifierAST* ast) -> AttributeSpecifierResult { if (ast) return visit(AttributeSpecifierVisitor{*this}, ast); return {}; } -auto Codegen::operator()(AttributeTokenAST* ast) -> AttributeTokenResult { +auto Codegen::attributeToken(AttributeTokenAST* ast) -> AttributeTokenResult { if (ast) return visit(AttributeTokenVisitor{*this}, ast); return {}; } -auto Codegen::operator()(AttributeArgumentClauseAST* ast) +auto Codegen::attributeArgumentClause(AttributeArgumentClauseAST* ast) -> AttributeArgumentClauseResult { if (!ast) return {}; return {}; } -auto Codegen::operator()(AttributeAST* ast) -> AttributeResult { +auto Codegen::attribute(AttributeAST* ast) -> AttributeResult { if (!ast) return {}; - auto attributeTokenResult = operator()(ast->attributeToken); - auto attributeArgumentClauseResult = operator()(ast->attributeArgumentClause); + auto attributeTokenResult = attributeToken(ast->attributeToken); + + auto attributeArgumentClauseResult = + attributeArgumentClause(ast->attributeArgumentClause); return {}; } -auto Codegen::operator()(AttributeUsingPrefixAST* ast) +auto Codegen::attributeUsingPrefix(AttributeUsingPrefixAST* ast) -> AttributeUsingPrefixResult { if (!ast) return {}; return {}; } -auto Codegen::operator()(SplicerAST* ast) -> SplicerResult { +auto Codegen::splicer(SplicerAST* ast) -> SplicerResult { if (!ast) return {}; auto expressionResult = expression(ast->expression); @@ -158,14 +161,14 @@ auto Codegen::operator()(SplicerAST* ast) -> SplicerResult { return {}; } -auto Codegen::operator()(TypeIdAST* ast) -> TypeIdResult { +auto Codegen::typeId(TypeIdAST* ast) -> TypeIdResult { if (!ast) return {}; for (auto node : ListView{ast->typeSpecifierList}) { - auto value = operator()(node); + auto value = specifier(node); } - auto declaratorResult = operator()(ast->declarator); + auto declaratorResult = declarator(ast->declarator); return {}; } @@ -294,22 +297,23 @@ auto Codegen::SpecifierVisitor::operator()(ComplexTypeSpecifierAST* ast) auto Codegen::SpecifierVisitor::operator()(NamedTypeSpecifierAST* ast) -> SpecifierResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } auto Codegen::SpecifierVisitor::operator()(AtomicTypeSpecifierAST* ast) -> SpecifierResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } auto Codegen::SpecifierVisitor::operator()(UnderlyingTypeSpecifierAST* ast) -> SpecifierResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } @@ -317,11 +321,12 @@ auto Codegen::SpecifierVisitor::operator()(UnderlyingTypeSpecifierAST* ast) auto Codegen::SpecifierVisitor::operator()(ElaboratedTypeSpecifierAST* ast) -> SpecifierResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } @@ -340,8 +345,9 @@ auto Codegen::SpecifierVisitor::operator()(DecltypeSpecifierAST* ast) auto Codegen::SpecifierVisitor::operator()(PlaceholderTypeSpecifierAST* ast) -> SpecifierResult { - auto typeConstraintResult = gen(ast->typeConstraint); - auto specifierResult = gen(ast->specifier); + auto typeConstraintResult = gen.typeConstraint(ast->typeConstraint); + + auto specifierResult = gen.specifier(ast->specifier); return {}; } @@ -369,18 +375,20 @@ auto Codegen::SpecifierVisitor::operator()(AtomicQualifierAST* ast) auto Codegen::SpecifierVisitor::operator()(EnumSpecifierAST* ast) -> SpecifierResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); for (auto node : ListView{ast->typeSpecifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } for (auto node : ListView{ast->enumeratorList}) { - auto value = gen(node); + auto value = gen.enumerator(node); } return {}; @@ -389,18 +397,20 @@ auto Codegen::SpecifierVisitor::operator()(EnumSpecifierAST* ast) auto Codegen::SpecifierVisitor::operator()(ClassSpecifierAST* ast) -> SpecifierResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); for (auto node : ListView{ast->baseSpecifierList}) { - auto value = gen(node); + auto value = gen.baseSpecifier(node); } for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } return {}; @@ -408,25 +418,28 @@ auto Codegen::SpecifierVisitor::operator()(ClassSpecifierAST* ast) auto Codegen::SpecifierVisitor::operator()(TypenameSpecifierAST* ast) -> SpecifierResult { - auto nestedNameSpecifierResult = gen(ast->nestedNameSpecifier); - auto unqualifiedIdResult = gen(ast->unqualifiedId); + auto nestedNameSpecifierResult = + gen.nestedNameSpecifier(ast->nestedNameSpecifier); + + auto unqualifiedIdResult = gen.unqualifiedId(ast->unqualifiedId); return {}; } auto Codegen::SpecifierVisitor::operator()(SplicerTypeSpecifierAST* ast) -> SpecifierResult { - auto splicerResult = gen(ast->splicer); + auto splicerResult = gen.splicer(ast->splicer); return {}; } auto Codegen::AttributeSpecifierVisitor::operator()(CxxAttributeAST* ast) -> AttributeSpecifierResult { - auto attributeUsingPrefixResult = gen(ast->attributeUsingPrefix); + auto attributeUsingPrefixResult = + gen.attributeUsingPrefix(ast->attributeUsingPrefix); for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attribute(node); } return {}; @@ -446,7 +459,7 @@ auto Codegen::AttributeSpecifierVisitor::operator()(AlignasAttributeAST* ast) auto Codegen::AttributeSpecifierVisitor::operator()( AlignasTypeAttributeAST* ast) -> AttributeSpecifierResult { - auto typeIdResult = gen(ast->typeId); + auto typeIdResult = gen.typeId(ast->typeId); return {}; } diff --git a/src/mlir/cxx/mlir/codegen_statements.cc b/src/mlir/cxx/mlir/codegen_statements.cc index 66330af4..227308ae 100644 --- a/src/mlir/cxx/mlir/codegen_statements.cc +++ b/src/mlir/cxx/mlir/codegen_statements.cc @@ -64,16 +64,17 @@ void Codegen::statement(StatementAST* ast) { visit(StatementVisitor{*this}, ast); } -auto Codegen::operator()(ExceptionDeclarationAST* ast) +auto Codegen::exceptionDeclaration(ExceptionDeclarationAST* ast) -> ExceptionDeclarationResult { if (ast) return visit(ExceptionDeclarationVisitor{*this}, ast); return {}; } -auto Codegen::operator()(HandlerAST* ast) -> HandlerResult { +auto Codegen::handler(HandlerAST* ast) -> HandlerResult { if (!ast) return {}; - auto exceptionDeclarationResult = operator()(ast->exceptionDeclaration); + auto exceptionDeclarationResult = + exceptionDeclaration(ast->exceptionDeclaration); statement(ast->statement); return {}; @@ -232,14 +233,14 @@ auto Codegen::ExceptionDeclarationVisitor::operator()( auto Codegen::ExceptionDeclarationVisitor::operator()( TypeExceptionDeclarationAST* ast) -> ExceptionDeclarationResult { for (auto node : ListView{ast->attributeList}) { - auto value = gen(node); + auto value = gen.attributeSpecifier(node); } for (auto node : ListView{ast->typeSpecifierList}) { - auto value = gen(node); + auto value = gen.specifier(node); } - auto declaratorResult = gen(ast->declarator); + auto declaratorResult = gen.declarator(ast->declarator); return {}; } diff --git a/src/mlir/cxx/mlir/codegen_units.cc b/src/mlir/cxx/mlir/codegen_units.cc index 44c32549..f627219d 100644 --- a/src/mlir/cxx/mlir/codegen_units.cc +++ b/src/mlir/cxx/mlir/codegen_units.cc @@ -47,7 +47,7 @@ auto Codegen::UnitVisitor::operator()(TranslationUnitAST* ast) -> UnitResult { std::swap(gen.module_, module); for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } std::swap(gen.module_, module); @@ -64,14 +64,17 @@ auto Codegen::UnitVisitor::operator()(ModuleUnitAST* ast) -> UnitResult { std::swap(gen.module_, module); - auto globalModuleFragmentResult = gen(ast->globalModuleFragment); - auto moduleDeclarationResult = gen(ast->moduleDeclaration); + auto globalModuleFragmentResult = + gen.globalModuleFragment(ast->globalModuleFragment); + + auto moduleDeclarationResult = gen.moduleDeclaration(ast->moduleDeclaration); for (auto node : ListView{ast->declarationList}) { - auto value = gen(node); + auto value = gen.declaration(node); } - auto privateModuleFragmentResult = gen(ast->privateModuleFragment); + auto privateModuleFragmentResult = + gen.privateModuleFragment(ast->privateModuleFragment); std::swap(gen.module_, module); @@ -79,70 +82,75 @@ auto Codegen::UnitVisitor::operator()(ModuleUnitAST* ast) -> UnitResult { return result; } -auto Codegen::operator()(GlobalModuleFragmentAST* ast) +auto Codegen::globalModuleFragment(GlobalModuleFragmentAST* ast) -> GlobalModuleFragmentResult { if (!ast) return {}; for (auto node : ListView{ast->declarationList}) { - auto value = operator()(node); + auto value = declaration(node); } return {}; } -auto Codegen::operator()(PrivateModuleFragmentAST* ast) +auto Codegen::privateModuleFragment(PrivateModuleFragmentAST* ast) -> PrivateModuleFragmentResult { if (!ast) return {}; for (auto node : ListView{ast->declarationList}) { - auto value = operator()(node); + auto value = declaration(node); } return {}; } -auto Codegen::operator()(ModuleDeclarationAST* ast) -> ModuleDeclarationResult { +auto Codegen::moduleDeclaration(ModuleDeclarationAST* ast) + -> ModuleDeclarationResult { if (!ast) return {}; - auto moduleNameResult = operator()(ast->moduleName); - auto modulePartitionResult = operator()(ast->modulePartition); + auto moduleNameResult = moduleName(ast->moduleName); + + auto modulePartitionResult = modulePartition(ast->modulePartition); for (auto node : ListView{ast->attributeList}) { - auto value = operator()(node); + auto value = attributeSpecifier(node); } return {}; } -auto Codegen::operator()(ModuleNameAST* ast) -> ModuleNameResult { +auto Codegen::moduleName(ModuleNameAST* ast) -> ModuleNameResult { if (!ast) return {}; - auto moduleQualifierResult = operator()(ast->moduleQualifier); + auto moduleQualifierResult = moduleQualifier(ast->moduleQualifier); return {}; } -auto Codegen::operator()(ModuleQualifierAST* ast) -> ModuleQualifierResult { +auto Codegen::moduleQualifier(ModuleQualifierAST* ast) + -> ModuleQualifierResult { if (!ast) return {}; - auto moduleQualifierResult = operator()(ast->moduleQualifier); + auto moduleQualifierResult = moduleQualifier(ast->moduleQualifier); return {}; } -auto Codegen::operator()(ModulePartitionAST* ast) -> ModulePartitionResult { +auto Codegen::modulePartition(ModulePartitionAST* ast) + -> ModulePartitionResult { if (!ast) return {}; - auto moduleNameResult = operator()(ast->moduleName); + auto moduleNameResult = moduleName(ast->moduleName); return {}; } -auto Codegen::operator()(ImportNameAST* ast) -> ImportNameResult { +auto Codegen::importName(ImportNameAST* ast) -> ImportNameResult { if (!ast) return {}; - auto modulePartitionResult = operator()(ast->modulePartition); - auto moduleNameResult = operator()(ast->moduleName); + auto modulePartitionResult = modulePartition(ast->modulePartition); + + auto moduleNameResult = moduleName(ast->moduleName); return {}; } diff --git a/src/mlir/cxx/mlir/convert_type.cc b/src/mlir/cxx/mlir/convert_type.cc index 848585a4..9a6f6b11 100644 --- a/src/mlir/cxx/mlir/convert_type.cc +++ b/src/mlir/cxx/mlir/convert_type.cc @@ -89,6 +89,10 @@ struct Codegen::ConvertType { }; auto Codegen::convertType(const Type* type) -> mlir::Type { + if (!type) { + return builder_.getType(); + } + return visit(ConvertType{*this}, type); } @@ -180,7 +184,8 @@ auto Codegen::ConvertType::operator()(const UnsignedInt128Type* type) } auto Codegen::ConvertType::operator()(const CharType* type) -> mlir::Type { - return getExprType(); + // todo: toolchain specific + return getIntType(type, true); } auto Codegen::ConvertType::operator()(const Char8Type* type) -> mlir::Type { diff --git a/src/parser/cxx/ast.cc b/src/parser/cxx/ast.cc index 86adb24e..c16f6a36 100644 --- a/src/parser/cxx/ast.cc +++ b/src/parser/cxx/ast.cc @@ -3586,10 +3586,37 @@ std::string_view kASTKindNames[] = { "access-declaration", "for-range-declaration", "structured-binding-declaration", + + // AST "asm-operand", "asm-qualifier", "asm-clobber", "asm-goto-label", + "splicer", + "global-module-fragment", + "private-module-fragment", + "module-declaration", + "module-name", + "module-qualifier", + "module-partition", + "import-name", + "init-declarator", + "declarator", + "using-declarator", + "enumerator", + "type-id", + "handler", + "base-specifier", + "requires-clause", + "parameter-declaration-clause", + "trailing-return-type", + "lambda-specifier", + "type-constraint", + "attribute-argument-clause", + "attribute", + "attribute-using-prefix", + "new-placement", + "nested-namespace-specifier", // StatementAST "labeled-statement", @@ -3684,33 +3711,6 @@ std::string_view kASTKindNames[] = { "dot-designator", "subscript-designator", - // AST - "splicer", - "global-module-fragment", - "private-module-fragment", - "module-declaration", - "module-name", - "module-qualifier", - "module-partition", - "import-name", - "init-declarator", - "declarator", - "using-declarator", - "enumerator", - "type-id", - "handler", - "base-specifier", - "requires-clause", - "parameter-declaration-clause", - "trailing-return-type", - "lambda-specifier", - "type-constraint", - "attribute-argument-clause", - "attribute", - "attribute-using-prefix", - "new-placement", - "nested-namespace-specifier", - // TemplateParameterAST "template-type-parameter", "non-type-template-parameter", diff --git a/src/parser/cxx/ast.fbs b/src/parser/cxx/ast.fbs index 81e599e0..b707d7f0 100644 --- a/src/parser/cxx/ast.fbs +++ b/src/parser/cxx/ast.fbs @@ -27,6 +27,10 @@ table Source { } union AST { + AsmOperand, + AsmQualifier, + AsmClobber, + AsmGotoLabel, Splicer, GlobalModuleFragment, PrivateModuleFragment, @@ -100,10 +104,6 @@ union Declaration { AccessDeclaration, ForRangeDeclaration, StructuredBindingDeclaration, - AsmOperand, - AsmQualifier, - AsmClobber, - AsmGotoLabel, } union DeclaratorChunk { @@ -335,6 +335,32 @@ union UnqualifiedId { OperatorFunctionTemplateId, } +table AsmOperand /* AST */ { + expression: Expression; + symbolic_name: string; + lbracket_loc: uint32; + symbolic_name_loc: uint32; + rbracket_loc: uint32; + constraint_literal_loc: uint32; + lparen_loc: uint32; + rparen_loc: uint32; +} + +table AsmQualifier /* AST */ { + qualifier: uint32; + qualifier_loc: uint32; +} + +table AsmClobber /* AST */ { + literal: string; + literal_loc: uint32; +} + +table AsmGotoLabel /* AST */ { + identifier: string; + identifier_loc: uint32; +} + table Splicer /* AST */ { expression: Expression; lbracket_loc: uint32; @@ -788,32 +814,6 @@ table StructuredBindingDeclaration /* DeclarationAST */ { semicolon_loc: uint32; } -table AsmOperand /* DeclarationAST */ { - expression: Expression; - symbolic_name: string; - lbracket_loc: uint32; - symbolic_name_loc: uint32; - rbracket_loc: uint32; - constraint_literal_loc: uint32; - lparen_loc: uint32; - rparen_loc: uint32; -} - -table AsmQualifier /* DeclarationAST */ { - qualifier: uint32; - qualifier_loc: uint32; -} - -table AsmClobber /* DeclarationAST */ { - literal: string; - literal_loc: uint32; -} - -table AsmGotoLabel /* DeclarationAST */ { - identifier: string; - identifier_loc: uint32; -} - table FunctionDeclaratorChunk /* DeclaratorChunkAST */ { parameter_declaration_clause: ParameterDeclarationClause; cv_qualifier_list: [Specifier]; diff --git a/src/parser/cxx/ast.h b/src/parser/cxx/ast.h index 6b0d10dc..db6ed99e 100644 --- a/src/parser/cxx/ast.h +++ b/src/parser/cxx/ast.h @@ -778,11 +778,11 @@ class StructuredBindingDeclarationAST final : public DeclarationAST { auto lastSourceLocation() -> SourceLocation override; }; -class AsmOperandAST final : public DeclarationAST { +class AsmOperandAST final : public AST { public: static constexpr ASTKind Kind = ASTKind::AsmOperand; - AsmOperandAST() : DeclarationAST(Kind) {} + AsmOperandAST() : AST(Kind) {} SourceLocation lbracketLoc; SourceLocation symbolicNameLoc; @@ -800,11 +800,11 @@ class AsmOperandAST final : public DeclarationAST { auto lastSourceLocation() -> SourceLocation override; }; -class AsmQualifierAST final : public DeclarationAST { +class AsmQualifierAST final : public AST { public: static constexpr ASTKind Kind = ASTKind::AsmQualifier; - AsmQualifierAST() : DeclarationAST(Kind) {} + AsmQualifierAST() : AST(Kind) {} SourceLocation qualifierLoc; TokenKind qualifier = TokenKind::T_EOF_SYMBOL; @@ -815,11 +815,11 @@ class AsmQualifierAST final : public DeclarationAST { auto lastSourceLocation() -> SourceLocation override; }; -class AsmClobberAST final : public DeclarationAST { +class AsmClobberAST final : public AST { public: static constexpr ASTKind Kind = ASTKind::AsmClobber; - AsmClobberAST() : DeclarationAST(Kind) {} + AsmClobberAST() : AST(Kind) {} SourceLocation literalLoc; const StringLiteral* literal = nullptr; @@ -830,11 +830,11 @@ class AsmClobberAST final : public DeclarationAST { auto lastSourceLocation() -> SourceLocation override; }; -class AsmGotoLabelAST final : public DeclarationAST { +class AsmGotoLabelAST final : public AST { public: static constexpr ASTKind Kind = ASTKind::AsmGotoLabel; - AsmGotoLabelAST() : DeclarationAST(Kind) {} + AsmGotoLabelAST() : AST(Kind) {} SourceLocation identifierLoc; const Identifier* identifier = nullptr; @@ -845,15 +845,18 @@ class AsmGotoLabelAST final : public DeclarationAST { auto lastSourceLocation() -> SourceLocation override; }; -class LabeledStatementAST final : public StatementAST { +class SplicerAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::LabeledStatement; + static constexpr ASTKind Kind = ASTKind::Splicer; - LabeledStatementAST() : StatementAST(Kind) {} + SplicerAST() : AST(Kind) {} - SourceLocation identifierLoc; + SourceLocation lbracketLoc; SourceLocation colonLoc; - const Identifier* identifier = nullptr; + SourceLocation ellipsisLoc; + ExpressionAST* expression = nullptr; + SourceLocation secondColonLoc; + SourceLocation rbracketLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -861,15 +864,15 @@ class LabeledStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class CaseStatementAST final : public StatementAST { +class GlobalModuleFragmentAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::CaseStatement; + static constexpr ASTKind Kind = ASTKind::GlobalModuleFragment; - CaseStatementAST() : StatementAST(Kind) {} + GlobalModuleFragmentAST() : AST(Kind) {} - SourceLocation caseLoc; - ExpressionAST* expression = nullptr; - SourceLocation colonLoc; + SourceLocation moduleLoc; + SourceLocation semicolonLoc; + List* declarationList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -877,14 +880,17 @@ class CaseStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class DefaultStatementAST final : public StatementAST { +class PrivateModuleFragmentAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::DefaultStatement; + static constexpr ASTKind Kind = ASTKind::PrivateModuleFragment; - DefaultStatementAST() : StatementAST(Kind) {} + PrivateModuleFragmentAST() : AST(Kind) {} - SourceLocation defaultLoc; + SourceLocation moduleLoc; SourceLocation colonLoc; + SourceLocation privateLoc; + SourceLocation semicolonLoc; + List* declarationList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -892,13 +898,17 @@ class DefaultStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ExpressionStatementAST final : public StatementAST { +class ModuleDeclarationAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ExpressionStatement; + static constexpr ASTKind Kind = ASTKind::ModuleDeclaration; - ExpressionStatementAST() : StatementAST(Kind) {} + ModuleDeclarationAST() : AST(Kind) {} - ExpressionAST* expression = nullptr; + SourceLocation exportLoc; + SourceLocation moduleLoc; + ModuleNameAST* moduleName = nullptr; + ModulePartitionAST* modulePartition = nullptr; + List* attributeList = nullptr; SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -907,16 +917,15 @@ class ExpressionStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class CompoundStatementAST final : public StatementAST { +class ModuleNameAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::CompoundStatement; + static constexpr ASTKind Kind = ASTKind::ModuleName; - CompoundStatementAST() : StatementAST(Kind) {} + ModuleNameAST() : AST(Kind) {} - SourceLocation lbraceLoc; - List* statementList = nullptr; - SourceLocation rbraceLoc; - BlockSymbol* symbol = nullptr; + ModuleQualifierAST* moduleQualifier = nullptr; + SourceLocation identifierLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -924,22 +933,16 @@ class CompoundStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class IfStatementAST final : public StatementAST { +class ModuleQualifierAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::IfStatement; + static constexpr ASTKind Kind = ASTKind::ModuleQualifier; - IfStatementAST() : StatementAST(Kind) {} + ModuleQualifierAST() : AST(Kind) {} - SourceLocation ifLoc; - SourceLocation constexprLoc; - SourceLocation lparenLoc; - StatementAST* initializer = nullptr; - ExpressionAST* condition = nullptr; - SourceLocation rparenLoc; - StatementAST* statement = nullptr; - SourceLocation elseLoc; - StatementAST* elseStatement = nullptr; - BlockSymbol* symbol = nullptr; + ModuleQualifierAST* moduleQualifier = nullptr; + SourceLocation identifierLoc; + SourceLocation dotLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -947,19 +950,14 @@ class IfStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ConstevalIfStatementAST final : public StatementAST { +class ModulePartitionAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ConstevalIfStatement; + static constexpr ASTKind Kind = ASTKind::ModulePartition; - ConstevalIfStatementAST() : StatementAST(Kind) {} + ModulePartitionAST() : AST(Kind) {} - SourceLocation ifLoc; - SourceLocation exclaimLoc; - SourceLocation constvalLoc; - StatementAST* statement = nullptr; - SourceLocation elseLoc; - StatementAST* elseStatement = nullptr; - bool isNot = false; + SourceLocation colonLoc; + ModuleNameAST* moduleName = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -967,19 +965,15 @@ class ConstevalIfStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class SwitchStatementAST final : public StatementAST { +class ImportNameAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::SwitchStatement; + static constexpr ASTKind Kind = ASTKind::ImportName; - SwitchStatementAST() : StatementAST(Kind) {} + ImportNameAST() : AST(Kind) {} - SourceLocation switchLoc; - SourceLocation lparenLoc; - StatementAST* initializer = nullptr; - ExpressionAST* condition = nullptr; - SourceLocation rparenLoc; - StatementAST* statement = nullptr; - BlockSymbol* symbol = nullptr; + SourceLocation headerLoc; + ModulePartitionAST* modulePartition = nullptr; + ModuleNameAST* moduleName = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -987,18 +981,16 @@ class SwitchStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class WhileStatementAST final : public StatementAST { +class InitDeclaratorAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::WhileStatement; + static constexpr ASTKind Kind = ASTKind::InitDeclarator; - WhileStatementAST() : StatementAST(Kind) {} + InitDeclaratorAST() : AST(Kind) {} - SourceLocation whileLoc; - SourceLocation lparenLoc; - ExpressionAST* condition = nullptr; - SourceLocation rparenLoc; - StatementAST* statement = nullptr; - BlockSymbol* symbol = nullptr; + DeclaratorAST* declarator = nullptr; + RequiresClauseAST* requiresClause = nullptr; + ExpressionAST* initializer = nullptr; + Symbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1006,19 +998,15 @@ class WhileStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class DoStatementAST final : public StatementAST { +class DeclaratorAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::DoStatement; + static constexpr ASTKind Kind = ASTKind::Declarator; - DoStatementAST() : StatementAST(Kind) {} + DeclaratorAST() : AST(Kind) {} - SourceLocation doLoc; - StatementAST* statement = nullptr; - SourceLocation whileLoc; - SourceLocation lparenLoc; - ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; - SourceLocation semicolonLoc; + List* ptrOpList = nullptr; + CoreDeclaratorAST* coreDeclarator = nullptr; + List* declaratorChunkList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1026,21 +1014,18 @@ class DoStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ForRangeStatementAST final : public StatementAST { +class UsingDeclaratorAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ForRangeStatement; + static constexpr ASTKind Kind = ASTKind::UsingDeclarator; - ForRangeStatementAST() : StatementAST(Kind) {} + UsingDeclaratorAST() : AST(Kind) {} - SourceLocation forLoc; - SourceLocation lparenLoc; - StatementAST* initializer = nullptr; - DeclarationAST* rangeDeclaration = nullptr; - SourceLocation colonLoc; - ExpressionAST* rangeInitializer = nullptr; - SourceLocation rparenLoc; - StatementAST* statement = nullptr; - BlockSymbol* symbol = nullptr; + SourceLocation typenameLoc; + NestedNameSpecifierAST* nestedNameSpecifier = nullptr; + UnqualifiedIdAST* unqualifiedId = nullptr; + SourceLocation ellipsisLoc; + UsingDeclarationSymbol* symbol = nullptr; + bool isPack = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1048,21 +1033,18 @@ class ForRangeStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ForStatementAST final : public StatementAST { +class EnumeratorAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ForStatement; + static constexpr ASTKind Kind = ASTKind::Enumerator; - ForStatementAST() : StatementAST(Kind) {} + EnumeratorAST() : AST(Kind) {} - SourceLocation forLoc; - SourceLocation lparenLoc; - StatementAST* initializer = nullptr; - ExpressionAST* condition = nullptr; - SourceLocation semicolonLoc; + SourceLocation identifierLoc; + List* attributeList = nullptr; + SourceLocation equalLoc; ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; - StatementAST* statement = nullptr; - BlockSymbol* symbol = nullptr; + const Identifier* identifier = nullptr; + EnumeratorSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1070,14 +1052,15 @@ class ForStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class BreakStatementAST final : public StatementAST { +class TypeIdAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::BreakStatement; + static constexpr ASTKind Kind = ASTKind::TypeId; - BreakStatementAST() : StatementAST(Kind) {} + TypeIdAST() : AST(Kind) {} - SourceLocation breakLoc; - SourceLocation semicolonLoc; + List* typeSpecifierList = nullptr; + DeclaratorAST* declarator = nullptr; + const Type* type = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1085,14 +1068,17 @@ class BreakStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ContinueStatementAST final : public StatementAST { +class HandlerAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ContinueStatement; + static constexpr ASTKind Kind = ASTKind::Handler; - ContinueStatementAST() : StatementAST(Kind) {} + HandlerAST() : AST(Kind) {} - SourceLocation continueLoc; - SourceLocation semicolonLoc; + SourceLocation catchLoc; + SourceLocation lparenLoc; + ExceptionDeclarationAST* exceptionDeclaration = nullptr; + SourceLocation rparenLoc; + CompoundStatementAST* statement = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1100,15 +1086,24 @@ class ContinueStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class ReturnStatementAST final : public StatementAST { +class BaseSpecifierAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::ReturnStatement; + static constexpr ASTKind Kind = ASTKind::BaseSpecifier; - ReturnStatementAST() : StatementAST(Kind) {} + BaseSpecifierAST() : AST(Kind) {} - SourceLocation returnLoc; - ExpressionAST* expression = nullptr; - SourceLocation semicolonLoc; + List* attributeList = nullptr; + SourceLocation virtualOrAccessLoc; + SourceLocation otherVirtualOrAccessLoc; + NestedNameSpecifierAST* nestedNameSpecifier = nullptr; + SourceLocation templateLoc; + UnqualifiedIdAST* unqualifiedId = nullptr; + SourceLocation ellipsisLoc; + bool isTemplateIntroduced = false; + bool isVirtual = false; + bool isVariadic = false; + TokenKind accessSpecifier = TokenKind::T_EOF_SYMBOL; + BaseClassSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1116,34 +1111,14 @@ class ReturnStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class CoroutineReturnStatementAST final : public StatementAST { +class RequiresClauseAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::CoroutineReturnStatement; + static constexpr ASTKind Kind = ASTKind::RequiresClause; - CoroutineReturnStatementAST() : StatementAST(Kind) {} + RequiresClauseAST() : AST(Kind) {} - SourceLocation coreturnLoc; + SourceLocation requiresLoc; ExpressionAST* expression = nullptr; - SourceLocation semicolonLoc; - - void accept(ASTVisitor* visitor) override { visitor->visit(this); } - - auto firstSourceLocation() -> SourceLocation override; - auto lastSourceLocation() -> SourceLocation override; -}; - -class GotoStatementAST final : public StatementAST { - public: - static constexpr ASTKind Kind = ASTKind::GotoStatement; - - GotoStatementAST() : StatementAST(Kind) {} - - SourceLocation gotoLoc; - SourceLocation starLoc; - SourceLocation identifierLoc; - SourceLocation semicolonLoc; - const Identifier* identifier = nullptr; - bool isIndirect = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1151,13 +1126,17 @@ class GotoStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class DeclarationStatementAST final : public StatementAST { +class ParameterDeclarationClauseAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::DeclarationStatement; + static constexpr ASTKind Kind = ASTKind::ParameterDeclarationClause; - DeclarationStatementAST() : StatementAST(Kind) {} + ParameterDeclarationClauseAST() : AST(Kind) {} - DeclarationAST* declaration = nullptr; + List* parameterDeclarationList = nullptr; + SourceLocation commaLoc; + SourceLocation ellipsisLoc; + FunctionParametersSymbol* functionParametersSymbol = nullptr; + bool isVariadic = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1165,15 +1144,14 @@ class DeclarationStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class TryBlockStatementAST final : public StatementAST { +class TrailingReturnTypeAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::TryBlockStatement; + static constexpr ASTKind Kind = ASTKind::TrailingReturnType; - TryBlockStatementAST() : StatementAST(Kind) {} + TrailingReturnTypeAST() : AST(Kind) {} - SourceLocation tryLoc; - CompoundStatementAST* statement = nullptr; - List* handlerList = nullptr; + SourceLocation minusGreaterLoc; + TypeIdAST* typeId = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1181,14 +1159,14 @@ class TryBlockStatementAST final : public StatementAST { auto lastSourceLocation() -> SourceLocation override; }; -class GeneratedLiteralExpressionAST final : public ExpressionAST { +class LambdaSpecifierAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::GeneratedLiteralExpression; + static constexpr ASTKind Kind = ASTKind::LambdaSpecifier; - GeneratedLiteralExpressionAST() : ExpressionAST(Kind) {} + LambdaSpecifierAST() : AST(Kind) {} - SourceLocation literalLoc; - ConstValue value; + SourceLocation specifierLoc; + TokenKind specifier = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1196,14 +1174,18 @@ class GeneratedLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class CharLiteralExpressionAST final : public ExpressionAST { +class TypeConstraintAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::CharLiteralExpression; + static constexpr ASTKind Kind = ASTKind::TypeConstraint; - CharLiteralExpressionAST() : ExpressionAST(Kind) {} + TypeConstraintAST() : AST(Kind) {} - SourceLocation literalLoc; - const CharLiteral* literal = nullptr; + NestedNameSpecifierAST* nestedNameSpecifier = nullptr; + SourceLocation identifierLoc; + SourceLocation lessLoc; + List* templateArgumentList = nullptr; + SourceLocation greaterLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1211,14 +1193,14 @@ class CharLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BoolLiteralExpressionAST final : public ExpressionAST { +class AttributeArgumentClauseAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::BoolLiteralExpression; + static constexpr ASTKind Kind = ASTKind::AttributeArgumentClause; - BoolLiteralExpressionAST() : ExpressionAST(Kind) {} + AttributeArgumentClauseAST() : AST(Kind) {} - SourceLocation literalLoc; - bool isTrue = false; + SourceLocation lparenLoc; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1226,14 +1208,15 @@ class BoolLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class IntLiteralExpressionAST final : public ExpressionAST { +class AttributeAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::IntLiteralExpression; + static constexpr ASTKind Kind = ASTKind::Attribute; - IntLiteralExpressionAST() : ExpressionAST(Kind) {} + AttributeAST() : AST(Kind) {} - SourceLocation literalLoc; - const IntegerLiteral* literal = nullptr; + AttributeTokenAST* attributeToken = nullptr; + AttributeArgumentClauseAST* attributeArgumentClause = nullptr; + SourceLocation ellipsisLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1241,14 +1224,15 @@ class IntLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class FloatLiteralExpressionAST final : public ExpressionAST { +class AttributeUsingPrefixAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::FloatLiteralExpression; + static constexpr ASTKind Kind = ASTKind::AttributeUsingPrefix; - FloatLiteralExpressionAST() : ExpressionAST(Kind) {} + AttributeUsingPrefixAST() : AST(Kind) {} - SourceLocation literalLoc; - const FloatLiteral* literal = nullptr; + SourceLocation usingLoc; + SourceLocation attributeNamespaceLoc; + SourceLocation colonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1256,14 +1240,15 @@ class FloatLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NullptrLiteralExpressionAST final : public ExpressionAST { +class NewPlacementAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::NullptrLiteralExpression; + static constexpr ASTKind Kind = ASTKind::NewPlacement; - NullptrLiteralExpressionAST() : ExpressionAST(Kind) {} + NewPlacementAST() : AST(Kind) {} - SourceLocation literalLoc; - TokenKind literal = TokenKind::T_EOF_SYMBOL; + SourceLocation lparenLoc; + List* expressionList = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1271,14 +1256,17 @@ class NullptrLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class StringLiteralExpressionAST final : public ExpressionAST { +class NestedNamespaceSpecifierAST final : public AST { public: - static constexpr ASTKind Kind = ASTKind::StringLiteralExpression; + static constexpr ASTKind Kind = ASTKind::NestedNamespaceSpecifier; - StringLiteralExpressionAST() : ExpressionAST(Kind) {} + NestedNamespaceSpecifierAST() : AST(Kind) {} - SourceLocation literalLoc; - const StringLiteral* literal = nullptr; + SourceLocation inlineLoc; + SourceLocation identifierLoc; + SourceLocation scopeLoc; + const Identifier* identifier = nullptr; + bool isInline = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1286,14 +1274,15 @@ class StringLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class UserDefinedStringLiteralExpressionAST final : public ExpressionAST { +class LabeledStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::UserDefinedStringLiteralExpression; + static constexpr ASTKind Kind = ASTKind::LabeledStatement; - UserDefinedStringLiteralExpressionAST() : ExpressionAST(Kind) {} + LabeledStatementAST() : StatementAST(Kind) {} - SourceLocation literalLoc; - const StringLiteral* literal = nullptr; + SourceLocation identifierLoc; + SourceLocation colonLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1301,16 +1290,15 @@ class UserDefinedStringLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ObjectLiteralExpressionAST final : public ExpressionAST { +class CaseStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::ObjectLiteralExpression; + static constexpr ASTKind Kind = ASTKind::CaseStatement; - ObjectLiteralExpressionAST() : ExpressionAST(Kind) {} + CaseStatementAST() : StatementAST(Kind) {} - SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; - SourceLocation rparenLoc; - BracedInitListAST* bracedInitList = nullptr; + SourceLocation caseLoc; + ExpressionAST* expression = nullptr; + SourceLocation colonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1318,13 +1306,14 @@ class ObjectLiteralExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ThisExpressionAST final : public ExpressionAST { +class DefaultStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::ThisExpression; + static constexpr ASTKind Kind = ASTKind::DefaultStatement; - ThisExpressionAST() : ExpressionAST(Kind) {} + DefaultStatementAST() : StatementAST(Kind) {} - SourceLocation thisLoc; + SourceLocation defaultLoc; + SourceLocation colonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1332,19 +1321,14 @@ class ThisExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class GenericSelectionExpressionAST final : public ExpressionAST { +class ExpressionStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::GenericSelectionExpression; + static constexpr ASTKind Kind = ASTKind::ExpressionStatement; - GenericSelectionExpressionAST() : ExpressionAST(Kind) {} + ExpressionStatementAST() : StatementAST(Kind) {} - SourceLocation genericLoc; - SourceLocation lparenLoc; ExpressionAST* expression = nullptr; - SourceLocation commaLoc; - List* genericAssociationList = nullptr; - SourceLocation rparenLoc; - int matchedAssocIndex = -1; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1352,15 +1336,16 @@ class GenericSelectionExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NestedStatementExpressionAST final : public ExpressionAST { +class CompoundStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::NestedStatementExpression; + static constexpr ASTKind Kind = ASTKind::CompoundStatement; - NestedStatementExpressionAST() : ExpressionAST(Kind) {} + CompoundStatementAST() : StatementAST(Kind) {} - SourceLocation lparenLoc; - CompoundStatementAST* statement = nullptr; - SourceLocation rparenLoc; + SourceLocation lbraceLoc; + List* statementList = nullptr; + SourceLocation rbraceLoc; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1368,15 +1353,22 @@ class NestedStatementExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NestedExpressionAST final : public ExpressionAST { +class IfStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::NestedExpression; + static constexpr ASTKind Kind = ASTKind::IfStatement; - NestedExpressionAST() : ExpressionAST(Kind) {} + IfStatementAST() : StatementAST(Kind) {} + SourceLocation ifLoc; + SourceLocation constexprLoc; SourceLocation lparenLoc; - ExpressionAST* expression = nullptr; + StatementAST* initializer = nullptr; + ExpressionAST* condition = nullptr; SourceLocation rparenLoc; + StatementAST* statement = nullptr; + SourceLocation elseLoc; + StatementAST* elseStatement = nullptr; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1384,17 +1376,19 @@ class NestedExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class IdExpressionAST final : public ExpressionAST { +class ConstevalIfStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::IdExpression; + static constexpr ASTKind Kind = ASTKind::ConstevalIfStatement; - IdExpressionAST() : ExpressionAST(Kind) {} + ConstevalIfStatementAST() : StatementAST(Kind) {} - NestedNameSpecifierAST* nestedNameSpecifier = nullptr; - SourceLocation templateLoc; - UnqualifiedIdAST* unqualifiedId = nullptr; - Symbol* symbol = nullptr; - bool isTemplateIntroduced = false; + SourceLocation ifLoc; + SourceLocation exclaimLoc; + SourceLocation constvalLoc; + StatementAST* statement = nullptr; + SourceLocation elseLoc; + StatementAST* elseStatement = nullptr; + bool isNot = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1402,32 +1396,19 @@ class IdExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class LambdaExpressionAST final : public ExpressionAST { +class SwitchStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::LambdaExpression; + static constexpr ASTKind Kind = ASTKind::SwitchStatement; - LambdaExpressionAST() : ExpressionAST(Kind) {} + SwitchStatementAST() : StatementAST(Kind) {} - SourceLocation lbracketLoc; - SourceLocation captureDefaultLoc; - List* captureList = nullptr; - SourceLocation rbracketLoc; - SourceLocation lessLoc; - List* templateParameterList = nullptr; - SourceLocation greaterLoc; - RequiresClauseAST* templateRequiresClause = nullptr; + SourceLocation switchLoc; SourceLocation lparenLoc; - ParameterDeclarationClauseAST* parameterDeclarationClause = nullptr; + StatementAST* initializer = nullptr; + ExpressionAST* condition = nullptr; SourceLocation rparenLoc; - List* gnuAtributeList = nullptr; - List* lambdaSpecifierList = nullptr; - ExceptionSpecifierAST* exceptionSpecifier = nullptr; - List* attributeList = nullptr; - TrailingReturnTypeAST* trailingReturnType = nullptr; - RequiresClauseAST* requiresClause = nullptr; - CompoundStatementAST* statement = nullptr; - TokenKind captureDefault = TokenKind::T_EOF_SYMBOL; - LambdaSymbol* symbol = nullptr; + StatementAST* statement = nullptr; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1435,21 +1416,18 @@ class LambdaExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class FoldExpressionAST final : public ExpressionAST { +class WhileStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::FoldExpression; + static constexpr ASTKind Kind = ASTKind::WhileStatement; - FoldExpressionAST() : ExpressionAST(Kind) {} + WhileStatementAST() : StatementAST(Kind) {} + SourceLocation whileLoc; SourceLocation lparenLoc; - ExpressionAST* leftExpression = nullptr; - SourceLocation opLoc; - SourceLocation ellipsisLoc; - SourceLocation foldOpLoc; - ExpressionAST* rightExpression = nullptr; + ExpressionAST* condition = nullptr; SourceLocation rparenLoc; - TokenKind op = TokenKind::T_EOF_SYMBOL; - TokenKind foldOp = TokenKind::T_EOF_SYMBOL; + StatementAST* statement = nullptr; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1457,18 +1435,19 @@ class FoldExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class RightFoldExpressionAST final : public ExpressionAST { +class DoStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::RightFoldExpression; + static constexpr ASTKind Kind = ASTKind::DoStatement; - RightFoldExpressionAST() : ExpressionAST(Kind) {} + DoStatementAST() : StatementAST(Kind) {} + SourceLocation doLoc; + StatementAST* statement = nullptr; + SourceLocation whileLoc; SourceLocation lparenLoc; ExpressionAST* expression = nullptr; - SourceLocation opLoc; - SourceLocation ellipsisLoc; SourceLocation rparenLoc; - TokenKind op = TokenKind::T_EOF_SYMBOL; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1476,18 +1455,21 @@ class RightFoldExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class LeftFoldExpressionAST final : public ExpressionAST { +class ForRangeStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::LeftFoldExpression; + static constexpr ASTKind Kind = ASTKind::ForRangeStatement; - LeftFoldExpressionAST() : ExpressionAST(Kind) {} + ForRangeStatementAST() : StatementAST(Kind) {} + SourceLocation forLoc; SourceLocation lparenLoc; - SourceLocation ellipsisLoc; - SourceLocation opLoc; - ExpressionAST* expression = nullptr; + StatementAST* initializer = nullptr; + DeclarationAST* rangeDeclaration = nullptr; + SourceLocation colonLoc; + ExpressionAST* rangeInitializer = nullptr; SourceLocation rparenLoc; - TokenKind op = TokenKind::T_EOF_SYMBOL; + StatementAST* statement = nullptr; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1495,19 +1477,21 @@ class LeftFoldExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class RequiresExpressionAST final : public ExpressionAST { +class ForStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::RequiresExpression; + static constexpr ASTKind Kind = ASTKind::ForStatement; - RequiresExpressionAST() : ExpressionAST(Kind) {} + ForStatementAST() : StatementAST(Kind) {} - SourceLocation requiresLoc; + SourceLocation forLoc; SourceLocation lparenLoc; - ParameterDeclarationClauseAST* parameterDeclarationClause = nullptr; + StatementAST* initializer = nullptr; + ExpressionAST* condition = nullptr; + SourceLocation semicolonLoc; + ExpressionAST* expression = nullptr; SourceLocation rparenLoc; - SourceLocation lbraceLoc; - List* requirementList = nullptr; - SourceLocation rbraceLoc; + StatementAST* statement = nullptr; + BlockSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1515,18 +1499,14 @@ class RequiresExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class VaArgExpressionAST final : public ExpressionAST { +class BreakStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::VaArgExpression; + static constexpr ASTKind Kind = ASTKind::BreakStatement; - VaArgExpressionAST() : ExpressionAST(Kind) {} + BreakStatementAST() : StatementAST(Kind) {} - SourceLocation vaArgLoc; - SourceLocation lparenLoc; - ExpressionAST* expression = nullptr; - SourceLocation commaLoc; - TypeIdAST* typeId = nullptr; - SourceLocation rparenLoc; + SourceLocation breakLoc; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1534,16 +1514,14 @@ class VaArgExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SubscriptExpressionAST final : public ExpressionAST { +class ContinueStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::SubscriptExpression; + static constexpr ASTKind Kind = ASTKind::ContinueStatement; - SubscriptExpressionAST() : ExpressionAST(Kind) {} + ContinueStatementAST() : StatementAST(Kind) {} - ExpressionAST* baseExpression = nullptr; - SourceLocation lbracketLoc; - ExpressionAST* indexExpression = nullptr; - SourceLocation rbracketLoc; + SourceLocation continueLoc; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1551,16 +1529,15 @@ class SubscriptExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class CallExpressionAST final : public ExpressionAST { +class ReturnStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::CallExpression; + static constexpr ASTKind Kind = ASTKind::ReturnStatement; - CallExpressionAST() : ExpressionAST(Kind) {} + ReturnStatementAST() : StatementAST(Kind) {} - ExpressionAST* baseExpression = nullptr; - SourceLocation lparenLoc; - List* expressionList = nullptr; - SourceLocation rparenLoc; + SourceLocation returnLoc; + ExpressionAST* expression = nullptr; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1568,16 +1545,15 @@ class CallExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeConstructionAST final : public ExpressionAST { +class CoroutineReturnStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::TypeConstruction; + static constexpr ASTKind Kind = ASTKind::CoroutineReturnStatement; - TypeConstructionAST() : ExpressionAST(Kind) {} + CoroutineReturnStatementAST() : StatementAST(Kind) {} - SpecifierAST* typeSpecifier = nullptr; - SourceLocation lparenLoc; - List* expressionList = nullptr; - SourceLocation rparenLoc; + SourceLocation coreturnLoc; + ExpressionAST* expression = nullptr; + SourceLocation semicolonLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1585,14 +1561,18 @@ class TypeConstructionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BracedTypeConstructionAST final : public ExpressionAST { +class GotoStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::BracedTypeConstruction; + static constexpr ASTKind Kind = ASTKind::GotoStatement; - BracedTypeConstructionAST() : ExpressionAST(Kind) {} + GotoStatementAST() : StatementAST(Kind) {} - SpecifierAST* typeSpecifier = nullptr; - BracedInitListAST* bracedInitList = nullptr; + SourceLocation gotoLoc; + SourceLocation starLoc; + SourceLocation identifierLoc; + SourceLocation semicolonLoc; + const Identifier* identifier = nullptr; + bool isIndirect = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1600,19 +1580,13 @@ class BracedTypeConstructionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SpliceMemberExpressionAST final : public ExpressionAST { +class DeclarationStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::SpliceMemberExpression; + static constexpr ASTKind Kind = ASTKind::DeclarationStatement; - SpliceMemberExpressionAST() : ExpressionAST(Kind) {} + DeclarationStatementAST() : StatementAST(Kind) {} - ExpressionAST* baseExpression = nullptr; - SourceLocation accessLoc; - SourceLocation templateLoc; - SplicerAST* splicer = nullptr; - Symbol* symbol = nullptr; - TokenKind accessOp = TokenKind::T_EOF_SYMBOL; - bool isTemplateIntroduced = false; + DeclarationAST* declaration = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1620,20 +1594,15 @@ class SpliceMemberExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class MemberExpressionAST final : public ExpressionAST { +class TryBlockStatementAST final : public StatementAST { public: - static constexpr ASTKind Kind = ASTKind::MemberExpression; + static constexpr ASTKind Kind = ASTKind::TryBlockStatement; - MemberExpressionAST() : ExpressionAST(Kind) {} + TryBlockStatementAST() : StatementAST(Kind) {} - ExpressionAST* baseExpression = nullptr; - SourceLocation accessLoc; - NestedNameSpecifierAST* nestedNameSpecifier = nullptr; - SourceLocation templateLoc; - UnqualifiedIdAST* unqualifiedId = nullptr; - Symbol* symbol = nullptr; - TokenKind accessOp = TokenKind::T_EOF_SYMBOL; - bool isTemplateIntroduced = false; + SourceLocation tryLoc; + CompoundStatementAST* statement = nullptr; + List* handlerList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1641,15 +1610,14 @@ class MemberExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class PostIncrExpressionAST final : public ExpressionAST { +class GeneratedLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::PostIncrExpression; + static constexpr ASTKind Kind = ASTKind::GeneratedLiteralExpression; - PostIncrExpressionAST() : ExpressionAST(Kind) {} + GeneratedLiteralExpressionAST() : ExpressionAST(Kind) {} - ExpressionAST* baseExpression = nullptr; - SourceLocation opLoc; - TokenKind op = TokenKind::T_EOF_SYMBOL; + SourceLocation literalLoc; + ConstValue value; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1657,19 +1625,14 @@ class PostIncrExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class CppCastExpressionAST final : public ExpressionAST { +class CharLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::CppCastExpression; + static constexpr ASTKind Kind = ASTKind::CharLiteralExpression; - CppCastExpressionAST() : ExpressionAST(Kind) {} + CharLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation castLoc; - SourceLocation lessLoc; - TypeIdAST* typeId = nullptr; - SourceLocation greaterLoc; - SourceLocation lparenLoc; - ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; + SourceLocation literalLoc; + const CharLiteral* literal = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1677,18 +1640,14 @@ class CppCastExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BuiltinBitCastExpressionAST final : public ExpressionAST { +class BoolLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::BuiltinBitCastExpression; + static constexpr ASTKind Kind = ASTKind::BoolLiteralExpression; - BuiltinBitCastExpressionAST() : ExpressionAST(Kind) {} + BoolLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation castLoc; - SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; - SourceLocation commaLoc; - ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; + SourceLocation literalLoc; + bool isTrue = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1696,19 +1655,14 @@ class BuiltinBitCastExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BuiltinOffsetofExpressionAST final : public ExpressionAST { +class IntLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::BuiltinOffsetofExpression; + static constexpr ASTKind Kind = ASTKind::IntLiteralExpression; - BuiltinOffsetofExpressionAST() : ExpressionAST(Kind) {} + IntLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation offsetofLoc; - SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; - SourceLocation commaLoc; - ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; - FieldSymbol* symbol = nullptr; + SourceLocation literalLoc; + const IntegerLiteral* literal = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1716,16 +1670,14 @@ class BuiltinOffsetofExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeidExpressionAST final : public ExpressionAST { +class FloatLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeidExpression; + static constexpr ASTKind Kind = ASTKind::FloatLiteralExpression; - TypeidExpressionAST() : ExpressionAST(Kind) {} + FloatLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation typeidLoc; - SourceLocation lparenLoc; - ExpressionAST* expression = nullptr; - SourceLocation rparenLoc; + SourceLocation literalLoc; + const FloatLiteral* literal = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1733,16 +1685,14 @@ class TypeidExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeidOfTypeExpressionAST final : public ExpressionAST { +class NullptrLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeidOfTypeExpression; + static constexpr ASTKind Kind = ASTKind::NullptrLiteralExpression; - TypeidOfTypeExpressionAST() : ExpressionAST(Kind) {} + NullptrLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation typeidLoc; - SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; - SourceLocation rparenLoc; + SourceLocation literalLoc; + TokenKind literal = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1750,13 +1700,14 @@ class TypeidOfTypeExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SpliceExpressionAST final : public ExpressionAST { +class StringLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::SpliceExpression; + static constexpr ASTKind Kind = ASTKind::StringLiteralExpression; - SpliceExpressionAST() : ExpressionAST(Kind) {} + StringLiteralExpressionAST() : ExpressionAST(Kind) {} - SplicerAST* splicer = nullptr; + SourceLocation literalLoc; + const StringLiteral* literal = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1764,14 +1715,14 @@ class SpliceExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class GlobalScopeReflectExpressionAST final : public ExpressionAST { +class UserDefinedStringLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::GlobalScopeReflectExpression; + static constexpr ASTKind Kind = ASTKind::UserDefinedStringLiteralExpression; - GlobalScopeReflectExpressionAST() : ExpressionAST(Kind) {} + UserDefinedStringLiteralExpressionAST() : ExpressionAST(Kind) {} - SourceLocation caretLoc; - SourceLocation scopeLoc; + SourceLocation literalLoc; + const StringLiteral* literal = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1779,16 +1730,16 @@ class GlobalScopeReflectExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NamespaceReflectExpressionAST final : public ExpressionAST { +class ObjectLiteralExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::NamespaceReflectExpression; - - NamespaceReflectExpressionAST() : ExpressionAST(Kind) {} + static constexpr ASTKind Kind = ASTKind::ObjectLiteralExpression; - SourceLocation caretLoc; - SourceLocation identifierLoc; - const Identifier* identifier = nullptr; - NamespaceSymbol* symbol = nullptr; + ObjectLiteralExpressionAST() : ExpressionAST(Kind) {} + + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation rparenLoc; + BracedInitListAST* bracedInitList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1796,14 +1747,13 @@ class NamespaceReflectExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeIdReflectExpressionAST final : public ExpressionAST { +class ThisExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeIdReflectExpression; + static constexpr ASTKind Kind = ASTKind::ThisExpression; - TypeIdReflectExpressionAST() : ExpressionAST(Kind) {} + ThisExpressionAST() : ExpressionAST(Kind) {} - SourceLocation caretLoc; - TypeIdAST* typeId = nullptr; + SourceLocation thisLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1811,14 +1761,19 @@ class TypeIdReflectExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ReflectExpressionAST final : public ExpressionAST { +class GenericSelectionExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ReflectExpression; + static constexpr ASTKind Kind = ASTKind::GenericSelectionExpression; - ReflectExpressionAST() : ExpressionAST(Kind) {} + GenericSelectionExpressionAST() : ExpressionAST(Kind) {} - SourceLocation caretLoc; + SourceLocation genericLoc; + SourceLocation lparenLoc; ExpressionAST* expression = nullptr; + SourceLocation commaLoc; + List* genericAssociationList = nullptr; + SourceLocation rparenLoc; + int matchedAssocIndex = -1; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1826,15 +1781,15 @@ class ReflectExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class LabelAddressExpressionAST final : public ExpressionAST { +class NestedStatementExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::LabelAddressExpression; + static constexpr ASTKind Kind = ASTKind::NestedStatementExpression; - LabelAddressExpressionAST() : ExpressionAST(Kind) {} + NestedStatementExpressionAST() : ExpressionAST(Kind) {} - SourceLocation ampAmpLoc; - SourceLocation identifierLoc; - const Identifier* identifier = nullptr; + SourceLocation lparenLoc; + CompoundStatementAST* statement = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1842,15 +1797,15 @@ class LabelAddressExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class UnaryExpressionAST final : public ExpressionAST { +class NestedExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::UnaryExpression; + static constexpr ASTKind Kind = ASTKind::NestedExpression; - UnaryExpressionAST() : ExpressionAST(Kind) {} + NestedExpressionAST() : ExpressionAST(Kind) {} - SourceLocation opLoc; + SourceLocation lparenLoc; ExpressionAST* expression = nullptr; - TokenKind op = TokenKind::T_EOF_SYMBOL; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1858,14 +1813,17 @@ class UnaryExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class AwaitExpressionAST final : public ExpressionAST { +class IdExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::AwaitExpression; + static constexpr ASTKind Kind = ASTKind::IdExpression; - AwaitExpressionAST() : ExpressionAST(Kind) {} + IdExpressionAST() : ExpressionAST(Kind) {} - SourceLocation awaitLoc; - ExpressionAST* expression = nullptr; + NestedNameSpecifierAST* nestedNameSpecifier = nullptr; + SourceLocation templateLoc; + UnqualifiedIdAST* unqualifiedId = nullptr; + Symbol* symbol = nullptr; + bool isTemplateIntroduced = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1873,14 +1831,32 @@ class AwaitExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SizeofExpressionAST final : public ExpressionAST { +class LambdaExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::SizeofExpression; + static constexpr ASTKind Kind = ASTKind::LambdaExpression; - SizeofExpressionAST() : ExpressionAST(Kind) {} + LambdaExpressionAST() : ExpressionAST(Kind) {} - SourceLocation sizeofLoc; - ExpressionAST* expression = nullptr; + SourceLocation lbracketLoc; + SourceLocation captureDefaultLoc; + List* captureList = nullptr; + SourceLocation rbracketLoc; + SourceLocation lessLoc; + List* templateParameterList = nullptr; + SourceLocation greaterLoc; + RequiresClauseAST* templateRequiresClause = nullptr; + SourceLocation lparenLoc; + ParameterDeclarationClauseAST* parameterDeclarationClause = nullptr; + SourceLocation rparenLoc; + List* gnuAtributeList = nullptr; + List* lambdaSpecifierList = nullptr; + ExceptionSpecifierAST* exceptionSpecifier = nullptr; + List* attributeList = nullptr; + TrailingReturnTypeAST* trailingReturnType = nullptr; + RequiresClauseAST* requiresClause = nullptr; + CompoundStatementAST* statement = nullptr; + TokenKind captureDefault = TokenKind::T_EOF_SYMBOL; + LambdaSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1888,16 +1864,21 @@ class SizeofExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SizeofTypeExpressionAST final : public ExpressionAST { +class FoldExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::SizeofTypeExpression; + static constexpr ASTKind Kind = ASTKind::FoldExpression; - SizeofTypeExpressionAST() : ExpressionAST(Kind) {} + FoldExpressionAST() : ExpressionAST(Kind) {} - SourceLocation sizeofLoc; SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; + ExpressionAST* leftExpression = nullptr; + SourceLocation opLoc; + SourceLocation ellipsisLoc; + SourceLocation foldOpLoc; + ExpressionAST* rightExpression = nullptr; SourceLocation rparenLoc; + TokenKind op = TokenKind::T_EOF_SYMBOL; + TokenKind foldOp = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1905,18 +1886,18 @@ class SizeofTypeExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class SizeofPackExpressionAST final : public ExpressionAST { +class RightFoldExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::SizeofPackExpression; + static constexpr ASTKind Kind = ASTKind::RightFoldExpression; - SizeofPackExpressionAST() : ExpressionAST(Kind) {} + RightFoldExpressionAST() : ExpressionAST(Kind) {} - SourceLocation sizeofLoc; - SourceLocation ellipsisLoc; SourceLocation lparenLoc; - SourceLocation identifierLoc; + ExpressionAST* expression = nullptr; + SourceLocation opLoc; + SourceLocation ellipsisLoc; SourceLocation rparenLoc; - const Identifier* identifier = nullptr; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1924,16 +1905,18 @@ class SizeofPackExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class AlignofTypeExpressionAST final : public ExpressionAST { +class LeftFoldExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::AlignofTypeExpression; + static constexpr ASTKind Kind = ASTKind::LeftFoldExpression; - AlignofTypeExpressionAST() : ExpressionAST(Kind) {} + LeftFoldExpressionAST() : ExpressionAST(Kind) {} - SourceLocation alignofLoc; SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; + SourceLocation ellipsisLoc; + SourceLocation opLoc; + ExpressionAST* expression = nullptr; SourceLocation rparenLoc; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1941,14 +1924,19 @@ class AlignofTypeExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class AlignofExpressionAST final : public ExpressionAST { +class RequiresExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::AlignofExpression; + static constexpr ASTKind Kind = ASTKind::RequiresExpression; - AlignofExpressionAST() : ExpressionAST(Kind) {} + RequiresExpressionAST() : ExpressionAST(Kind) {} - SourceLocation alignofLoc; - ExpressionAST* expression = nullptr; + SourceLocation requiresLoc; + SourceLocation lparenLoc; + ParameterDeclarationClauseAST* parameterDeclarationClause = nullptr; + SourceLocation rparenLoc; + SourceLocation lbraceLoc; + List* requirementList = nullptr; + SourceLocation rbraceLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1956,15 +1944,17 @@ class AlignofExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NoexceptExpressionAST final : public ExpressionAST { +class VaArgExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::NoexceptExpression; + static constexpr ASTKind Kind = ASTKind::VaArgExpression; - NoexceptExpressionAST() : ExpressionAST(Kind) {} + VaArgExpressionAST() : ExpressionAST(Kind) {} - SourceLocation noexceptLoc; + SourceLocation vaArgLoc; SourceLocation lparenLoc; ExpressionAST* expression = nullptr; + SourceLocation commaLoc; + TypeIdAST* typeId = nullptr; SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1973,21 +1963,16 @@ class NoexceptExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class NewExpressionAST final : public ExpressionAST { +class SubscriptExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::NewExpression; + static constexpr ASTKind Kind = ASTKind::SubscriptExpression; - NewExpressionAST() : ExpressionAST(Kind) {} + SubscriptExpressionAST() : ExpressionAST(Kind) {} - SourceLocation scopeLoc; - SourceLocation newLoc; - NewPlacementAST* newPlacement = nullptr; - SourceLocation lparenLoc; - List* typeSpecifierList = nullptr; - DeclaratorAST* declarator = nullptr; - SourceLocation rparenLoc; - NewInitializerAST* newInitalizer = nullptr; - const Type* objectType = nullptr; + ExpressionAST* baseExpression = nullptr; + SourceLocation lbracketLoc; + ExpressionAST* indexExpression = nullptr; + SourceLocation rbracketLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -1995,17 +1980,16 @@ class NewExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class DeleteExpressionAST final : public ExpressionAST { +class CallExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::DeleteExpression; + static constexpr ASTKind Kind = ASTKind::CallExpression; - DeleteExpressionAST() : ExpressionAST(Kind) {} + CallExpressionAST() : ExpressionAST(Kind) {} - SourceLocation scopeLoc; - SourceLocation deleteLoc; - SourceLocation lbracketLoc; - SourceLocation rbracketLoc; - ExpressionAST* expression = nullptr; + ExpressionAST* baseExpression = nullptr; + SourceLocation lparenLoc; + List* expressionList = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2013,16 +1997,16 @@ class DeleteExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class CastExpressionAST final : public ExpressionAST { +class TypeConstructionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::CastExpression; + static constexpr ASTKind Kind = ASTKind::TypeConstruction; - CastExpressionAST() : ExpressionAST(Kind) {} + TypeConstructionAST() : ExpressionAST(Kind) {} + SpecifierAST* typeSpecifier = nullptr; SourceLocation lparenLoc; - TypeIdAST* typeId = nullptr; + List* expressionList = nullptr; SourceLocation rparenLoc; - ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2030,14 +2014,14 @@ class CastExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ImplicitCastExpressionAST final : public ExpressionAST { +class BracedTypeConstructionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ImplicitCastExpression; + static constexpr ASTKind Kind = ASTKind::BracedTypeConstruction; - ImplicitCastExpressionAST() : ExpressionAST(Kind) {} + BracedTypeConstructionAST() : ExpressionAST(Kind) {} - ExpressionAST* expression = nullptr; - ImplicitCastKind castKind = ImplicitCastKind::kIdentity; + SpecifierAST* typeSpecifier = nullptr; + BracedInitListAST* bracedInitList = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2045,16 +2029,19 @@ class ImplicitCastExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BinaryExpressionAST final : public ExpressionAST { +class SpliceMemberExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::BinaryExpression; + static constexpr ASTKind Kind = ASTKind::SpliceMemberExpression; - BinaryExpressionAST() : ExpressionAST(Kind) {} + SpliceMemberExpressionAST() : ExpressionAST(Kind) {} - ExpressionAST* leftExpression = nullptr; - SourceLocation opLoc; - ExpressionAST* rightExpression = nullptr; - TokenKind op = TokenKind::T_EOF_SYMBOL; + ExpressionAST* baseExpression = nullptr; + SourceLocation accessLoc; + SourceLocation templateLoc; + SplicerAST* splicer = nullptr; + Symbol* symbol = nullptr; + TokenKind accessOp = TokenKind::T_EOF_SYMBOL; + bool isTemplateIntroduced = false; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2062,17 +2049,36 @@ class BinaryExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ConditionalExpressionAST final : public ExpressionAST { +class MemberExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ConditionalExpression; + static constexpr ASTKind Kind = ASTKind::MemberExpression; - ConditionalExpressionAST() : ExpressionAST(Kind) {} + MemberExpressionAST() : ExpressionAST(Kind) {} - ExpressionAST* condition = nullptr; - SourceLocation questionLoc; - ExpressionAST* iftrueExpression = nullptr; - SourceLocation colonLoc; - ExpressionAST* iffalseExpression = nullptr; + ExpressionAST* baseExpression = nullptr; + SourceLocation accessLoc; + NestedNameSpecifierAST* nestedNameSpecifier = nullptr; + SourceLocation templateLoc; + UnqualifiedIdAST* unqualifiedId = nullptr; + Symbol* symbol = nullptr; + TokenKind accessOp = TokenKind::T_EOF_SYMBOL; + bool isTemplateIntroduced = false; + + void accept(ASTVisitor* visitor) override { visitor->visit(this); } + + auto firstSourceLocation() -> SourceLocation override; + auto lastSourceLocation() -> SourceLocation override; +}; + +class PostIncrExpressionAST final : public ExpressionAST { + public: + static constexpr ASTKind Kind = ASTKind::PostIncrExpression; + + PostIncrExpressionAST() : ExpressionAST(Kind) {} + + ExpressionAST* baseExpression = nullptr; + SourceLocation opLoc; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2080,14 +2086,19 @@ class ConditionalExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class YieldExpressionAST final : public ExpressionAST { +class CppCastExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::YieldExpression; + static constexpr ASTKind Kind = ASTKind::CppCastExpression; - YieldExpressionAST() : ExpressionAST(Kind) {} + CppCastExpressionAST() : ExpressionAST(Kind) {} - SourceLocation yieldLoc; + SourceLocation castLoc; + SourceLocation lessLoc; + TypeIdAST* typeId = nullptr; + SourceLocation greaterLoc; + SourceLocation lparenLoc; ExpressionAST* expression = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2095,14 +2106,18 @@ class YieldExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ThrowExpressionAST final : public ExpressionAST { +class BuiltinBitCastExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ThrowExpression; + static constexpr ASTKind Kind = ASTKind::BuiltinBitCastExpression; - ThrowExpressionAST() : ExpressionAST(Kind) {} + BuiltinBitCastExpressionAST() : ExpressionAST(Kind) {} - SourceLocation throwLoc; + SourceLocation castLoc; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation commaLoc; ExpressionAST* expression = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2110,16 +2125,19 @@ class ThrowExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class AssignmentExpressionAST final : public ExpressionAST { +class BuiltinOffsetofExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::AssignmentExpression; + static constexpr ASTKind Kind = ASTKind::BuiltinOffsetofExpression; - AssignmentExpressionAST() : ExpressionAST(Kind) {} + BuiltinOffsetofExpressionAST() : ExpressionAST(Kind) {} - ExpressionAST* leftExpression = nullptr; - SourceLocation opLoc; - ExpressionAST* rightExpression = nullptr; - TokenKind op = TokenKind::T_EOF_SYMBOL; + SourceLocation offsetofLoc; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation commaLoc; + ExpressionAST* expression = nullptr; + SourceLocation rparenLoc; + FieldSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2127,14 +2145,16 @@ class AssignmentExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class PackExpansionExpressionAST final : public ExpressionAST { +class TypeidExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::PackExpansionExpression; + static constexpr ASTKind Kind = ASTKind::TypeidExpression; - PackExpansionExpressionAST() : ExpressionAST(Kind) {} + TypeidExpressionAST() : ExpressionAST(Kind) {} + SourceLocation typeidLoc; + SourceLocation lparenLoc; ExpressionAST* expression = nullptr; - SourceLocation ellipsisLoc; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2142,14 +2162,16 @@ class PackExpansionExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class DesignatedInitializerClauseAST final : public ExpressionAST { +class TypeidOfTypeExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::DesignatedInitializerClause; + static constexpr ASTKind Kind = ASTKind::TypeidOfTypeExpression; - DesignatedInitializerClauseAST() : ExpressionAST(Kind) {} + TypeidOfTypeExpressionAST() : ExpressionAST(Kind) {} - List* designatorList = nullptr; - ExpressionAST* initializer = nullptr; + SourceLocation typeidLoc; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2157,17 +2179,13 @@ class DesignatedInitializerClauseAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeTraitExpressionAST final : public ExpressionAST { +class SpliceExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeTraitExpression; + static constexpr ASTKind Kind = ASTKind::SpliceExpression; - TypeTraitExpressionAST() : ExpressionAST(Kind) {} + SpliceExpressionAST() : ExpressionAST(Kind) {} - SourceLocation typeTraitLoc; - SourceLocation lparenLoc; - List* typeIdList = nullptr; - SourceLocation rparenLoc; - BuiltinTypeTraitKind typeTrait = BuiltinTypeTraitKind::T_NONE; + SplicerAST* splicer = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2175,17 +2193,14 @@ class TypeTraitExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ConditionExpressionAST final : public ExpressionAST { +class GlobalScopeReflectExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ConditionExpression; + static constexpr ASTKind Kind = ASTKind::GlobalScopeReflectExpression; - ConditionExpressionAST() : ExpressionAST(Kind) {} + GlobalScopeReflectExpressionAST() : ExpressionAST(Kind) {} - List* attributeList = nullptr; - List* declSpecifierList = nullptr; - DeclaratorAST* declarator = nullptr; - ExpressionAST* initializer = nullptr; - VariableSymbol* symbol = nullptr; + SourceLocation caretLoc; + SourceLocation scopeLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2193,14 +2208,16 @@ class ConditionExpressionAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class EqualInitializerAST final : public ExpressionAST { +class NamespaceReflectExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::EqualInitializer; + static constexpr ASTKind Kind = ASTKind::NamespaceReflectExpression; - EqualInitializerAST() : ExpressionAST(Kind) {} + NamespaceReflectExpressionAST() : ExpressionAST(Kind) {} - SourceLocation equalLoc; - ExpressionAST* expression = nullptr; + SourceLocation caretLoc; + SourceLocation identifierLoc; + const Identifier* identifier = nullptr; + NamespaceSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2208,16 +2225,14 @@ class EqualInitializerAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class BracedInitListAST final : public ExpressionAST { +class TypeIdReflectExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::BracedInitList; + static constexpr ASTKind Kind = ASTKind::TypeIdReflectExpression; - BracedInitListAST() : ExpressionAST(Kind) {} + TypeIdReflectExpressionAST() : ExpressionAST(Kind) {} - SourceLocation lbraceLoc; - List* expressionList = nullptr; - SourceLocation commaLoc; - SourceLocation rbraceLoc; + SourceLocation caretLoc; + TypeIdAST* typeId = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2225,15 +2240,14 @@ class BracedInitListAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class ParenInitializerAST final : public ExpressionAST { +class ReflectExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ParenInitializer; + static constexpr ASTKind Kind = ASTKind::ReflectExpression; - ParenInitializerAST() : ExpressionAST(Kind) {} + ReflectExpressionAST() : ExpressionAST(Kind) {} - SourceLocation lparenLoc; - List* expressionList = nullptr; - SourceLocation rparenLoc; + SourceLocation caretLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2241,15 +2255,15 @@ class ParenInitializerAST final : public ExpressionAST { auto lastSourceLocation() -> SourceLocation override; }; -class DefaultGenericAssociationAST final : public GenericAssociationAST { +class LabelAddressExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::DefaultGenericAssociation; + static constexpr ASTKind Kind = ASTKind::LabelAddressExpression; - DefaultGenericAssociationAST() : GenericAssociationAST(Kind) {} + LabelAddressExpressionAST() : ExpressionAST(Kind) {} - SourceLocation defaultLoc; - SourceLocation colonLoc; - ExpressionAST* expression = nullptr; + SourceLocation ampAmpLoc; + SourceLocation identifierLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2257,15 +2271,15 @@ class DefaultGenericAssociationAST final : public GenericAssociationAST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeGenericAssociationAST final : public GenericAssociationAST { +class UnaryExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeGenericAssociation; + static constexpr ASTKind Kind = ASTKind::UnaryExpression; - TypeGenericAssociationAST() : GenericAssociationAST(Kind) {} + UnaryExpressionAST() : ExpressionAST(Kind) {} - TypeIdAST* typeId = nullptr; - SourceLocation colonLoc; + SourceLocation opLoc; ExpressionAST* expression = nullptr; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2273,15 +2287,14 @@ class TypeGenericAssociationAST final : public GenericAssociationAST { auto lastSourceLocation() -> SourceLocation override; }; -class DotDesignatorAST final : public DesignatorAST { +class AwaitExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::DotDesignator; + static constexpr ASTKind Kind = ASTKind::AwaitExpression; - DotDesignatorAST() : DesignatorAST(Kind) {} + AwaitExpressionAST() : ExpressionAST(Kind) {} - SourceLocation dotLoc; - SourceLocation identifierLoc; - const Identifier* identifier = nullptr; + SourceLocation awaitLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2289,15 +2302,14 @@ class DotDesignatorAST final : public DesignatorAST { auto lastSourceLocation() -> SourceLocation override; }; -class SubscriptDesignatorAST final : public DesignatorAST { +class SizeofExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::SubscriptDesignator; + static constexpr ASTKind Kind = ASTKind::SizeofExpression; - SubscriptDesignatorAST() : DesignatorAST(Kind) {} + SizeofExpressionAST() : ExpressionAST(Kind) {} - SourceLocation lbracketLoc; + SourceLocation sizeofLoc; ExpressionAST* expression = nullptr; - SourceLocation rbracketLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2305,18 +2317,16 @@ class SubscriptDesignatorAST final : public DesignatorAST { auto lastSourceLocation() -> SourceLocation override; }; -class SplicerAST final : public AST { +class SizeofTypeExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::Splicer; + static constexpr ASTKind Kind = ASTKind::SizeofTypeExpression; - SplicerAST() : AST(Kind) {} + SizeofTypeExpressionAST() : ExpressionAST(Kind) {} - SourceLocation lbracketLoc; - SourceLocation colonLoc; - SourceLocation ellipsisLoc; - ExpressionAST* expression = nullptr; - SourceLocation secondColonLoc; - SourceLocation rbracketLoc; + SourceLocation sizeofLoc; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2324,15 +2334,18 @@ class SplicerAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class GlobalModuleFragmentAST final : public AST { +class SizeofPackExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::GlobalModuleFragment; + static constexpr ASTKind Kind = ASTKind::SizeofPackExpression; - GlobalModuleFragmentAST() : AST(Kind) {} + SizeofPackExpressionAST() : ExpressionAST(Kind) {} - SourceLocation moduleLoc; - SourceLocation semicolonLoc; - List* declarationList = nullptr; + SourceLocation sizeofLoc; + SourceLocation ellipsisLoc; + SourceLocation lparenLoc; + SourceLocation identifierLoc; + SourceLocation rparenLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2340,17 +2353,16 @@ class GlobalModuleFragmentAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class PrivateModuleFragmentAST final : public AST { +class AlignofTypeExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::PrivateModuleFragment; + static constexpr ASTKind Kind = ASTKind::AlignofTypeExpression; - PrivateModuleFragmentAST() : AST(Kind) {} + AlignofTypeExpressionAST() : ExpressionAST(Kind) {} - SourceLocation moduleLoc; - SourceLocation colonLoc; - SourceLocation privateLoc; - SourceLocation semicolonLoc; - List* declarationList = nullptr; + SourceLocation alignofLoc; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2358,18 +2370,14 @@ class PrivateModuleFragmentAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ModuleDeclarationAST final : public AST { +class AlignofExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ModuleDeclaration; + static constexpr ASTKind Kind = ASTKind::AlignofExpression; - ModuleDeclarationAST() : AST(Kind) {} + AlignofExpressionAST() : ExpressionAST(Kind) {} - SourceLocation exportLoc; - SourceLocation moduleLoc; - ModuleNameAST* moduleName = nullptr; - ModulePartitionAST* modulePartition = nullptr; - List* attributeList = nullptr; - SourceLocation semicolonLoc; + SourceLocation alignofLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2377,15 +2385,16 @@ class ModuleDeclarationAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ModuleNameAST final : public AST { +class NoexceptExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ModuleName; + static constexpr ASTKind Kind = ASTKind::NoexceptExpression; - ModuleNameAST() : AST(Kind) {} + NoexceptExpressionAST() : ExpressionAST(Kind) {} - ModuleQualifierAST* moduleQualifier = nullptr; - SourceLocation identifierLoc; - const Identifier* identifier = nullptr; + SourceLocation noexceptLoc; + SourceLocation lparenLoc; + ExpressionAST* expression = nullptr; + SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2393,16 +2402,21 @@ class ModuleNameAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ModuleQualifierAST final : public AST { +class NewExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ModuleQualifier; + static constexpr ASTKind Kind = ASTKind::NewExpression; - ModuleQualifierAST() : AST(Kind) {} + NewExpressionAST() : ExpressionAST(Kind) {} - ModuleQualifierAST* moduleQualifier = nullptr; - SourceLocation identifierLoc; - SourceLocation dotLoc; - const Identifier* identifier = nullptr; + SourceLocation scopeLoc; + SourceLocation newLoc; + NewPlacementAST* newPlacement = nullptr; + SourceLocation lparenLoc; + List* typeSpecifierList = nullptr; + DeclaratorAST* declarator = nullptr; + SourceLocation rparenLoc; + NewInitializerAST* newInitalizer = nullptr; + const Type* objectType = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2410,14 +2424,17 @@ class ModuleQualifierAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ModulePartitionAST final : public AST { +class DeleteExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ModulePartition; + static constexpr ASTKind Kind = ASTKind::DeleteExpression; - ModulePartitionAST() : AST(Kind) {} + DeleteExpressionAST() : ExpressionAST(Kind) {} - SourceLocation colonLoc; - ModuleNameAST* moduleName = nullptr; + SourceLocation scopeLoc; + SourceLocation deleteLoc; + SourceLocation lbracketLoc; + SourceLocation rbracketLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2425,15 +2442,16 @@ class ModulePartitionAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ImportNameAST final : public AST { +class CastExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ImportName; + static constexpr ASTKind Kind = ASTKind::CastExpression; - ImportNameAST() : AST(Kind) {} + CastExpressionAST() : ExpressionAST(Kind) {} - SourceLocation headerLoc; - ModulePartitionAST* modulePartition = nullptr; - ModuleNameAST* moduleName = nullptr; + SourceLocation lparenLoc; + TypeIdAST* typeId = nullptr; + SourceLocation rparenLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2441,16 +2459,14 @@ class ImportNameAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class InitDeclaratorAST final : public AST { +class ImplicitCastExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::InitDeclarator; + static constexpr ASTKind Kind = ASTKind::ImplicitCastExpression; - InitDeclaratorAST() : AST(Kind) {} + ImplicitCastExpressionAST() : ExpressionAST(Kind) {} - DeclaratorAST* declarator = nullptr; - RequiresClauseAST* requiresClause = nullptr; - ExpressionAST* initializer = nullptr; - Symbol* symbol = nullptr; + ExpressionAST* expression = nullptr; + ImplicitCastKind castKind = ImplicitCastKind::kIdentity; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2458,15 +2474,16 @@ class InitDeclaratorAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class DeclaratorAST final : public AST { +class BinaryExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::Declarator; + static constexpr ASTKind Kind = ASTKind::BinaryExpression; - DeclaratorAST() : AST(Kind) {} + BinaryExpressionAST() : ExpressionAST(Kind) {} - List* ptrOpList = nullptr; - CoreDeclaratorAST* coreDeclarator = nullptr; - List* declaratorChunkList = nullptr; + ExpressionAST* leftExpression = nullptr; + SourceLocation opLoc; + ExpressionAST* rightExpression = nullptr; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2474,18 +2491,17 @@ class DeclaratorAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class UsingDeclaratorAST final : public AST { +class ConditionalExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::UsingDeclarator; + static constexpr ASTKind Kind = ASTKind::ConditionalExpression; - UsingDeclaratorAST() : AST(Kind) {} + ConditionalExpressionAST() : ExpressionAST(Kind) {} - SourceLocation typenameLoc; - NestedNameSpecifierAST* nestedNameSpecifier = nullptr; - UnqualifiedIdAST* unqualifiedId = nullptr; - SourceLocation ellipsisLoc; - UsingDeclarationSymbol* symbol = nullptr; - bool isPack = false; + ExpressionAST* condition = nullptr; + SourceLocation questionLoc; + ExpressionAST* iftrueExpression = nullptr; + SourceLocation colonLoc; + ExpressionAST* iffalseExpression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2493,18 +2509,14 @@ class UsingDeclaratorAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class EnumeratorAST final : public AST { +class YieldExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::Enumerator; + static constexpr ASTKind Kind = ASTKind::YieldExpression; - EnumeratorAST() : AST(Kind) {} + YieldExpressionAST() : ExpressionAST(Kind) {} - SourceLocation identifierLoc; - List* attributeList = nullptr; - SourceLocation equalLoc; + SourceLocation yieldLoc; ExpressionAST* expression = nullptr; - const Identifier* identifier = nullptr; - EnumeratorSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2512,15 +2524,14 @@ class EnumeratorAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeIdAST final : public AST { +class ThrowExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeId; + static constexpr ASTKind Kind = ASTKind::ThrowExpression; - TypeIdAST() : AST(Kind) {} + ThrowExpressionAST() : ExpressionAST(Kind) {} - List* typeSpecifierList = nullptr; - DeclaratorAST* declarator = nullptr; - const Type* type = nullptr; + SourceLocation throwLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2528,17 +2539,16 @@ class TypeIdAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class HandlerAST final : public AST { +class AssignmentExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::Handler; + static constexpr ASTKind Kind = ASTKind::AssignmentExpression; - HandlerAST() : AST(Kind) {} + AssignmentExpressionAST() : ExpressionAST(Kind) {} - SourceLocation catchLoc; - SourceLocation lparenLoc; - ExceptionDeclarationAST* exceptionDeclaration = nullptr; - SourceLocation rparenLoc; - CompoundStatementAST* statement = nullptr; + ExpressionAST* leftExpression = nullptr; + SourceLocation opLoc; + ExpressionAST* rightExpression = nullptr; + TokenKind op = TokenKind::T_EOF_SYMBOL; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2546,24 +2556,14 @@ class HandlerAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class BaseSpecifierAST final : public AST { +class PackExpansionExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::BaseSpecifier; + static constexpr ASTKind Kind = ASTKind::PackExpansionExpression; - BaseSpecifierAST() : AST(Kind) {} + PackExpansionExpressionAST() : ExpressionAST(Kind) {} - List* attributeList = nullptr; - SourceLocation virtualOrAccessLoc; - SourceLocation otherVirtualOrAccessLoc; - NestedNameSpecifierAST* nestedNameSpecifier = nullptr; - SourceLocation templateLoc; - UnqualifiedIdAST* unqualifiedId = nullptr; + ExpressionAST* expression = nullptr; SourceLocation ellipsisLoc; - bool isTemplateIntroduced = false; - bool isVirtual = false; - bool isVariadic = false; - TokenKind accessSpecifier = TokenKind::T_EOF_SYMBOL; - BaseClassSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2571,14 +2571,14 @@ class BaseSpecifierAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class RequiresClauseAST final : public AST { +class DesignatedInitializerClauseAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::RequiresClause; + static constexpr ASTKind Kind = ASTKind::DesignatedInitializerClause; - RequiresClauseAST() : AST(Kind) {} + DesignatedInitializerClauseAST() : ExpressionAST(Kind) {} - SourceLocation requiresLoc; - ExpressionAST* expression = nullptr; + List* designatorList = nullptr; + ExpressionAST* initializer = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2586,17 +2586,17 @@ class RequiresClauseAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class ParameterDeclarationClauseAST final : public AST { +class TypeTraitExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::ParameterDeclarationClause; + static constexpr ASTKind Kind = ASTKind::TypeTraitExpression; - ParameterDeclarationClauseAST() : AST(Kind) {} + TypeTraitExpressionAST() : ExpressionAST(Kind) {} - List* parameterDeclarationList = nullptr; - SourceLocation commaLoc; - SourceLocation ellipsisLoc; - FunctionParametersSymbol* functionParametersSymbol = nullptr; - bool isVariadic = false; + SourceLocation typeTraitLoc; + SourceLocation lparenLoc; + List* typeIdList = nullptr; + SourceLocation rparenLoc; + BuiltinTypeTraitKind typeTrait = BuiltinTypeTraitKind::T_NONE; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2604,14 +2604,17 @@ class ParameterDeclarationClauseAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class TrailingReturnTypeAST final : public AST { +class ConditionExpressionAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TrailingReturnType; + static constexpr ASTKind Kind = ASTKind::ConditionExpression; - TrailingReturnTypeAST() : AST(Kind) {} + ConditionExpressionAST() : ExpressionAST(Kind) {} - SourceLocation minusGreaterLoc; - TypeIdAST* typeId = nullptr; + List* attributeList = nullptr; + List* declSpecifierList = nullptr; + DeclaratorAST* declarator = nullptr; + ExpressionAST* initializer = nullptr; + VariableSymbol* symbol = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2619,14 +2622,14 @@ class TrailingReturnTypeAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class LambdaSpecifierAST final : public AST { +class EqualInitializerAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::LambdaSpecifier; + static constexpr ASTKind Kind = ASTKind::EqualInitializer; - LambdaSpecifierAST() : AST(Kind) {} + EqualInitializerAST() : ExpressionAST(Kind) {} - SourceLocation specifierLoc; - TokenKind specifier = TokenKind::T_EOF_SYMBOL; + SourceLocation equalLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2634,18 +2637,16 @@ class LambdaSpecifierAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class TypeConstraintAST final : public AST { +class BracedInitListAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::TypeConstraint; + static constexpr ASTKind Kind = ASTKind::BracedInitList; - TypeConstraintAST() : AST(Kind) {} + BracedInitListAST() : ExpressionAST(Kind) {} - NestedNameSpecifierAST* nestedNameSpecifier = nullptr; - SourceLocation identifierLoc; - SourceLocation lessLoc; - List* templateArgumentList = nullptr; - SourceLocation greaterLoc; - const Identifier* identifier = nullptr; + SourceLocation lbraceLoc; + List* expressionList = nullptr; + SourceLocation commaLoc; + SourceLocation rbraceLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2653,13 +2654,14 @@ class TypeConstraintAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class AttributeArgumentClauseAST final : public AST { +class ParenInitializerAST final : public ExpressionAST { public: - static constexpr ASTKind Kind = ASTKind::AttributeArgumentClause; + static constexpr ASTKind Kind = ASTKind::ParenInitializer; - AttributeArgumentClauseAST() : AST(Kind) {} + ParenInitializerAST() : ExpressionAST(Kind) {} SourceLocation lparenLoc; + List* expressionList = nullptr; SourceLocation rparenLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2668,15 +2670,15 @@ class AttributeArgumentClauseAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class AttributeAST final : public AST { +class DefaultGenericAssociationAST final : public GenericAssociationAST { public: - static constexpr ASTKind Kind = ASTKind::Attribute; + static constexpr ASTKind Kind = ASTKind::DefaultGenericAssociation; - AttributeAST() : AST(Kind) {} + DefaultGenericAssociationAST() : GenericAssociationAST(Kind) {} - AttributeTokenAST* attributeToken = nullptr; - AttributeArgumentClauseAST* attributeArgumentClause = nullptr; - SourceLocation ellipsisLoc; + SourceLocation defaultLoc; + SourceLocation colonLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2684,15 +2686,15 @@ class AttributeAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class AttributeUsingPrefixAST final : public AST { +class TypeGenericAssociationAST final : public GenericAssociationAST { public: - static constexpr ASTKind Kind = ASTKind::AttributeUsingPrefix; + static constexpr ASTKind Kind = ASTKind::TypeGenericAssociation; - AttributeUsingPrefixAST() : AST(Kind) {} + TypeGenericAssociationAST() : GenericAssociationAST(Kind) {} - SourceLocation usingLoc; - SourceLocation attributeNamespaceLoc; + TypeIdAST* typeId = nullptr; SourceLocation colonLoc; + ExpressionAST* expression = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2700,15 +2702,15 @@ class AttributeUsingPrefixAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class NewPlacementAST final : public AST { +class DotDesignatorAST final : public DesignatorAST { public: - static constexpr ASTKind Kind = ASTKind::NewPlacement; + static constexpr ASTKind Kind = ASTKind::DotDesignator; - NewPlacementAST() : AST(Kind) {} + DotDesignatorAST() : DesignatorAST(Kind) {} - SourceLocation lparenLoc; - List* expressionList = nullptr; - SourceLocation rparenLoc; + SourceLocation dotLoc; + SourceLocation identifierLoc; + const Identifier* identifier = nullptr; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -2716,17 +2718,15 @@ class NewPlacementAST final : public AST { auto lastSourceLocation() -> SourceLocation override; }; -class NestedNamespaceSpecifierAST final : public AST { +class SubscriptDesignatorAST final : public DesignatorAST { public: - static constexpr ASTKind Kind = ASTKind::NestedNamespaceSpecifier; + static constexpr ASTKind Kind = ASTKind::SubscriptDesignator; - NestedNamespaceSpecifierAST() : AST(Kind) {} + SubscriptDesignatorAST() : DesignatorAST(Kind) {} - SourceLocation inlineLoc; - SourceLocation identifierLoc; - SourceLocation scopeLoc; - const Identifier* identifier = nullptr; - bool isInline = false; + SourceLocation lbracketLoc; + ExpressionAST* expression = nullptr; + SourceLocation rbracketLoc; void accept(ASTVisitor* visitor) override { visitor->visit(this); } @@ -4413,18 +4413,6 @@ auto visit(Visitor&& visitor, DeclarationAST* ast) { case StructuredBindingDeclarationAST::Kind: return std::invoke(std::forward(visitor), static_cast(ast)); - case AsmOperandAST::Kind: - return std::invoke(std::forward(visitor), - static_cast(ast)); - case AsmQualifierAST::Kind: - return std::invoke(std::forward(visitor), - static_cast(ast)); - case AsmClobberAST::Kind: - return std::invoke(std::forward(visitor), - static_cast(ast)); - case AsmGotoLabelAST::Kind: - return std::invoke(std::forward(visitor), - static_cast(ast)); default: cxx_runtime_error("unexpected Declaration"); } // switch @@ -4460,10 +4448,6 @@ template <> case AccessDeclarationAST::Kind: case ForRangeDeclarationAST::Kind: case StructuredBindingDeclarationAST::Kind: - case AsmOperandAST::Kind: - case AsmQualifierAST::Kind: - case AsmClobberAST::Kind: - case AsmGotoLabelAST::Kind: return static_cast(ast); default: return nullptr; diff --git a/src/parser/cxx/ast_fwd.h b/src/parser/cxx/ast_fwd.h index e0859e40..a5ca7644 100644 --- a/src/parser/cxx/ast_fwd.h +++ b/src/parser/cxx/ast_fwd.h @@ -110,10 +110,37 @@ class ParameterDeclarationAST; class AccessDeclarationAST; class ForRangeDeclarationAST; class StructuredBindingDeclarationAST; + +// AST class AsmOperandAST; class AsmQualifierAST; class AsmClobberAST; class AsmGotoLabelAST; +class SplicerAST; +class GlobalModuleFragmentAST; +class PrivateModuleFragmentAST; +class ModuleDeclarationAST; +class ModuleNameAST; +class ModuleQualifierAST; +class ModulePartitionAST; +class ImportNameAST; +class InitDeclaratorAST; +class DeclaratorAST; +class UsingDeclaratorAST; +class EnumeratorAST; +class TypeIdAST; +class HandlerAST; +class BaseSpecifierAST; +class RequiresClauseAST; +class ParameterDeclarationClauseAST; +class TrailingReturnTypeAST; +class LambdaSpecifierAST; +class TypeConstraintAST; +class AttributeArgumentClauseAST; +class AttributeAST; +class AttributeUsingPrefixAST; +class NewPlacementAST; +class NestedNamespaceSpecifierAST; // StatementAST class LabeledStatementAST; @@ -208,33 +235,6 @@ class TypeGenericAssociationAST; class DotDesignatorAST; class SubscriptDesignatorAST; -// AST -class SplicerAST; -class GlobalModuleFragmentAST; -class PrivateModuleFragmentAST; -class ModuleDeclarationAST; -class ModuleNameAST; -class ModuleQualifierAST; -class ModulePartitionAST; -class ImportNameAST; -class InitDeclaratorAST; -class DeclaratorAST; -class UsingDeclaratorAST; -class EnumeratorAST; -class TypeIdAST; -class HandlerAST; -class BaseSpecifierAST; -class RequiresClauseAST; -class ParameterDeclarationClauseAST; -class TrailingReturnTypeAST; -class LambdaSpecifierAST; -class TypeConstraintAST; -class AttributeArgumentClauseAST; -class AttributeAST; -class AttributeUsingPrefixAST; -class NewPlacementAST; -class NestedNamespaceSpecifierAST; - // TemplateParameterAST class TemplateTypeParameterAST; class NonTypeTemplateParameterAST; diff --git a/src/parser/cxx/ast_interpreter.cc b/src/parser/cxx/ast_interpreter.cc index 002dfcbb..0676dae1 100644 --- a/src/parser/cxx/ast_interpreter.cc +++ b/src/parser/cxx/ast_interpreter.cc @@ -251,14 +251,6 @@ struct ASTInterpreter::DeclarationVisitor { [[nodiscard]] auto operator()(StructuredBindingDeclarationAST* ast) -> DeclarationResult; - - [[nodiscard]] auto operator()(AsmOperandAST* ast) -> DeclarationResult; - - [[nodiscard]] auto operator()(AsmQualifierAST* ast) -> DeclarationResult; - - [[nodiscard]] auto operator()(AsmClobberAST* ast) -> DeclarationResult; - - [[nodiscard]] auto operator()(AsmGotoLabelAST* ast) -> DeclarationResult; }; struct ASTInterpreter::StatementVisitor { @@ -1514,6 +1506,24 @@ auto ASTInterpreter::operator()(NestedNamespaceSpecifierAST* ast) return {}; } +auto ASTInterpreter::operator()(AsmOperandAST* ast) -> DeclarationResult { + auto expressionResult = operator()(ast->expression); + + return {}; +} + +auto ASTInterpreter::operator()(AsmQualifierAST* ast) -> DeclarationResult { + return {}; +} + +auto ASTInterpreter::operator()(AsmClobberAST* ast) -> DeclarationResult { + return {}; +} + +auto ASTInterpreter::operator()(AsmGotoLabelAST* ast) -> DeclarationResult { + return {}; +} + auto ASTInterpreter::UnitVisitor::operator()(TranslationUnitAST* ast) -> UnitResult { for (auto node : ListView{ast->declarationList}) { @@ -1827,28 +1837,6 @@ auto ASTInterpreter::DeclarationVisitor::operator()( return {}; } -auto ASTInterpreter::DeclarationVisitor::operator()(AsmOperandAST* ast) - -> DeclarationResult { - auto expressionResult = accept(ast->expression); - - return {}; -} - -auto ASTInterpreter::DeclarationVisitor::operator()(AsmQualifierAST* ast) - -> DeclarationResult { - return {}; -} - -auto ASTInterpreter::DeclarationVisitor::operator()(AsmClobberAST* ast) - -> DeclarationResult { - return {}; -} - -auto ASTInterpreter::DeclarationVisitor::operator()(AsmGotoLabelAST* ast) - -> DeclarationResult { - return {}; -} - auto ASTInterpreter::StatementVisitor::operator()(LabeledStatementAST* ast) -> StatementResult { return {}; diff --git a/src/parser/cxx/ast_interpreter.h b/src/parser/cxx/ast_interpreter.h index 0e9667c0..7142f2d4 100644 --- a/src/parser/cxx/ast_interpreter.h +++ b/src/parser/cxx/ast_interpreter.h @@ -202,6 +202,10 @@ class ASTInterpreter { [[nodiscard]] auto operator()(NewPlacementAST* ast) -> NewPlacementResult; [[nodiscard]] auto operator()(NestedNamespaceSpecifierAST* ast) -> NestedNamespaceSpecifierResult; + [[nodiscard]] auto operator()(AsmOperandAST* ast) -> DeclarationResult; + [[nodiscard]] auto operator()(AsmQualifierAST* ast) -> DeclarationResult; + [[nodiscard]] auto operator()(AsmClobberAST* ast) -> DeclarationResult; + [[nodiscard]] auto operator()(AsmGotoLabelAST* ast) -> DeclarationResult; private: TranslationUnit* unit_ = nullptr; diff --git a/src/parser/cxx/ast_kind.h b/src/parser/cxx/ast_kind.h index 34d69e3c..ccbfd9f1 100644 --- a/src/parser/cxx/ast_kind.h +++ b/src/parser/cxx/ast_kind.h @@ -55,10 +55,37 @@ enum class ASTKind { AccessDeclaration, ForRangeDeclaration, StructuredBindingDeclaration, + + // AST AsmOperand, AsmQualifier, AsmClobber, AsmGotoLabel, + Splicer, + GlobalModuleFragment, + PrivateModuleFragment, + ModuleDeclaration, + ModuleName, + ModuleQualifier, + ModulePartition, + ImportName, + InitDeclarator, + Declarator, + UsingDeclarator, + Enumerator, + TypeId, + Handler, + BaseSpecifier, + RequiresClause, + ParameterDeclarationClause, + TrailingReturnType, + LambdaSpecifier, + TypeConstraint, + AttributeArgumentClause, + Attribute, + AttributeUsingPrefix, + NewPlacement, + NestedNamespaceSpecifier, // StatementAST LabeledStatement, @@ -153,33 +180,6 @@ enum class ASTKind { DotDesignator, SubscriptDesignator, - // AST - Splicer, - GlobalModuleFragment, - PrivateModuleFragment, - ModuleDeclaration, - ModuleName, - ModuleQualifier, - ModulePartition, - ImportName, - InitDeclarator, - Declarator, - UsingDeclarator, - Enumerator, - TypeId, - Handler, - BaseSpecifier, - RequiresClause, - ParameterDeclarationClause, - TrailingReturnType, - LambdaSpecifier, - TypeConstraint, - AttributeArgumentClause, - Attribute, - AttributeUsingPrefix, - NewPlacement, - NestedNamespaceSpecifier, - // TemplateParameterAST TemplateTypeParameter, NonTypeTemplateParameter, diff --git a/src/parser/cxx/ast_pretty_printer.cc b/src/parser/cxx/ast_pretty_printer.cc index 4f0da283..824c5a9b 100644 --- a/src/parser/cxx/ast_pretty_printer.cc +++ b/src/parser/cxx/ast_pretty_printer.cc @@ -108,14 +108,6 @@ struct ASTPrettyPrinter::DeclarationVisitor { void operator()(ForRangeDeclarationAST* ast); void operator()(StructuredBindingDeclarationAST* ast); - - void operator()(AsmOperandAST* ast); - - void operator()(AsmQualifierAST* ast); - - void operator()(AsmClobberAST* ast); - - void operator()(AsmGotoLabelAST* ast); }; struct ASTPrettyPrinter::StatementVisitor { @@ -889,6 +881,60 @@ void ASTPrettyPrinter::operator()(AttributeTokenAST* ast) { visit(AttributeTokenVisitor{*this}, ast); } +void ASTPrettyPrinter::operator()(AsmOperandAST* ast) { + if (!ast) return; + + if (ast->lbracketLoc) { + nospace(); + writeToken(ast->lbracketLoc); + nospace(); + } + if (ast->symbolicNameLoc) { + writeToken(ast->symbolicNameLoc); + } + if (ast->rbracketLoc) { + nospace(); + writeToken(ast->rbracketLoc); + } + if (ast->constraintLiteralLoc) { + writeToken(ast->constraintLiteralLoc); + } + if (ast->lparenLoc) { + nospace(); + writeToken(ast->lparenLoc); + nospace(); + } + operator()(ast->expression); + if (ast->rparenLoc) { + nospace(); + writeToken(ast->rparenLoc); + } +} + +void ASTPrettyPrinter::operator()(AsmQualifierAST* ast) { + if (!ast) return; + + if (ast->qualifierLoc) { + writeToken(ast->qualifierLoc); + } +} + +void ASTPrettyPrinter::operator()(AsmClobberAST* ast) { + if (!ast) return; + + if (ast->literalLoc) { + writeToken(ast->literalLoc); + } +} + +void ASTPrettyPrinter::operator()(AsmGotoLabelAST* ast) { + if (!ast) return; + + if (ast->identifierLoc) { + writeToken(ast->identifierLoc); + } +} + void ASTPrettyPrinter::operator()(SplicerAST* ast) { if (!ast) return; @@ -1896,52 +1942,6 @@ void ASTPrettyPrinter::DeclarationVisitor::operator()( } } -void ASTPrettyPrinter::DeclarationVisitor::operator()(AsmOperandAST* ast) { - if (ast->lbracketLoc) { - nospace(); - accept.writeToken(ast->lbracketLoc); - nospace(); - } - if (ast->symbolicNameLoc) { - accept.writeToken(ast->symbolicNameLoc); - } - if (ast->rbracketLoc) { - nospace(); - accept.writeToken(ast->rbracketLoc); - } - if (ast->constraintLiteralLoc) { - accept.writeToken(ast->constraintLiteralLoc); - } - if (ast->lparenLoc) { - nospace(); - accept.writeToken(ast->lparenLoc); - nospace(); - } - accept(ast->expression); - if (ast->rparenLoc) { - nospace(); - accept.writeToken(ast->rparenLoc); - } -} - -void ASTPrettyPrinter::DeclarationVisitor::operator()(AsmQualifierAST* ast) { - if (ast->qualifierLoc) { - accept.writeToken(ast->qualifierLoc); - } -} - -void ASTPrettyPrinter::DeclarationVisitor::operator()(AsmClobberAST* ast) { - if (ast->literalLoc) { - accept.writeToken(ast->literalLoc); - } -} - -void ASTPrettyPrinter::DeclarationVisitor::operator()(AsmGotoLabelAST* ast) { - if (ast->identifierLoc) { - accept.writeToken(ast->identifierLoc); - } -} - void ASTPrettyPrinter::StatementVisitor::operator()(LabeledStatementAST* ast) { if (ast->identifierLoc) { accept.writeToken(ast->identifierLoc); diff --git a/src/parser/cxx/ast_pretty_printer.h b/src/parser/cxx/ast_pretty_printer.h index 5ea74caa..ed1eea59 100644 --- a/src/parser/cxx/ast_pretty_printer.h +++ b/src/parser/cxx/ast_pretty_printer.h @@ -70,6 +70,10 @@ class ASTPrettyPrinter { void operator()(AttributeTokenAST* ast); // run on the misc nodes + void operator()(AsmOperandAST* ast); + void operator()(AsmQualifierAST* ast); + void operator()(AsmClobberAST* ast); + void operator()(AsmGotoLabelAST* ast); void operator()(SplicerAST* ast); void operator()(GlobalModuleFragmentAST* ast); void operator()(PrivateModuleFragmentAST* ast); diff --git a/src/parser/cxx/ast_printer.cc b/src/parser/cxx/ast_printer.cc index 952cc210..5c59a9ed 100644 --- a/src/parser/cxx/ast_printer.cc +++ b/src/parser/cxx/ast_printer.cc @@ -578,6 +578,285 @@ void ASTPrinter::visit(AsmGotoLabelAST* ast) { accept(ast->identifier, "identifier"); } +void ASTPrinter::visit(SplicerAST* ast) { + out_ << std::format("{}\n", "splicer"); + accept(ast->expression, "expression"); +} + +void ASTPrinter::visit(GlobalModuleFragmentAST* ast) { + out_ << std::format("{}\n", "global-module-fragment"); + if (ast->declarationList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); + for (auto node : ListView{ast->declarationList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(PrivateModuleFragmentAST* ast) { + out_ << std::format("{}\n", "private-module-fragment"); + if (ast->declarationList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declaration-list"); + for (auto node : ListView{ast->declarationList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(ModuleDeclarationAST* ast) { + out_ << std::format("{}\n", "module-declaration"); + accept(ast->moduleName, "module-name"); + accept(ast->modulePartition, "module-partition"); + if (ast->attributeList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); + for (auto node : ListView{ast->attributeList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(ModuleNameAST* ast) { + out_ << std::format("{}\n", "module-name"); + accept(ast->identifier, "identifier"); + accept(ast->moduleQualifier, "module-qualifier"); +} + +void ASTPrinter::visit(ModuleQualifierAST* ast) { + out_ << std::format("{}\n", "module-qualifier"); + accept(ast->identifier, "identifier"); + accept(ast->moduleQualifier, "module-qualifier"); +} + +void ASTPrinter::visit(ModulePartitionAST* ast) { + out_ << std::format("{}\n", "module-partition"); + accept(ast->moduleName, "module-name"); +} + +void ASTPrinter::visit(ImportNameAST* ast) { + out_ << std::format("{}\n", "import-name"); + accept(ast->modulePartition, "module-partition"); + accept(ast->moduleName, "module-name"); +} + +void ASTPrinter::visit(InitDeclaratorAST* ast) { + out_ << std::format("{}\n", "init-declarator"); + accept(ast->declarator, "declarator"); + accept(ast->requiresClause, "requires-clause"); + accept(ast->initializer, "initializer"); +} + +void ASTPrinter::visit(DeclaratorAST* ast) { + out_ << std::format("{}\n", "declarator"); + if (ast->ptrOpList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "ptr-op-list"); + for (auto node : ListView{ast->ptrOpList}) { + accept(node); + } + --indent_; + } + accept(ast->coreDeclarator, "core-declarator"); + if (ast->declaratorChunkList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "declarator-chunk-list"); + for (auto node : ListView{ast->declaratorChunkList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(UsingDeclaratorAST* ast) { + out_ << std::format("{}\n", "using-declarator"); + if (ast->isPack) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-pack: {}\n", ast->isPack); + --indent_; + } + accept(ast->nestedNameSpecifier, "nested-name-specifier"); + accept(ast->unqualifiedId, "unqualified-id"); +} + +void ASTPrinter::visit(EnumeratorAST* ast) { + out_ << std::format("{}\n", "enumerator"); + accept(ast->identifier, "identifier"); + if (ast->attributeList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); + for (auto node : ListView{ast->attributeList}) { + accept(node); + } + --indent_; + } + accept(ast->expression, "expression"); +} + +void ASTPrinter::visit(TypeIdAST* ast) { + out_ << std::format("{}\n", "type-id"); + if (ast->typeSpecifierList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "type-specifier-list"); + for (auto node : ListView{ast->typeSpecifierList}) { + accept(node); + } + --indent_; + } + accept(ast->declarator, "declarator"); +} + +void ASTPrinter::visit(HandlerAST* ast) { + out_ << std::format("{}\n", "handler"); + accept(ast->exceptionDeclaration, "exception-declaration"); + accept(ast->statement, "statement"); +} + +void ASTPrinter::visit(BaseSpecifierAST* ast) { + out_ << std::format("{}\n", "base-specifier"); + if (ast->isTemplateIntroduced) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-template-introduced: {}\n", + ast->isTemplateIntroduced); + --indent_; + } + if (ast->isVirtual) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-virtual: {}\n", ast->isVirtual); + --indent_; + } + if (ast->isVariadic) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-variadic: {}\n", ast->isVariadic); + --indent_; + } + if (ast->accessSpecifier != TokenKind::T_EOF_SYMBOL) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("access-specifier: {}\n", + Token::spell(ast->accessSpecifier)); + --indent_; + } + if (ast->attributeList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "attribute-list"); + for (auto node : ListView{ast->attributeList}) { + accept(node); + } + --indent_; + } + accept(ast->nestedNameSpecifier, "nested-name-specifier"); + accept(ast->unqualifiedId, "unqualified-id"); +} + +void ASTPrinter::visit(RequiresClauseAST* ast) { + out_ << std::format("{}\n", "requires-clause"); + accept(ast->expression, "expression"); +} + +void ASTPrinter::visit(ParameterDeclarationClauseAST* ast) { + out_ << std::format("{}\n", "parameter-declaration-clause"); + if (ast->isVariadic) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-variadic: {}\n", ast->isVariadic); + --indent_; + } + if (ast->parameterDeclarationList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "parameter-declaration-list"); + for (auto node : ListView{ast->parameterDeclarationList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(TrailingReturnTypeAST* ast) { + out_ << std::format("{}\n", "trailing-return-type"); + accept(ast->typeId, "type-id"); +} + +void ASTPrinter::visit(LambdaSpecifierAST* ast) { + out_ << std::format("{}\n", "lambda-specifier"); + if (ast->specifier != TokenKind::T_EOF_SYMBOL) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); + --indent_; + } +} + +void ASTPrinter::visit(TypeConstraintAST* ast) { + out_ << std::format("{}\n", "type-constraint"); + accept(ast->identifier, "identifier"); + accept(ast->nestedNameSpecifier, "nested-name-specifier"); + if (ast->templateArgumentList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "template-argument-list"); + for (auto node : ListView{ast->templateArgumentList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(AttributeArgumentClauseAST* ast) { + out_ << std::format("{}\n", "attribute-argument-clause"); +} + +void ASTPrinter::visit(AttributeAST* ast) { + out_ << std::format("{}\n", "attribute"); + accept(ast->attributeToken, "attribute-token"); + accept(ast->attributeArgumentClause, "attribute-argument-clause"); +} + +void ASTPrinter::visit(AttributeUsingPrefixAST* ast) { + out_ << std::format("{}\n", "attribute-using-prefix"); +} + +void ASTPrinter::visit(NewPlacementAST* ast) { + out_ << std::format("{}\n", "new-placement"); + if (ast->expressionList) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("{}\n", "expression-list"); + for (auto node : ListView{ast->expressionList}) { + accept(node); + } + --indent_; + } +} + +void ASTPrinter::visit(NestedNamespaceSpecifierAST* ast) { + out_ << std::format("{}\n", "nested-namespace-specifier"); + accept(ast->identifier, "identifier"); + if (ast->isInline) { + ++indent_; + out_ << std::format("{:{}}", "", indent_ * 2); + out_ << std::format("is-inline: {}\n", ast->isInline); + --indent_; + } +} + void ASTPrinter::visit(LabeledStatementAST* ast) { out_ << std::format("{}\n", "labeled-statement"); accept(ast->identifier, "identifier"); @@ -1460,368 +1739,105 @@ void ASTPrinter::visit(ConditionalExpressionAST* ast) { out_ << "conditional-expression"; if (ast->type) { out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - accept(ast->condition, "condition"); - accept(ast->iftrueExpression, "iftrue-expression"); - accept(ast->iffalseExpression, "iffalse-expression"); -} - -void ASTPrinter::visit(YieldExpressionAST* ast) { - out_ << "yield-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(ThrowExpressionAST* ast) { - out_ << "throw-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(AssignmentExpressionAST* ast) { - out_ << "assignment-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->op != TokenKind::T_EOF_SYMBOL) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("op: {}\n", Token::spell(ast->op)); - --indent_; - } - accept(ast->leftExpression, "left-expression"); - accept(ast->rightExpression, "right-expression"); -} - -void ASTPrinter::visit(PackExpansionExpressionAST* ast) { - out_ << "pack-expansion-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(DesignatedInitializerClauseAST* ast) { - out_ << "designated-initializer-clause"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->designatorList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "designator-list"); - for (auto node : ListView{ast->designatorList}) { - accept(node); - } - --indent_; - } - accept(ast->initializer, "initializer"); -} - -void ASTPrinter::visit(TypeTraitExpressionAST* ast) { - out_ << "type-trait-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->typeIdList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "type-id-list"); - for (auto node : ListView{ast->typeIdList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(ConditionExpressionAST* ast) { - out_ << "condition-expression"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->attributeList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "attribute-list"); - for (auto node : ListView{ast->attributeList}) { - accept(node); - } - --indent_; - } - if (ast->declSpecifierList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "decl-specifier-list"); - for (auto node : ListView{ast->declSpecifierList}) { - accept(node); - } - --indent_; - } - accept(ast->declarator, "declarator"); - accept(ast->initializer, "initializer"); -} - -void ASTPrinter::visit(EqualInitializerAST* ast) { - out_ << "equal-initializer"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(BracedInitListAST* ast) { - out_ << "braced-init-list"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->expressionList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "expression-list"); - for (auto node : ListView{ast->expressionList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(ParenInitializerAST* ast) { - out_ << "paren-initializer"; - if (ast->type) { - out_ << std::format(" [{} {}]", to_string(ast->valueCategory), - to_string(ast->type)); - } - out_ << "\n"; - if (ast->expressionList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "expression-list"); - for (auto node : ListView{ast->expressionList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(DefaultGenericAssociationAST* ast) { - out_ << std::format("{}\n", "default-generic-association"); - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(TypeGenericAssociationAST* ast) { - out_ << std::format("{}\n", "type-generic-association"); - accept(ast->typeId, "type-id"); - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(DotDesignatorAST* ast) { - out_ << std::format("{}\n", "dot-designator"); - accept(ast->identifier, "identifier"); -} - -void ASTPrinter::visit(SubscriptDesignatorAST* ast) { - out_ << std::format("{}\n", "subscript-designator"); - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(SplicerAST* ast) { - out_ << std::format("{}\n", "splicer"); - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(GlobalModuleFragmentAST* ast) { - out_ << std::format("{}\n", "global-module-fragment"); - if (ast->declarationList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "declaration-list"); - for (auto node : ListView{ast->declarationList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(PrivateModuleFragmentAST* ast) { - out_ << std::format("{}\n", "private-module-fragment"); - if (ast->declarationList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "declaration-list"); - for (auto node : ListView{ast->declarationList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(ModuleDeclarationAST* ast) { - out_ << std::format("{}\n", "module-declaration"); - accept(ast->moduleName, "module-name"); - accept(ast->modulePartition, "module-partition"); - if (ast->attributeList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "attribute-list"); - for (auto node : ListView{ast->attributeList}) { - accept(node); - } - --indent_; - } -} - -void ASTPrinter::visit(ModuleNameAST* ast) { - out_ << std::format("{}\n", "module-name"); - accept(ast->identifier, "identifier"); - accept(ast->moduleQualifier, "module-qualifier"); -} - -void ASTPrinter::visit(ModuleQualifierAST* ast) { - out_ << std::format("{}\n", "module-qualifier"); - accept(ast->identifier, "identifier"); - accept(ast->moduleQualifier, "module-qualifier"); -} - -void ASTPrinter::visit(ModulePartitionAST* ast) { - out_ << std::format("{}\n", "module-partition"); - accept(ast->moduleName, "module-name"); + to_string(ast->type)); + } + out_ << "\n"; + accept(ast->condition, "condition"); + accept(ast->iftrueExpression, "iftrue-expression"); + accept(ast->iffalseExpression, "iffalse-expression"); } -void ASTPrinter::visit(ImportNameAST* ast) { - out_ << std::format("{}\n", "import-name"); - accept(ast->modulePartition, "module-partition"); - accept(ast->moduleName, "module-name"); +void ASTPrinter::visit(YieldExpressionAST* ast) { + out_ << "yield-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; + accept(ast->expression, "expression"); } -void ASTPrinter::visit(InitDeclaratorAST* ast) { - out_ << std::format("{}\n", "init-declarator"); - accept(ast->declarator, "declarator"); - accept(ast->requiresClause, "requires-clause"); - accept(ast->initializer, "initializer"); +void ASTPrinter::visit(ThrowExpressionAST* ast) { + out_ << "throw-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; + accept(ast->expression, "expression"); } -void ASTPrinter::visit(DeclaratorAST* ast) { - out_ << std::format("{}\n", "declarator"); - if (ast->ptrOpList) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "ptr-op-list"); - for (auto node : ListView{ast->ptrOpList}) { - accept(node); - } - --indent_; +void ASTPrinter::visit(AssignmentExpressionAST* ast) { + out_ << "assignment-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); } - accept(ast->coreDeclarator, "core-declarator"); - if (ast->declaratorChunkList) { + out_ << "\n"; + if (ast->op != TokenKind::T_EOF_SYMBOL) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "declarator-chunk-list"); - for (auto node : ListView{ast->declaratorChunkList}) { - accept(node); - } + out_ << std::format("op: {}\n", Token::spell(ast->op)); --indent_; } + accept(ast->leftExpression, "left-expression"); + accept(ast->rightExpression, "right-expression"); } -void ASTPrinter::visit(UsingDeclaratorAST* ast) { - out_ << std::format("{}\n", "using-declarator"); - if (ast->isPack) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-pack: {}\n", ast->isPack); - --indent_; +void ASTPrinter::visit(PackExpansionExpressionAST* ast) { + out_ << "pack-expansion-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); } - accept(ast->nestedNameSpecifier, "nested-name-specifier"); - accept(ast->unqualifiedId, "unqualified-id"); + out_ << "\n"; + accept(ast->expression, "expression"); } -void ASTPrinter::visit(EnumeratorAST* ast) { - out_ << std::format("{}\n", "enumerator"); - accept(ast->identifier, "identifier"); - if (ast->attributeList) { +void ASTPrinter::visit(DesignatedInitializerClauseAST* ast) { + out_ << "designated-initializer-clause"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; + if (ast->designatorList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "attribute-list"); - for (auto node : ListView{ast->attributeList}) { + out_ << std::format("{}\n", "designator-list"); + for (auto node : ListView{ast->designatorList}) { accept(node); } --indent_; } - accept(ast->expression, "expression"); + accept(ast->initializer, "initializer"); } -void ASTPrinter::visit(TypeIdAST* ast) { - out_ << std::format("{}\n", "type-id"); - if (ast->typeSpecifierList) { +void ASTPrinter::visit(TypeTraitExpressionAST* ast) { + out_ << "type-trait-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; + if (ast->typeIdList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "type-specifier-list"); - for (auto node : ListView{ast->typeSpecifierList}) { + out_ << std::format("{}\n", "type-id-list"); + for (auto node : ListView{ast->typeIdList}) { accept(node); } --indent_; } - accept(ast->declarator, "declarator"); -} - -void ASTPrinter::visit(HandlerAST* ast) { - out_ << std::format("{}\n", "handler"); - accept(ast->exceptionDeclaration, "exception-declaration"); - accept(ast->statement, "statement"); } -void ASTPrinter::visit(BaseSpecifierAST* ast) { - out_ << std::format("{}\n", "base-specifier"); - if (ast->isTemplateIntroduced) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-template-introduced: {}\n", - ast->isTemplateIntroduced); - --indent_; - } - if (ast->isVirtual) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-virtual: {}\n", ast->isVirtual); - --indent_; - } - if (ast->isVariadic) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-variadic: {}\n", ast->isVariadic); - --indent_; - } - if (ast->accessSpecifier != TokenKind::T_EOF_SYMBOL) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("access-specifier: {}\n", - Token::spell(ast->accessSpecifier)); - --indent_; +void ASTPrinter::visit(ConditionExpressionAST* ast) { + out_ << "condition-expression"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); } + out_ << "\n"; if (ast->attributeList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); @@ -1831,80 +1847,54 @@ void ASTPrinter::visit(BaseSpecifierAST* ast) { } --indent_; } - accept(ast->nestedNameSpecifier, "nested-name-specifier"); - accept(ast->unqualifiedId, "unqualified-id"); -} - -void ASTPrinter::visit(RequiresClauseAST* ast) { - out_ << std::format("{}\n", "requires-clause"); - accept(ast->expression, "expression"); -} - -void ASTPrinter::visit(ParameterDeclarationClauseAST* ast) { - out_ << std::format("{}\n", "parameter-declaration-clause"); - if (ast->isVariadic) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-variadic: {}\n", ast->isVariadic); - --indent_; - } - if (ast->parameterDeclarationList) { + if (ast->declSpecifierList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "parameter-declaration-list"); - for (auto node : ListView{ast->parameterDeclarationList}) { + out_ << std::format("{}\n", "decl-specifier-list"); + for (auto node : ListView{ast->declSpecifierList}) { accept(node); } --indent_; } + accept(ast->declarator, "declarator"); + accept(ast->initializer, "initializer"); } -void ASTPrinter::visit(TrailingReturnTypeAST* ast) { - out_ << std::format("{}\n", "trailing-return-type"); - accept(ast->typeId, "type-id"); -} - -void ASTPrinter::visit(LambdaSpecifierAST* ast) { - out_ << std::format("{}\n", "lambda-specifier"); - if (ast->specifier != TokenKind::T_EOF_SYMBOL) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("specifier: {}\n", Token::spell(ast->specifier)); - --indent_; +void ASTPrinter::visit(EqualInitializerAST* ast) { + out_ << "equal-initializer"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); } + out_ << "\n"; + accept(ast->expression, "expression"); } -void ASTPrinter::visit(TypeConstraintAST* ast) { - out_ << std::format("{}\n", "type-constraint"); - accept(ast->identifier, "identifier"); - accept(ast->nestedNameSpecifier, "nested-name-specifier"); - if (ast->templateArgumentList) { +void ASTPrinter::visit(BracedInitListAST* ast) { + out_ << "braced-init-list"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; + if (ast->expressionList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("{}\n", "template-argument-list"); - for (auto node : ListView{ast->templateArgumentList}) { + out_ << std::format("{}\n", "expression-list"); + for (auto node : ListView{ast->expressionList}) { accept(node); } --indent_; } } -void ASTPrinter::visit(AttributeArgumentClauseAST* ast) { - out_ << std::format("{}\n", "attribute-argument-clause"); -} - -void ASTPrinter::visit(AttributeAST* ast) { - out_ << std::format("{}\n", "attribute"); - accept(ast->attributeToken, "attribute-token"); - accept(ast->attributeArgumentClause, "attribute-argument-clause"); -} - -void ASTPrinter::visit(AttributeUsingPrefixAST* ast) { - out_ << std::format("{}\n", "attribute-using-prefix"); -} - -void ASTPrinter::visit(NewPlacementAST* ast) { - out_ << std::format("{}\n", "new-placement"); +void ASTPrinter::visit(ParenInitializerAST* ast) { + out_ << "paren-initializer"; + if (ast->type) { + out_ << std::format(" [{} {}]", to_string(ast->valueCategory), + to_string(ast->type)); + } + out_ << "\n"; if (ast->expressionList) { ++indent_; out_ << std::format("{:{}}", "", indent_ * 2); @@ -1916,15 +1906,25 @@ void ASTPrinter::visit(NewPlacementAST* ast) { } } -void ASTPrinter::visit(NestedNamespaceSpecifierAST* ast) { - out_ << std::format("{}\n", "nested-namespace-specifier"); +void ASTPrinter::visit(DefaultGenericAssociationAST* ast) { + out_ << std::format("{}\n", "default-generic-association"); + accept(ast->expression, "expression"); +} + +void ASTPrinter::visit(TypeGenericAssociationAST* ast) { + out_ << std::format("{}\n", "type-generic-association"); + accept(ast->typeId, "type-id"); + accept(ast->expression, "expression"); +} + +void ASTPrinter::visit(DotDesignatorAST* ast) { + out_ << std::format("{}\n", "dot-designator"); accept(ast->identifier, "identifier"); - if (ast->isInline) { - ++indent_; - out_ << std::format("{:{}}", "", indent_ * 2); - out_ << std::format("is-inline: {}\n", ast->isInline); - --indent_; - } +} + +void ASTPrinter::visit(SubscriptDesignatorAST* ast) { + out_ << std::format("{}\n", "subscript-designator"); + accept(ast->expression, "expression"); } void ASTPrinter::visit(TemplateTypeParameterAST* ast) { diff --git a/src/parser/cxx/ast_printer.h b/src/parser/cxx/ast_printer.h index ea9b4c84..4ef31822 100644 --- a/src/parser/cxx/ast_printer.h +++ b/src/parser/cxx/ast_printer.h @@ -71,10 +71,36 @@ class ASTPrinter : ASTVisitor { void visit(AccessDeclarationAST* ast) override; void visit(ForRangeDeclarationAST* ast) override; void visit(StructuredBindingDeclarationAST* ast) override; + void visit(AsmOperandAST* ast) override; void visit(AsmQualifierAST* ast) override; void visit(AsmClobberAST* ast) override; void visit(AsmGotoLabelAST* ast) override; + void visit(SplicerAST* ast) override; + void visit(GlobalModuleFragmentAST* ast) override; + void visit(PrivateModuleFragmentAST* ast) override; + void visit(ModuleDeclarationAST* ast) override; + void visit(ModuleNameAST* ast) override; + void visit(ModuleQualifierAST* ast) override; + void visit(ModulePartitionAST* ast) override; + void visit(ImportNameAST* ast) override; + void visit(InitDeclaratorAST* ast) override; + void visit(DeclaratorAST* ast) override; + void visit(UsingDeclaratorAST* ast) override; + void visit(EnumeratorAST* ast) override; + void visit(TypeIdAST* ast) override; + void visit(HandlerAST* ast) override; + void visit(BaseSpecifierAST* ast) override; + void visit(RequiresClauseAST* ast) override; + void visit(ParameterDeclarationClauseAST* ast) override; + void visit(TrailingReturnTypeAST* ast) override; + void visit(LambdaSpecifierAST* ast) override; + void visit(TypeConstraintAST* ast) override; + void visit(AttributeArgumentClauseAST* ast) override; + void visit(AttributeAST* ast) override; + void visit(AttributeUsingPrefixAST* ast) override; + void visit(NewPlacementAST* ast) override; + void visit(NestedNamespaceSpecifierAST* ast) override; void visit(LabeledStatementAST* ast) override; void visit(CaseStatementAST* ast) override; @@ -165,32 +191,6 @@ class ASTPrinter : ASTVisitor { void visit(DotDesignatorAST* ast) override; void visit(SubscriptDesignatorAST* ast) override; - void visit(SplicerAST* ast) override; - void visit(GlobalModuleFragmentAST* ast) override; - void visit(PrivateModuleFragmentAST* ast) override; - void visit(ModuleDeclarationAST* ast) override; - void visit(ModuleNameAST* ast) override; - void visit(ModuleQualifierAST* ast) override; - void visit(ModulePartitionAST* ast) override; - void visit(ImportNameAST* ast) override; - void visit(InitDeclaratorAST* ast) override; - void visit(DeclaratorAST* ast) override; - void visit(UsingDeclaratorAST* ast) override; - void visit(EnumeratorAST* ast) override; - void visit(TypeIdAST* ast) override; - void visit(HandlerAST* ast) override; - void visit(BaseSpecifierAST* ast) override; - void visit(RequiresClauseAST* ast) override; - void visit(ParameterDeclarationClauseAST* ast) override; - void visit(TrailingReturnTypeAST* ast) override; - void visit(LambdaSpecifierAST* ast) override; - void visit(TypeConstraintAST* ast) override; - void visit(AttributeArgumentClauseAST* ast) override; - void visit(AttributeAST* ast) override; - void visit(AttributeUsingPrefixAST* ast) override; - void visit(NewPlacementAST* ast) override; - void visit(NestedNamespaceSpecifierAST* ast) override; - void visit(TemplateTypeParameterAST* ast) override; void visit(NonTypeTemplateParameterAST* ast) override; void visit(TypenameTypeParameterAST* ast) override; diff --git a/src/parser/cxx/ast_rewriter.cc b/src/parser/cxx/ast_rewriter.cc index e3a90279..bf4bbfc3 100644 --- a/src/parser/cxx/ast_rewriter.cc +++ b/src/parser/cxx/ast_rewriter.cc @@ -168,14 +168,6 @@ struct ASTRewriter::DeclarationVisitor { [[nodiscard]] auto operator()(StructuredBindingDeclarationAST* ast) -> DeclarationAST*; - - [[nodiscard]] auto operator()(AsmOperandAST* ast) -> DeclarationAST*; - - [[nodiscard]] auto operator()(AsmQualifierAST* ast) -> DeclarationAST*; - - [[nodiscard]] auto operator()(AsmClobberAST* ast) -> DeclarationAST*; - - [[nodiscard]] auto operator()(AsmGotoLabelAST* ast) -> DeclarationAST*; }; struct ASTRewriter::StatementVisitor { @@ -1416,6 +1408,49 @@ auto ASTRewriter::operator()(NestedNamespaceSpecifierAST* ast) return copy; } +auto ASTRewriter::operator()(AsmOperandAST* ast) -> AsmOperandAST* { + auto copy = make_node(arena()); + + copy->lbracketLoc = ast->lbracketLoc; + copy->symbolicNameLoc = ast->symbolicNameLoc; + copy->rbracketLoc = ast->rbracketLoc; + copy->constraintLiteralLoc = ast->constraintLiteralLoc; + copy->lparenLoc = ast->lparenLoc; + copy->expression = operator()(ast->expression); + copy->rparenLoc = ast->rparenLoc; + copy->symbolicName = ast->symbolicName; + copy->constraintLiteral = ast->constraintLiteral; + + return copy; +} + +auto ASTRewriter::operator()(AsmQualifierAST* ast) -> AsmQualifierAST* { + auto copy = make_node(arena()); + + copy->qualifierLoc = ast->qualifierLoc; + copy->qualifier = ast->qualifier; + + return copy; +} + +auto ASTRewriter::operator()(AsmClobberAST* ast) -> AsmClobberAST* { + auto copy = make_node(arena()); + + copy->literalLoc = ast->literalLoc; + copy->literal = ast->literal; + + return copy; +} + +auto ASTRewriter::operator()(AsmGotoLabelAST* ast) -> AsmGotoLabelAST* { + auto copy = make_node(arena()); + + copy->identifierLoc = ast->identifierLoc; + copy->identifier = ast->identifier; + + return copy; +} + auto ASTRewriter::UnitVisitor::operator()(TranslationUnitAST* ast) -> UnitAST* { auto copy = make_node(arena()); @@ -2017,53 +2052,6 @@ auto ASTRewriter::DeclarationVisitor::operator()( return copy; } -auto ASTRewriter::DeclarationVisitor::operator()(AsmOperandAST* ast) - -> DeclarationAST* { - auto copy = make_node(arena()); - - copy->lbracketLoc = ast->lbracketLoc; - copy->symbolicNameLoc = ast->symbolicNameLoc; - copy->rbracketLoc = ast->rbracketLoc; - copy->constraintLiteralLoc = ast->constraintLiteralLoc; - copy->lparenLoc = ast->lparenLoc; - copy->expression = rewrite(ast->expression); - copy->rparenLoc = ast->rparenLoc; - copy->symbolicName = ast->symbolicName; - copy->constraintLiteral = ast->constraintLiteral; - - return copy; -} - -auto ASTRewriter::DeclarationVisitor::operator()(AsmQualifierAST* ast) - -> DeclarationAST* { - auto copy = make_node(arena()); - - copy->qualifierLoc = ast->qualifierLoc; - copy->qualifier = ast->qualifier; - - return copy; -} - -auto ASTRewriter::DeclarationVisitor::operator()(AsmClobberAST* ast) - -> DeclarationAST* { - auto copy = make_node(arena()); - - copy->literalLoc = ast->literalLoc; - copy->literal = ast->literal; - - return copy; -} - -auto ASTRewriter::DeclarationVisitor::operator()(AsmGotoLabelAST* ast) - -> DeclarationAST* { - auto copy = make_node(arena()); - - copy->identifierLoc = ast->identifierLoc; - copy->identifier = ast->identifier; - - return copy; -} - auto ASTRewriter::StatementVisitor::operator()(LabeledStatementAST* ast) -> StatementAST* { auto copy = make_node(arena()); diff --git a/src/parser/cxx/ast_rewriter.h b/src/parser/cxx/ast_rewriter.h index 8044f010..1c531b10 100644 --- a/src/parser/cxx/ast_rewriter.h +++ b/src/parser/cxx/ast_rewriter.h @@ -127,6 +127,10 @@ class ASTRewriter { [[nodiscard]] auto operator()(NewPlacementAST* ast) -> NewPlacementAST*; [[nodiscard]] auto operator()(NestedNamespaceSpecifierAST* ast) -> NestedNamespaceSpecifierAST*; + [[nodiscard]] auto operator()(AsmOperandAST* ast) -> AsmOperandAST*; + [[nodiscard]] auto operator()(AsmQualifierAST* ast) -> AsmQualifierAST*; + [[nodiscard]] auto operator()(AsmClobberAST* ast) -> AsmClobberAST*; + [[nodiscard]] auto operator()(AsmGotoLabelAST* ast) -> AsmGotoLabelAST*; private: struct UnitVisitor; diff --git a/src/parser/cxx/ast_slot.cc b/src/parser/cxx/ast_slot.cc index 4785bfe2..19e62e1f 100644 --- a/src/parser/cxx/ast_slot.cc +++ b/src/parser/cxx/ast_slot.cc @@ -1302,1756 +1302,1879 @@ void ASTSlot::visit(AsmGotoLabelAST* ast) { slotCount_ = 2; } -void ASTSlot::visit(LabeledStatementAST* ast) { +void ASTSlot::visit(SplicerAST* ast) { switch (slot_) { - case 0: // identifierLoc - value_ = ast->identifierLoc.index(); + case 0: // lbracketLoc + value_ = ast->lbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{128}; break; case 1: // colonLoc value_ = ast->colonLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{37}; break; - case 2: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; - break; - } // switch - - slotCount_ = 3; -} - -void ASTSlot::visit(CaseStatementAST* ast) { - switch (slot_) { - case 0: // caseLoc - value_ = ast->caseLoc.index(); + case 2: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{29}; + slotNameIndex_ = SlotNameIndex{65}; break; - case 1: // expression + case 3: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - case 2: // colonLoc - value_ = ast->colonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; - break; - } // switch - - slotCount_ = 3; -} - -void ASTSlot::visit(DefaultStatementAST* ast) { - switch (slot_) { - case 0: // defaultLoc - value_ = ast->defaultLoc.index(); + case 4: // secondColonLoc + value_ = ast->secondColonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{60}; + slotNameIndex_ = SlotNameIndex{187}; break; - case 1: // colonLoc - value_ = ast->colonLoc.index(); + case 5: // rbracketLoc + value_ = ast->rbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{173}; break; } // switch - slotCount_ = 2; + slotCount_ = 6; } -void ASTSlot::visit(ExpressionStatementAST* ast) { +void ASTSlot::visit(GlobalModuleFragmentAST* ast) { switch (slot_) { - case 0: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + case 0: // moduleLoc + value_ = ast->moduleLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{140}; break; case 1: // semicolonLoc value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{188}; break; + case 2: // declarationList + value_ = reinterpret_cast(ast->declarationList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{55}; + break; } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(CompoundStatementAST* ast) { +void ASTSlot::visit(PrivateModuleFragmentAST* ast) { switch (slot_) { - case 0: // lbraceLoc - value_ = ast->lbraceLoc.index(); + case 0: // moduleLoc + value_ = ast->moduleLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{126}; + slotNameIndex_ = SlotNameIndex{140}; break; - case 1: // statementList - value_ = reinterpret_cast(ast->statementList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{196}; + case 1: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; - case 2: // rbraceLoc - value_ = ast->rbraceLoc.index(); + case 2: // privateLoc + value_ = ast->privateLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{171}; + slotNameIndex_ = SlotNameIndex{163}; + break; + case 3: // semicolonLoc + value_ = ast->semicolonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{188}; + break; + case 4: // declarationList + value_ = reinterpret_cast(ast->declarationList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{55}; break; } // switch - slotCount_ = 3; + slotCount_ = 5; } -void ASTSlot::visit(IfStatementAST* ast) { +void ASTSlot::visit(ModuleDeclarationAST* ast) { switch (slot_) { - case 0: // ifLoc - value_ = ast->ifLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{103}; - break; - case 1: // constexprLoc - value_ = ast->constexprLoc.index(); + case 0: // exportLoc + value_ = ast->exportLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{44}; + slotNameIndex_ = SlotNameIndex{78}; break; - case 2: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // moduleLoc + value_ = ast->moduleLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{140}; break; - case 3: // initializer - value_ = reinterpret_cast(ast->initializer); + case 2: // moduleName + value_ = reinterpret_cast(ast->moduleName); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + slotNameIndex_ = SlotNameIndex{141}; break; - case 4: // condition - value_ = reinterpret_cast(ast->condition); + case 3: // modulePartition + value_ = reinterpret_cast(ast->modulePartition); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{41}; + slotNameIndex_ = SlotNameIndex{142}; break; - case 5: // rparenLoc - value_ = ast->rparenLoc.index(); + case 4: // attributeList + value_ = reinterpret_cast(ast->attributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{12}; + break; + case 5: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{188}; break; - case 6: // statement - value_ = reinterpret_cast(ast->statement); + } // switch + + slotCount_ = 6; +} + +void ASTSlot::visit(ModuleNameAST* ast) { + switch (slot_) { + case 0: // moduleQualifier + value_ = reinterpret_cast(ast->moduleQualifier); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{143}; break; - case 7: // elseLoc - value_ = ast->elseLoc.index(); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{66}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 8: // elseStatement - value_ = reinterpret_cast(ast->elseStatement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{67}; + case 2: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; } // switch - slotCount_ = 9; + slotCount_ = 3; } -void ASTSlot::visit(ConstevalIfStatementAST* ast) { +void ASTSlot::visit(ModuleQualifierAST* ast) { switch (slot_) { - case 0: // ifLoc - value_ = ast->ifLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{103}; + case 0: // moduleQualifier + value_ = reinterpret_cast(ast->moduleQualifier); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{143}; break; - case 1: // exclaimLoc - value_ = ast->exclaimLoc.index(); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{75}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 2: // constvalLoc - value_ = ast->constvalLoc.index(); + case 2: // dotLoc + value_ = ast->dotLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{48}; + slotNameIndex_ = SlotNameIndex{64}; break; - case 3: // statement - value_ = reinterpret_cast(ast->statement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + case 3: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; - case 4: // elseLoc - value_ = ast->elseLoc.index(); + } // switch + + slotCount_ = 4; +} + +void ASTSlot::visit(ModulePartitionAST* ast) { + switch (slot_) { + case 0: // colonLoc + value_ = ast->colonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{66}; + slotNameIndex_ = SlotNameIndex{37}; break; - case 5: // elseStatement - value_ = reinterpret_cast(ast->elseStatement); + case 1: // moduleName + value_ = reinterpret_cast(ast->moduleName); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{67}; - break; - case 6: // isNot - value_ = std::intptr_t(ast->isNot != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{116}; + slotNameIndex_ = SlotNameIndex{141}; break; } // switch - slotCount_ = 7; + slotCount_ = 2; } -void ASTSlot::visit(SwitchStatementAST* ast) { +void ASTSlot::visit(ImportNameAST* ast) { switch (slot_) { - case 0: // switchLoc - value_ = ast->switchLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{201}; - break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 0: // headerLoc + value_ = ast->headerLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{98}; break; - case 2: // initializer - value_ = reinterpret_cast(ast->initializer); + case 1: // modulePartition + value_ = reinterpret_cast(ast->modulePartition); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + slotNameIndex_ = SlotNameIndex{142}; break; - case 3: // condition - value_ = reinterpret_cast(ast->condition); + case 2: // moduleName + value_ = reinterpret_cast(ast->moduleName); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{41}; + slotNameIndex_ = SlotNameIndex{141}; break; - case 4: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + } // switch + + slotCount_ = 3; +} + +void ASTSlot::visit(InitDeclaratorAST* ast) { + switch (slot_) { + case 0: // declarator + value_ = reinterpret_cast(ast->declarator); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{56}; break; - case 5: // statement - value_ = reinterpret_cast(ast->statement); + case 1: // requiresClause + value_ = reinterpret_cast(ast->requiresClause); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{179}; + break; + case 2: // initializer + value_ = reinterpret_cast(ast->initializer); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{110}; break; } // switch - slotCount_ = 6; + slotCount_ = 3; } -void ASTSlot::visit(WhileStatementAST* ast) { +void ASTSlot::visit(DeclaratorAST* ast) { switch (slot_) { - case 0: // whileLoc - value_ = ast->whileLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{236}; + case 0: // ptrOpList + value_ = reinterpret_cast(ast->ptrOpList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{165}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // coreDeclarator + value_ = reinterpret_cast(ast->coreDeclarator); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{50}; + break; + case 2: // declaratorChunkList + value_ = reinterpret_cast(ast->declaratorChunkList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{57}; + break; + } // switch + + slotCount_ = 3; +} + +void ASTSlot::visit(UsingDeclaratorAST* ast) { + switch (slot_) { + case 0: // typenameLoc + value_ = ast->typenameLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{226}; break; - case 2: // condition - value_ = reinterpret_cast(ast->condition); + case 1: // nestedNameSpecifier + value_ = reinterpret_cast(ast->nestedNameSpecifier); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{41}; + slotNameIndex_ = SlotNameIndex{146}; break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); + case 2: // unqualifiedId + value_ = reinterpret_cast(ast->unqualifiedId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{228}; + break; + case 3: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{65}; break; - case 4: // statement - value_ = reinterpret_cast(ast->statement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + case 4: // isPack + value_ = std::intptr_t(ast->isPack != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{118}; break; } // switch slotCount_ = 5; } -void ASTSlot::visit(DoStatementAST* ast) { +void ASTSlot::visit(EnumeratorAST* ast) { switch (slot_) { - case 0: // doLoc - value_ = ast->doLoc.index(); + case 0: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{63}; - break; - case 1: // statement - value_ = reinterpret_cast(ast->statement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 2: // whileLoc - value_ = ast->whileLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{236}; + case 1: // attributeList + value_ = reinterpret_cast(ast->attributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{12}; break; - case 3: // lparenLoc - value_ = ast->lparenLoc.index(); + case 2: // equalLoc + value_ = ast->equalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{72}; break; - case 4: // expression + case 3: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - case 5: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + case 4: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; - case 6: // semicolonLoc - value_ = ast->semicolonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + } // switch + + slotCount_ = 5; +} + +void ASTSlot::visit(TypeIdAST* ast) { + switch (slot_) { + case 0: // typeSpecifierList + value_ = reinterpret_cast(ast->typeSpecifierList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{222}; + break; + case 1: // declarator + value_ = reinterpret_cast(ast->declarator); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{56}; break; } // switch - slotCount_ = 7; + slotCount_ = 2; } -void ASTSlot::visit(ForRangeStatementAST* ast) { +void ASTSlot::visit(HandlerAST* ast) { switch (slot_) { - case 0: // forLoc - value_ = ast->forLoc.index(); + case 0: // catchLoc + value_ = ast->catchLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{86}; + slotNameIndex_ = SlotNameIndex{31}; break; case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // initializer - value_ = reinterpret_cast(ast->initializer); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; - break; - case 3: // rangeDeclaration - value_ = reinterpret_cast(ast->rangeDeclaration); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{169}; - break; - case 4: // colonLoc - value_ = ast->colonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; - break; - case 5: // rangeInitializer - value_ = reinterpret_cast(ast->rangeInitializer); + case 2: // exceptionDeclaration + value_ = reinterpret_cast(ast->exceptionDeclaration); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{170}; + slotNameIndex_ = SlotNameIndex{73}; break; - case 6: // rparenLoc + case 3: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; - case 7: // statement + case 4: // statement value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{195}; break; } // switch - slotCount_ = 8; + slotCount_ = 5; } -void ASTSlot::visit(ForStatementAST* ast) { +void ASTSlot::visit(BaseSpecifierAST* ast) { switch (slot_) { - case 0: // forLoc - value_ = ast->forLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{86}; + case 0: // attributeList + value_ = reinterpret_cast(ast->attributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{12}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // virtualOrAccessLoc + value_ = ast->virtualOrAccessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{233}; break; - case 2: // initializer - value_ = reinterpret_cast(ast->initializer); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + case 2: // otherVirtualOrAccessLoc + value_ = ast->otherVirtualOrAccessLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{159}; break; - case 3: // condition - value_ = reinterpret_cast(ast->condition); + case 3: // nestedNameSpecifier + value_ = reinterpret_cast(ast->nestedNameSpecifier); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{41}; + slotNameIndex_ = SlotNameIndex{146}; break; - case 4: // semicolonLoc - value_ = ast->semicolonLoc.index(); + case 4: // templateLoc + value_ = ast->templateLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{206}; break; - case 5: // expression - value_ = reinterpret_cast(ast->expression); + case 5: // unqualifiedId + value_ = reinterpret_cast(ast->unqualifiedId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{228}; break; - case 6: // rparenLoc - value_ = ast->rparenLoc.index(); + case 6: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{65}; break; - case 7: // statement - value_ = reinterpret_cast(ast->statement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + case 7: // isTemplateIntroduced + value_ = std::intptr_t(ast->isTemplateIntroduced != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{120}; + break; + case 8: // isVirtual + value_ = std::intptr_t(ast->isVirtual != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{124}; + break; + case 9: // isVariadic + value_ = std::intptr_t(ast->isVariadic != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{123}; + break; + case 10: // accessSpecifier + value_ = std::intptr_t(ast->accessSpecifier); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{2}; break; } // switch - slotCount_ = 8; + slotCount_ = 11; } -void ASTSlot::visit(BreakStatementAST* ast) { +void ASTSlot::visit(RequiresClauseAST* ast) { switch (slot_) { - case 0: // breakLoc - value_ = ast->breakLoc.index(); + case 0: // requiresLoc + value_ = ast->requiresLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{24}; + slotNameIndex_ = SlotNameIndex{180}; break; - case 1: // semicolonLoc - value_ = ast->semicolonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(ContinueStatementAST* ast) { +void ASTSlot::visit(ParameterDeclarationClauseAST* ast) { switch (slot_) { - case 0: // continueLoc - value_ = ast->continueLoc.index(); + case 0: // parameterDeclarationList + value_ = reinterpret_cast(ast->parameterDeclarationList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{162}; + break; + case 1: // commaLoc + value_ = ast->commaLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{49}; + slotNameIndex_ = SlotNameIndex{38}; break; - case 1: // semicolonLoc - value_ = ast->semicolonLoc.index(); + case 2: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{65}; + break; + case 3: // isVariadic + value_ = std::intptr_t(ast->isVariadic != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{123}; break; } // switch - slotCount_ = 2; + slotCount_ = 4; } -void ASTSlot::visit(ReturnStatementAST* ast) { +void ASTSlot::visit(TrailingReturnTypeAST* ast) { switch (slot_) { - case 0: // returnLoc - value_ = ast->returnLoc.index(); + case 0: // minusGreaterLoc + value_ = ast->minusGreaterLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{182}; + slotNameIndex_ = SlotNameIndex{138}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 1: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; - break; - case 2: // semicolonLoc - value_ = ast->semicolonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{217}; break; } // switch - slotCount_ = 3; + slotCount_ = 2; } -void ASTSlot::visit(CoroutineReturnStatementAST* ast) { +void ASTSlot::visit(LambdaSpecifierAST* ast) { switch (slot_) { - case 0: // coreturnLoc - value_ = ast->coreturnLoc.index(); + case 0: // specifierLoc + value_ = ast->specifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{51}; - break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{192}; break; - case 2: // semicolonLoc - value_ = ast->semicolonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + case 1: // specifier + value_ = std::intptr_t(ast->specifier); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{191}; break; } // switch - slotCount_ = 3; + slotCount_ = 2; } -void ASTSlot::visit(GotoStatementAST* ast) { +void ASTSlot::visit(TypeConstraintAST* ast) { switch (slot_) { - case 0: // gotoLoc - value_ = ast->gotoLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{95}; - break; - case 1: // starLoc - value_ = ast->starLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{194}; + case 0: // nestedNameSpecifier + value_ = reinterpret_cast(ast->nestedNameSpecifier); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{146}; break; - case 2: // identifierLoc + case 1: // identifierLoc value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{102}; break; - case 3: // semicolonLoc - value_ = ast->semicolonLoc.index(); + case 2: // lessLoc + value_ = ast->lessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{130}; break; - case 4: // identifier + case 3: // templateArgumentList + value_ = reinterpret_cast(ast->templateArgumentList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{204}; + break; + case 4: // greaterLoc + value_ = ast->greaterLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{96}; + break; + case 5: // identifier value_ = reinterpret_cast(ast->identifier); slotKind_ = ASTSlotKind::kIdentifierAttribute; slotNameIndex_ = SlotNameIndex{101}; break; - case 5: // isIndirect - value_ = std::intptr_t(ast->isIndirect != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{114}; - break; } // switch slotCount_ = 6; } -void ASTSlot::visit(DeclarationStatementAST* ast) { +void ASTSlot::visit(AttributeArgumentClauseAST* ast) { switch (slot_) { - case 0: // declaration - value_ = reinterpret_cast(ast->declaration); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{54}; + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{135}; + break; + case 1: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 1; + slotCount_ = 2; } -void ASTSlot::visit(TryBlockStatementAST* ast) { +void ASTSlot::visit(AttributeAST* ast) { switch (slot_) { - case 0: // tryLoc - value_ = ast->tryLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{215}; + case 0: // attributeToken + value_ = reinterpret_cast(ast->attributeToken); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{16}; break; - case 1: // statement - value_ = reinterpret_cast(ast->statement); + case 1: // attributeArgumentClause + value_ = reinterpret_cast(ast->attributeArgumentClause); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{11}; break; - case 2: // handlerList - value_ = reinterpret_cast(ast->handlerList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{97}; + case 2: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{65}; break; } // switch slotCount_ = 3; } -void ASTSlot::visit(GeneratedLiteralExpressionAST* ast) { +void ASTSlot::visit(AttributeUsingPrefixAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // usingLoc + value_ = ast->usingLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{230}; + break; + case 1: // attributeNamespaceLoc + value_ = ast->attributeNamespaceLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{15}; + break; + case 2: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; } // switch - slotCount_ = 1; + slotCount_ = 3; } -void ASTSlot::visit(CharLiteralExpressionAST* ast) { +void ASTSlot::visit(NewPlacementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // literal - value_ = reinterpret_cast(ast->literal); - slotKind_ = ASTSlotKind::kLiteralAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // expressionList + value_ = reinterpret_cast(ast->expressionList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{80}; + break; + case 2: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(BoolLiteralExpressionAST* ast) { +void ASTSlot::visit(NestedNamespaceSpecifierAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // inlineLoc + value_ = ast->inlineLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{111}; break; - case 1: // isTrue - value_ = std::intptr_t(ast->isTrue != 0); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{102}; + break; + case 2: // scopeLoc + value_ = ast->scopeLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{186}; + break; + case 3: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; + break; + case 4: // isInline + value_ = std::intptr_t(ast->isInline != 0); slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{122}; + slotNameIndex_ = SlotNameIndex{115}; break; } // switch - slotCount_ = 2; + slotCount_ = 5; } -void ASTSlot::visit(IntLiteralExpressionAST* ast) { +void ASTSlot::visit(LabeledStatementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 1: // literal - value_ = reinterpret_cast(ast->literal); - slotKind_ = ASTSlotKind::kLiteralAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; - } // switch + case 2: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; + break; + } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(FloatLiteralExpressionAST* ast) { +void ASTSlot::visit(CaseStatementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // caseLoc + value_ = ast->caseLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{29}; break; - case 1: // literal - value_ = reinterpret_cast(ast->literal); - slotKind_ = ASTSlotKind::kLiteralAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; + break; + case 2: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(NullptrLiteralExpressionAST* ast) { +void ASTSlot::visit(DefaultStatementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // defaultLoc + value_ = ast->defaultLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{60}; break; - case 1: // literal - value_ = std::intptr_t(ast->literal); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(StringLiteralExpressionAST* ast) { +void ASTSlot::visit(ExpressionStatementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + case 0: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; - case 1: // literal - value_ = reinterpret_cast(ast->literal); - slotKind_ = ASTSlotKind::kLiteralAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // semicolonLoc + value_ = ast->semicolonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{188}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(UserDefinedStringLiteralExpressionAST* ast) { +void ASTSlot::visit(CompoundStatementAST* ast) { switch (slot_) { - case 0: // literalLoc - value_ = ast->literalLoc.index(); + case 0: // lbraceLoc + value_ = ast->lbraceLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{132}; + slotNameIndex_ = SlotNameIndex{126}; break; - case 1: // literal - value_ = reinterpret_cast(ast->literal); - slotKind_ = ASTSlotKind::kLiteralAttribute; - slotNameIndex_ = SlotNameIndex{131}; + case 1: // statementList + value_ = reinterpret_cast(ast->statementList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{196}; + break; + case 2: // rbraceLoc + value_ = ast->rbraceLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{171}; break; } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(ObjectLiteralExpressionAST* ast) { +void ASTSlot::visit(IfStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc + case 0: // ifLoc + value_ = ast->ifLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{103}; + break; + case 1: // constexprLoc + value_ = ast->constexprLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{44}; + break; + case 2: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // typeId - value_ = reinterpret_cast(ast->typeId); + case 3: // initializer + value_ = reinterpret_cast(ast->initializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{110}; break; - case 2: // rparenLoc + case 4: // condition + value_ = reinterpret_cast(ast->condition); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{41}; + break; + case 5: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; - case 3: // bracedInitList - value_ = reinterpret_cast(ast->bracedInitList); + case 6: // statement + value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{23}; + slotNameIndex_ = SlotNameIndex{195}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(ThisExpressionAST* ast) { - switch (slot_) { - case 0: // thisLoc - value_ = ast->thisLoc.index(); + case 7: // elseLoc + value_ = ast->elseLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{209}; + slotNameIndex_ = SlotNameIndex{66}; + break; + case 8: // elseStatement + value_ = reinterpret_cast(ast->elseStatement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{67}; break; } // switch - slotCount_ = 1; + slotCount_ = 9; } -void ASTSlot::visit(GenericSelectionExpressionAST* ast) { +void ASTSlot::visit(ConstevalIfStatementAST* ast) { switch (slot_) { - case 0: // genericLoc - value_ = ast->genericLoc.index(); + case 0: // ifLoc + value_ = ast->ifLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{90}; + slotNameIndex_ = SlotNameIndex{103}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // exclaimLoc + value_ = ast->exclaimLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 2: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{75}; break; - case 3: // commaLoc - value_ = ast->commaLoc.index(); + case 2: // constvalLoc + value_ = ast->constvalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{38}; + slotNameIndex_ = SlotNameIndex{48}; break; - case 4: // genericAssociationList - value_ = reinterpret_cast(ast->genericAssociationList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{89}; + case 3: // statement + value_ = reinterpret_cast(ast->statement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{195}; break; - case 5: // rparenLoc - value_ = ast->rparenLoc.index(); + case 4: // elseLoc + value_ = ast->elseLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{66}; break; - case 6: // matchedAssocIndex - value_ = ast->matchedAssocIndex; - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{136}; + case 5: // elseStatement + value_ = reinterpret_cast(ast->elseStatement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{67}; + break; + case 6: // isNot + value_ = std::intptr_t(ast->isNot != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{116}; break; } // switch slotCount_ = 7; } -void ASTSlot::visit(NestedStatementExpressionAST* ast) { +void ASTSlot::visit(SwitchStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc + case 0: // switchLoc + value_ = ast->switchLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{201}; + break; + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // statement - value_ = reinterpret_cast(ast->statement); + case 2: // initializer + value_ = reinterpret_cast(ast->initializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{110}; break; - case 2: // rparenLoc + case 3: // condition + value_ = reinterpret_cast(ast->condition); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{41}; + break; + case 4: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; + case 5: // statement + value_ = reinterpret_cast(ast->statement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{195}; + break; } // switch - slotCount_ = 3; + slotCount_ = 6; } -void ASTSlot::visit(NestedExpressionAST* ast) { +void ASTSlot::visit(WhileStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc + case 0: // whileLoc + value_ = ast->whileLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{236}; + break; + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 2: // condition + value_ = reinterpret_cast(ast->condition); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{41}; break; - case 2: // rparenLoc + case 3: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; + case 4: // statement + value_ = reinterpret_cast(ast->statement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{195}; + break; } // switch - slotCount_ = 3; + slotCount_ = 5; } -void ASTSlot::visit(IdExpressionAST* ast) { +void ASTSlot::visit(DoStatementAST* ast) { switch (slot_) { - case 0: // nestedNameSpecifier - value_ = reinterpret_cast(ast->nestedNameSpecifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{146}; + case 0: // doLoc + value_ = ast->doLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{63}; break; - case 1: // templateLoc - value_ = ast->templateLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{206}; - break; - case 2: // unqualifiedId - value_ = reinterpret_cast(ast->unqualifiedId); + case 1: // statement + value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{228}; - break; - case 3: // isTemplateIntroduced - value_ = std::intptr_t(ast->isTemplateIntroduced != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{120}; + slotNameIndex_ = SlotNameIndex{195}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(LambdaExpressionAST* ast) { - switch (slot_) { - case 0: // lbracketLoc - value_ = ast->lbracketLoc.index(); + case 2: // whileLoc + value_ = ast->whileLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{128}; + slotNameIndex_ = SlotNameIndex{236}; break; - case 1: // captureDefaultLoc - value_ = ast->captureDefaultLoc.index(); + case 3: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{26}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // captureList - value_ = reinterpret_cast(ast->captureList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{27}; + case 4: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; - case 3: // rbracketLoc - value_ = ast->rbracketLoc.index(); + case 5: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{173}; + slotNameIndex_ = SlotNameIndex{185}; break; - case 4: // lessLoc - value_ = ast->lessLoc.index(); + case 6: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{130}; - break; - case 5: // templateParameterList - value_ = reinterpret_cast(ast->templateParameterList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{207}; + slotNameIndex_ = SlotNameIndex{188}; break; - case 6: // greaterLoc - value_ = ast->greaterLoc.index(); + } // switch + + slotCount_ = 7; +} + +void ASTSlot::visit(ForRangeStatementAST* ast) { + switch (slot_) { + case 0: // forLoc + value_ = ast->forLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{96}; - break; - case 7: // templateRequiresClause - value_ = reinterpret_cast(ast->templateRequiresClause); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{208}; + slotNameIndex_ = SlotNameIndex{86}; break; - case 8: // lparenLoc + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 9: // parameterDeclarationClause - value_ = reinterpret_cast(ast->parameterDeclarationClause); + case 2: // initializer + value_ = reinterpret_cast(ast->initializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{161}; - break; - case 10: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; - break; - case 11: // gnuAtributeList - value_ = reinterpret_cast(ast->gnuAtributeList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{92}; - break; - case 12: // lambdaSpecifierList - value_ = reinterpret_cast(ast->lambdaSpecifierList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{125}; + slotNameIndex_ = SlotNameIndex{110}; break; - case 13: // exceptionSpecifier - value_ = reinterpret_cast(ast->exceptionSpecifier); + case 3: // rangeDeclaration + value_ = reinterpret_cast(ast->rangeDeclaration); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{74}; + slotNameIndex_ = SlotNameIndex{169}; break; - case 14: // attributeList - value_ = reinterpret_cast(ast->attributeList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{12}; + case 4: // colonLoc + value_ = ast->colonLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{37}; break; - case 15: // trailingReturnType - value_ = reinterpret_cast(ast->trailingReturnType); + case 5: // rangeInitializer + value_ = reinterpret_cast(ast->rangeInitializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{214}; + slotNameIndex_ = SlotNameIndex{170}; break; - case 16: // requiresClause - value_ = reinterpret_cast(ast->requiresClause); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{179}; + case 6: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; - case 17: // statement + case 7: // statement value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{195}; break; - case 18: // captureDefault - value_ = std::intptr_t(ast->captureDefault); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{25}; - break; } // switch - slotCount_ = 19; + slotCount_ = 8; } -void ASTSlot::visit(FoldExpressionAST* ast) { +void ASTSlot::visit(ForStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc + case 0: // forLoc + value_ = ast->forLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{86}; + break; + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // leftExpression - value_ = reinterpret_cast(ast->leftExpression); + case 2: // initializer + value_ = reinterpret_cast(ast->initializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{129}; - break; - case 2: // opLoc - value_ = ast->opLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; + slotNameIndex_ = SlotNameIndex{110}; break; - case 3: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + case 3: // condition + value_ = reinterpret_cast(ast->condition); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{41}; break; - case 4: // foldOpLoc - value_ = ast->foldOpLoc.index(); + case 4: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{85}; + slotNameIndex_ = SlotNameIndex{188}; break; - case 5: // rightExpression - value_ = reinterpret_cast(ast->rightExpression); + case 5: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{183}; + slotNameIndex_ = SlotNameIndex{79}; break; case 6: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; - case 7: // op - value_ = std::intptr_t(ast->op); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; - break; - case 8: // foldOp - value_ = std::intptr_t(ast->foldOp); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{84}; + case 7: // statement + value_ = reinterpret_cast(ast->statement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{195}; break; } // switch - slotCount_ = 9; + slotCount_ = 8; } -void ASTSlot::visit(RightFoldExpressionAST* ast) { +void ASTSlot::visit(BreakStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc - value_ = ast->lparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; - break; - case 2: // opLoc - value_ = ast->opLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; - break; - case 3: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 0: // breakLoc + value_ = ast->breakLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{24}; break; - case 4: // rparenLoc - value_ = ast->rparenLoc.index(); + case 1: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; - break; - case 5: // op - value_ = std::intptr_t(ast->op); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; + slotNameIndex_ = SlotNameIndex{188}; break; } // switch - slotCount_ = 6; + slotCount_ = 2; } -void ASTSlot::visit(LeftFoldExpressionAST* ast) { +void ASTSlot::visit(ContinueStatementAST* ast) { switch (slot_) { - case 0: // lparenLoc - value_ = ast->lparenLoc.index(); + case 0: // continueLoc + value_ = ast->continueLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{49}; break; - case 1: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 1: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{188}; break; - case 2: // opLoc - value_ = ast->opLoc.index(); + } // switch + + slotCount_ = 2; +} + +void ASTSlot::visit(ReturnStatementAST* ast) { + switch (slot_) { + case 0: // returnLoc + value_ = ast->returnLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; + slotNameIndex_ = SlotNameIndex{182}; break; - case 3: // expression + case 1: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - case 4: // rparenLoc - value_ = ast->rparenLoc.index(); + case 2: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; - break; - case 5: // op - value_ = std::intptr_t(ast->op); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; + slotNameIndex_ = SlotNameIndex{188}; break; } // switch - slotCount_ = 6; + slotCount_ = 3; } -void ASTSlot::visit(RequiresExpressionAST* ast) { +void ASTSlot::visit(CoroutineReturnStatementAST* ast) { switch (slot_) { - case 0: // requiresLoc - value_ = ast->requiresLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{180}; - break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 0: // coreturnLoc + value_ = ast->coreturnLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{51}; break; - case 2: // parameterDeclarationClause - value_ = reinterpret_cast(ast->parameterDeclarationClause); + case 1: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{161}; - break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; - break; - case 4: // lbraceLoc - value_ = ast->lbraceLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{126}; - break; - case 5: // requirementList - value_ = reinterpret_cast(ast->requirementList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{178}; + slotNameIndex_ = SlotNameIndex{79}; break; - case 6: // rbraceLoc - value_ = ast->rbraceLoc.index(); + case 2: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{171}; + slotNameIndex_ = SlotNameIndex{188}; break; } // switch - slotCount_ = 7; + slotCount_ = 3; } -void ASTSlot::visit(VaArgExpressionAST* ast) { +void ASTSlot::visit(GotoStatementAST* ast) { switch (slot_) { - case 0: // vaArgLoc - value_ = ast->vaArgLoc.index(); + case 0: // gotoLoc + value_ = ast->gotoLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{231}; + slotNameIndex_ = SlotNameIndex{95}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // starLoc + value_ = ast->starLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{194}; break; - case 2: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + case 2: // identifierLoc + value_ = ast->identifierLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{102}; break; - case 3: // commaLoc - value_ = ast->commaLoc.index(); + case 3: // semicolonLoc + value_ = ast->semicolonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{38}; + slotNameIndex_ = SlotNameIndex{188}; break; - case 4: // typeId - value_ = reinterpret_cast(ast->typeId); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + case 4: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; - case 5: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + case 5: // isIndirect + value_ = std::intptr_t(ast->isIndirect != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{114}; break; } // switch slotCount_ = 6; } -void ASTSlot::visit(SubscriptExpressionAST* ast) { +void ASTSlot::visit(DeclarationStatementAST* ast) { switch (slot_) { - case 0: // baseExpression - value_ = reinterpret_cast(ast->baseExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{20}; - break; - case 1: // lbracketLoc - value_ = ast->lbracketLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{128}; - break; - case 2: // indexExpression - value_ = reinterpret_cast(ast->indexExpression); + case 0: // declaration + value_ = reinterpret_cast(ast->declaration); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{108}; - break; - case 3: // rbracketLoc - value_ = ast->rbracketLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{173}; + slotNameIndex_ = SlotNameIndex{54}; break; } // switch - slotCount_ = 4; + slotCount_ = 1; } -void ASTSlot::visit(CallExpressionAST* ast) { +void ASTSlot::visit(TryBlockStatementAST* ast) { switch (slot_) { - case 0: // baseExpression - value_ = reinterpret_cast(ast->baseExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{20}; - break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 2: // expressionList - value_ = reinterpret_cast(ast->expressionList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{80}; - break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); + case 0: // tryLoc + value_ = ast->tryLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{215}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(TypeConstructionAST* ast) { - switch (slot_) { - case 0: // typeSpecifier - value_ = reinterpret_cast(ast->typeSpecifier); + case 1: // statement + value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{221}; - break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{195}; break; - case 2: // expressionList - value_ = reinterpret_cast(ast->expressionList); + case 2: // handlerList + value_ = reinterpret_cast(ast->handlerList); slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{80}; + slotNameIndex_ = SlotNameIndex{97}; break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); + } // switch + + slotCount_ = 3; +} + +void ASTSlot::visit(GeneratedLiteralExpressionAST* ast) { + switch (slot_) { + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{132}; break; } // switch - slotCount_ = 4; + slotCount_ = 1; } -void ASTSlot::visit(BracedTypeConstructionAST* ast) { +void ASTSlot::visit(CharLiteralExpressionAST* ast) { switch (slot_) { - case 0: // typeSpecifier - value_ = reinterpret_cast(ast->typeSpecifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{221}; + case 0: // literalLoc + value_ = ast->literalLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{132}; break; - case 1: // bracedInitList - value_ = reinterpret_cast(ast->bracedInitList); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{23}; + case 1: // literal + value_ = reinterpret_cast(ast->literal); + slotKind_ = ASTSlotKind::kLiteralAttribute; + slotNameIndex_ = SlotNameIndex{131}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(SpliceMemberExpressionAST* ast) { +void ASTSlot::visit(BoolLiteralExpressionAST* ast) { switch (slot_) { - case 0: // baseExpression - value_ = reinterpret_cast(ast->baseExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{20}; - break; - case 1: // accessLoc - value_ = ast->accessLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{0}; - break; - case 2: // templateLoc - value_ = ast->templateLoc.index(); + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{206}; - break; - case 3: // splicer - value_ = reinterpret_cast(ast->splicer); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{193}; - break; - case 4: // accessOp - value_ = std::intptr_t(ast->accessOp); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{1}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 5: // isTemplateIntroduced - value_ = std::intptr_t(ast->isTemplateIntroduced != 0); + case 1: // isTrue + value_ = std::intptr_t(ast->isTrue != 0); slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{120}; + slotNameIndex_ = SlotNameIndex{122}; break; } // switch - slotCount_ = 6; + slotCount_ = 2; } -void ASTSlot::visit(MemberExpressionAST* ast) { +void ASTSlot::visit(IntLiteralExpressionAST* ast) { switch (slot_) { - case 0: // baseExpression - value_ = reinterpret_cast(ast->baseExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{20}; - break; - case 1: // accessLoc - value_ = ast->accessLoc.index(); + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{0}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 2: // nestedNameSpecifier - value_ = reinterpret_cast(ast->nestedNameSpecifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{146}; + case 1: // literal + value_ = reinterpret_cast(ast->literal); + slotKind_ = ASTSlotKind::kLiteralAttribute; + slotNameIndex_ = SlotNameIndex{131}; break; - case 3: // templateLoc - value_ = ast->templateLoc.index(); + } // switch + + slotCount_ = 2; +} + +void ASTSlot::visit(FloatLiteralExpressionAST* ast) { + switch (slot_) { + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{206}; - break; - case 4: // unqualifiedId - value_ = reinterpret_cast(ast->unqualifiedId); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{228}; - break; - case 5: // accessOp - value_ = std::intptr_t(ast->accessOp); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{1}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 6: // isTemplateIntroduced - value_ = std::intptr_t(ast->isTemplateIntroduced != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{120}; + case 1: // literal + value_ = reinterpret_cast(ast->literal); + slotKind_ = ASTSlotKind::kLiteralAttribute; + slotNameIndex_ = SlotNameIndex{131}; break; } // switch - slotCount_ = 7; + slotCount_ = 2; } -void ASTSlot::visit(PostIncrExpressionAST* ast) { +void ASTSlot::visit(NullptrLiteralExpressionAST* ast) { switch (slot_) { - case 0: // baseExpression - value_ = reinterpret_cast(ast->baseExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{20}; - break; - case 1: // opLoc - value_ = ast->opLoc.index(); + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 2: // op - value_ = std::intptr_t(ast->op); + case 1: // literal + value_ = std::intptr_t(ast->literal); slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; + slotNameIndex_ = SlotNameIndex{131}; break; } // switch - slotCount_ = 3; + slotCount_ = 2; } -void ASTSlot::visit(CppCastExpressionAST* ast) { +void ASTSlot::visit(StringLiteralExpressionAST* ast) { switch (slot_) { - case 0: // castLoc - value_ = ast->castLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{30}; - break; - case 1: // lessLoc - value_ = ast->lessLoc.index(); + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{130}; - break; - case 2: // typeId - value_ = reinterpret_cast(ast->typeId); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 3: // greaterLoc - value_ = ast->greaterLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{96}; + case 1: // literal + value_ = reinterpret_cast(ast->literal); + slotKind_ = ASTSlotKind::kLiteralAttribute; + slotNameIndex_ = SlotNameIndex{131}; break; - case 4: // lparenLoc - value_ = ast->lparenLoc.index(); + } // switch + + slotCount_ = 2; +} + +void ASTSlot::visit(UserDefinedStringLiteralExpressionAST* ast) { + switch (slot_) { + case 0: // literalLoc + value_ = ast->literalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 5: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{132}; break; - case 6: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + case 1: // literal + value_ = reinterpret_cast(ast->literal); + slotKind_ = ASTSlotKind::kLiteralAttribute; + slotNameIndex_ = SlotNameIndex{131}; break; } // switch - slotCount_ = 7; + slotCount_ = 2; } -void ASTSlot::visit(BuiltinBitCastExpressionAST* ast) { +void ASTSlot::visit(ObjectLiteralExpressionAST* ast) { switch (slot_) { - case 0: // castLoc - value_ = ast->castLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{30}; - break; - case 1: // lparenLoc + case 0: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // typeId + case 1: // typeId value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{217}; break; - case 3: // commaLoc - value_ = ast->commaLoc.index(); + case 2: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{38}; + slotNameIndex_ = SlotNameIndex{185}; break; - case 4: // expression - value_ = reinterpret_cast(ast->expression); + case 3: // bracedInitList + value_ = reinterpret_cast(ast->bracedInitList); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{23}; break; - case 5: // rparenLoc - value_ = ast->rparenLoc.index(); + } // switch + + slotCount_ = 4; +} + +void ASTSlot::visit(ThisExpressionAST* ast) { + switch (slot_) { + case 0: // thisLoc + value_ = ast->thisLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{209}; break; } // switch - slotCount_ = 6; + slotCount_ = 1; } -void ASTSlot::visit(BuiltinOffsetofExpressionAST* ast) { +void ASTSlot::visit(GenericSelectionExpressionAST* ast) { switch (slot_) { - case 0: // offsetofLoc - value_ = ast->offsetofLoc.index(); + case 0: // genericLoc + value_ = ast->genericLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{153}; + slotNameIndex_ = SlotNameIndex{90}; break; case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // typeId - value_ = reinterpret_cast(ast->typeId); + case 2: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{79}; break; case 3: // commaLoc value_ = ast->commaLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{38}; break; - case 4: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + case 4: // genericAssociationList + value_ = reinterpret_cast(ast->genericAssociationList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{89}; break; case 5: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; + case 6: // matchedAssocIndex + value_ = ast->matchedAssocIndex; + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{136}; + break; } // switch - slotCount_ = 6; + slotCount_ = 7; } -void ASTSlot::visit(TypeidExpressionAST* ast) { +void ASTSlot::visit(NestedStatementExpressionAST* ast) { switch (slot_) { - case 0: // typeidLoc - value_ = ast->typeidLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{225}; - break; - case 1: // lparenLoc + case 0: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // expression - value_ = reinterpret_cast(ast->expression); + case 1: // statement + value_ = reinterpret_cast(ast->statement); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{195}; break; - case 3: // rparenLoc + case 2: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 4; + slotCount_ = 3; } -void ASTSlot::visit(TypeidOfTypeExpressionAST* ast) { +void ASTSlot::visit(NestedExpressionAST* ast) { switch (slot_) { - case 0: // typeidLoc - value_ = ast->typeidLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{225}; - break; - case 1: // lparenLoc + case 0: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // typeId - value_ = reinterpret_cast(ast->typeId); + case 1: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{79}; break; - case 3: // rparenLoc + case 2: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 4; + slotCount_ = 3; } -void ASTSlot::visit(SpliceExpressionAST* ast) { +void ASTSlot::visit(IdExpressionAST* ast) { switch (slot_) { - case 0: // splicer - value_ = reinterpret_cast(ast->splicer); + case 0: // nestedNameSpecifier + value_ = reinterpret_cast(ast->nestedNameSpecifier); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{193}; + slotNameIndex_ = SlotNameIndex{146}; + break; + case 1: // templateLoc + value_ = ast->templateLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{206}; + break; + case 2: // unqualifiedId + value_ = reinterpret_cast(ast->unqualifiedId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{228}; + break; + case 3: // isTemplateIntroduced + value_ = std::intptr_t(ast->isTemplateIntroduced != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{120}; break; } // switch - slotCount_ = 1; + slotCount_ = 4; } -void ASTSlot::visit(GlobalScopeReflectExpressionAST* ast) { +void ASTSlot::visit(LambdaExpressionAST* ast) { switch (slot_) { - case 0: // caretLoc - value_ = ast->caretLoc.index(); + case 0: // lbracketLoc + value_ = ast->lbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{28}; + slotNameIndex_ = SlotNameIndex{128}; break; - case 1: // scopeLoc - value_ = ast->scopeLoc.index(); + case 1: // captureDefaultLoc + value_ = ast->captureDefaultLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{186}; + slotNameIndex_ = SlotNameIndex{26}; break; - } // switch - - slotCount_ = 2; -} - -void ASTSlot::visit(NamespaceReflectExpressionAST* ast) { - switch (slot_) { - case 0: // caretLoc - value_ = ast->caretLoc.index(); + case 2: // captureList + value_ = reinterpret_cast(ast->captureList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{27}; + break; + case 3: // rbracketLoc + value_ = ast->rbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{28}; + slotNameIndex_ = SlotNameIndex{173}; break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); + case 4: // lessLoc + value_ = ast->lessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{130}; break; - case 2: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 5: // templateParameterList + value_ = reinterpret_cast(ast->templateParameterList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{207}; break; - } // switch - - slotCount_ = 3; -} - -void ASTSlot::visit(TypeIdReflectExpressionAST* ast) { - switch (slot_) { - case 0: // caretLoc - value_ = ast->caretLoc.index(); + case 6: // greaterLoc + value_ = ast->greaterLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{28}; + slotNameIndex_ = SlotNameIndex{96}; break; - case 1: // typeId - value_ = reinterpret_cast(ast->typeId); + case 7: // templateRequiresClause + value_ = reinterpret_cast(ast->templateRequiresClause); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{208}; break; - } // switch - - slotCount_ = 2; -} - -void ASTSlot::visit(ReflectExpressionAST* ast) { - switch (slot_) { - case 0: // caretLoc - value_ = ast->caretLoc.index(); + case 8: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{28}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 9: // parameterDeclarationClause + value_ = reinterpret_cast(ast->parameterDeclarationClause); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{161}; + break; + case 10: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 11: // gnuAtributeList + value_ = reinterpret_cast(ast->gnuAtributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{92}; + break; + case 12: // lambdaSpecifierList + value_ = reinterpret_cast(ast->lambdaSpecifierList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{125}; + break; + case 13: // exceptionSpecifier + value_ = reinterpret_cast(ast->exceptionSpecifier); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{74}; + break; + case 14: // attributeList + value_ = reinterpret_cast(ast->attributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{12}; + break; + case 15: // trailingReturnType + value_ = reinterpret_cast(ast->trailingReturnType); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{214}; + break; + case 16: // requiresClause + value_ = reinterpret_cast(ast->requiresClause); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{179}; + break; + case 17: // statement + value_ = reinterpret_cast(ast->statement); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{195}; + break; + case 18: // captureDefault + value_ = std::intptr_t(ast->captureDefault); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{25}; break; } // switch - slotCount_ = 2; + slotCount_ = 19; } -void ASTSlot::visit(LabelAddressExpressionAST* ast) { +void ASTSlot::visit(FoldExpressionAST* ast) { switch (slot_) { - case 0: // ampAmpLoc - value_ = ast->ampAmpLoc.index(); + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{5}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); + case 1: // leftExpression + value_ = reinterpret_cast(ast->leftExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{129}; + break; + case 2: // opLoc + value_ = ast->opLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{155}; break; - case 2: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 3: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{65}; + break; + case 4: // foldOpLoc + value_ = ast->foldOpLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{85}; + break; + case 5: // rightExpression + value_ = reinterpret_cast(ast->rightExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{183}; + break; + case 6: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 7: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; + break; + case 8: // foldOp + value_ = std::intptr_t(ast->foldOp); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{84}; break; } // switch - slotCount_ = 3; + slotCount_ = 9; } -void ASTSlot::visit(UnaryExpressionAST* ast) { +void ASTSlot::visit(RightFoldExpressionAST* ast) { switch (slot_) { - case 0: // opLoc - value_ = ast->opLoc.index(); + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; + slotNameIndex_ = SlotNameIndex{135}; break; case 1: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - case 2: // op + case 2: // opLoc + value_ = ast->opLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{155}; + break; + case 3: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{65}; + break; + case 4: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 5: // op value_ = std::intptr_t(ast->op); slotKind_ = ASTSlotKind::kIntAttribute; slotNameIndex_ = SlotNameIndex{154}; break; } // switch - slotCount_ = 3; + slotCount_ = 6; } -void ASTSlot::visit(AwaitExpressionAST* ast) { +void ASTSlot::visit(LeftFoldExpressionAST* ast) { switch (slot_) { - case 0: // awaitLoc - value_ = ast->awaitLoc.index(); + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{19}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // expression + case 1: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{65}; + break; + case 2: // opLoc + value_ = ast->opLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{155}; + break; + case 3: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; + case 4: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 5: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; + break; } // switch - slotCount_ = 2; + slotCount_ = 6; } -void ASTSlot::visit(SizeofExpressionAST* ast) { +void ASTSlot::visit(RequiresExpressionAST* ast) { switch (slot_) { - case 0: // sizeofLoc - value_ = ast->sizeofLoc.index(); + case 0: // requiresLoc + value_ = ast->requiresLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{190}; + slotNameIndex_ = SlotNameIndex{180}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{135}; + break; + case 2: // parameterDeclarationClause + value_ = reinterpret_cast(ast->parameterDeclarationClause); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{161}; + break; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 4: // lbraceLoc + value_ = ast->lbraceLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{126}; + break; + case 5: // requirementList + value_ = reinterpret_cast(ast->requirementList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{178}; + break; + case 6: // rbraceLoc + value_ = ast->rbraceLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{171}; break; } // switch - slotCount_ = 2; + slotCount_ = 7; } -void ASTSlot::visit(SizeofTypeExpressionAST* ast) { +void ASTSlot::visit(VaArgExpressionAST* ast) { switch (slot_) { - case 0: // sizeofLoc - value_ = ast->sizeofLoc.index(); + case 0: // vaArgLoc + value_ = ast->vaArgLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{190}; + slotNameIndex_ = SlotNameIndex{231}; break; case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // typeId + case 2: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; + break; + case 3: // commaLoc + value_ = ast->commaLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{38}; + break; + case 4: // typeId value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{217}; break; - case 3: // rparenLoc + case 5: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 4; + slotCount_ = 6; } -void ASTSlot::visit(SizeofPackExpressionAST* ast) { +void ASTSlot::visit(SubscriptExpressionAST* ast) { switch (slot_) { - case 0: // sizeofLoc - value_ = ast->sizeofLoc.index(); + case 0: // baseExpression + value_ = reinterpret_cast(ast->baseExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{20}; + break; + case 1: // lbracketLoc + value_ = ast->lbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{190}; + slotNameIndex_ = SlotNameIndex{128}; break; - case 1: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 2: // indexExpression + value_ = reinterpret_cast(ast->indexExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{108}; + break; + case 3: // rbracketLoc + value_ = ast->rbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{173}; break; - case 2: // lparenLoc + } // switch + + slotCount_ = 4; +} + +void ASTSlot::visit(CallExpressionAST* ast) { + switch (slot_) { + case 0: // baseExpression + value_ = reinterpret_cast(ast->baseExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{20}; + break; + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 3: // identifierLoc - value_ = ast->identifierLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + case 2: // expressionList + value_ = reinterpret_cast(ast->expressionList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{80}; break; - case 4: // rparenLoc + case 3: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; - case 5: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; - break; } // switch - slotCount_ = 6; + slotCount_ = 4; } -void ASTSlot::visit(AlignofTypeExpressionAST* ast) { +void ASTSlot::visit(TypeConstructionAST* ast) { switch (slot_) { - case 0: // alignofLoc - value_ = ast->alignofLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{4}; + case 0: // typeSpecifier + value_ = reinterpret_cast(ast->typeSpecifier); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{221}; break; case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // typeId - value_ = reinterpret_cast(ast->typeId); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + case 2: // expressionList + value_ = reinterpret_cast(ast->expressionList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{80}; break; case 3: // rparenLoc value_ = ast->rparenLoc.index(); @@ -3063,382 +3186,368 @@ void ASTSlot::visit(AlignofTypeExpressionAST* ast) { slotCount_ = 4; } -void ASTSlot::visit(AlignofExpressionAST* ast) { +void ASTSlot::visit(BracedTypeConstructionAST* ast) { switch (slot_) { - case 0: // alignofLoc - value_ = ast->alignofLoc.index(); + case 0: // typeSpecifier + value_ = reinterpret_cast(ast->typeSpecifier); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{221}; + break; + case 1: // bracedInitList + value_ = reinterpret_cast(ast->bracedInitList); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{23}; + break; + } // switch + + slotCount_ = 2; +} + +void ASTSlot::visit(SpliceMemberExpressionAST* ast) { + switch (slot_) { + case 0: // baseExpression + value_ = reinterpret_cast(ast->baseExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{20}; + break; + case 1: // accessLoc + value_ = ast->accessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{4}; + slotNameIndex_ = SlotNameIndex{0}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 2: // templateLoc + value_ = ast->templateLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{206}; + break; + case 3: // splicer + value_ = reinterpret_cast(ast->splicer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{193}; + break; + case 4: // accessOp + value_ = std::intptr_t(ast->accessOp); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{1}; + break; + case 5: // isTemplateIntroduced + value_ = std::intptr_t(ast->isTemplateIntroduced != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{120}; break; } // switch - slotCount_ = 2; + slotCount_ = 6; } -void ASTSlot::visit(NoexceptExpressionAST* ast) { +void ASTSlot::visit(MemberExpressionAST* ast) { switch (slot_) { - case 0: // noexceptLoc - value_ = ast->noexceptLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{151}; + case 0: // baseExpression + value_ = reinterpret_cast(ast->baseExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{20}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // accessLoc + value_ = ast->accessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; + slotNameIndex_ = SlotNameIndex{0}; break; - case 2: // expression - value_ = reinterpret_cast(ast->expression); + case 2: // nestedNameSpecifier + value_ = reinterpret_cast(ast->nestedNameSpecifier); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{146}; break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); + case 3: // templateLoc + value_ = ast->templateLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{206}; + break; + case 4: // unqualifiedId + value_ = reinterpret_cast(ast->unqualifiedId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{228}; + break; + case 5: // accessOp + value_ = std::intptr_t(ast->accessOp); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{1}; + break; + case 6: // isTemplateIntroduced + value_ = std::intptr_t(ast->isTemplateIntroduced != 0); + slotKind_ = ASTSlotKind::kBoolAttribute; + slotNameIndex_ = SlotNameIndex{120}; break; } // switch - slotCount_ = 4; + slotCount_ = 7; } -void ASTSlot::visit(NewExpressionAST* ast) { +void ASTSlot::visit(PostIncrExpressionAST* ast) { switch (slot_) { - case 0: // scopeLoc - value_ = ast->scopeLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{186}; - break; - case 1: // newLoc - value_ = ast->newLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{149}; - break; - case 2: // newPlacement - value_ = reinterpret_cast(ast->newPlacement); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{150}; - break; - case 3: // lparenLoc - value_ = ast->lparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 4: // typeSpecifierList - value_ = reinterpret_cast(ast->typeSpecifierList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{222}; - break; - case 5: // declarator - value_ = reinterpret_cast(ast->declarator); + case 0: // baseExpression + value_ = reinterpret_cast(ast->baseExpression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{56}; + slotNameIndex_ = SlotNameIndex{20}; break; - case 6: // rparenLoc - value_ = ast->rparenLoc.index(); + case 1: // opLoc + value_ = ast->opLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{155}; break; - case 7: // newInitalizer - value_ = reinterpret_cast(ast->newInitalizer); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{148}; + case 2: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; break; } // switch - slotCount_ = 8; + slotCount_ = 3; } -void ASTSlot::visit(DeleteExpressionAST* ast) { +void ASTSlot::visit(CppCastExpressionAST* ast) { switch (slot_) { - case 0: // scopeLoc - value_ = ast->scopeLoc.index(); + case 0: // castLoc + value_ = ast->castLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{186}; + slotNameIndex_ = SlotNameIndex{30}; break; - case 1: // deleteLoc - value_ = ast->deleteLoc.index(); + case 1: // lessLoc + value_ = ast->lessLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{61}; + slotNameIndex_ = SlotNameIndex{130}; break; - case 2: // lbracketLoc - value_ = ast->lbracketLoc.index(); + case 2: // typeId + value_ = reinterpret_cast(ast->typeId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{217}; + break; + case 3: // greaterLoc + value_ = ast->greaterLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{128}; + slotNameIndex_ = SlotNameIndex{96}; break; - case 3: // rbracketLoc - value_ = ast->rbracketLoc.index(); + case 4: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{173}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 4: // expression + case 5: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; + case 6: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; } // switch - slotCount_ = 5; + slotCount_ = 7; } -void ASTSlot::visit(CastExpressionAST* ast) { +void ASTSlot::visit(BuiltinBitCastExpressionAST* ast) { switch (slot_) { - case 0: // lparenLoc + case 0: // castLoc + value_ = ast->castLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{30}; + break; + case 1: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // typeId + case 2: // typeId value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{217}; break; - case 2: // rparenLoc - value_ = ast->rparenLoc.index(); + case 3: // commaLoc + value_ = ast->commaLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; - break; - case 3: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{38}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(ImplicitCastExpressionAST* ast) { - switch (slot_) { - case 0: // expression + case 4: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - } // switch - - slotCount_ = 1; -} - -void ASTSlot::visit(BinaryExpressionAST* ast) { - switch (slot_) { - case 0: // leftExpression - value_ = reinterpret_cast(ast->leftExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{129}; - break; - case 1: // opLoc - value_ = ast->opLoc.index(); + case 5: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; - break; - case 2: // rightExpression - value_ = reinterpret_cast(ast->rightExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{183}; - break; - case 3: // op - value_ = std::intptr_t(ast->op); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 4; + slotCount_ = 6; } -void ASTSlot::visit(ConditionalExpressionAST* ast) { +void ASTSlot::visit(BuiltinOffsetofExpressionAST* ast) { switch (slot_) { - case 0: // condition - value_ = reinterpret_cast(ast->condition); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{41}; - break; - case 1: // questionLoc - value_ = ast->questionLoc.index(); + case 0: // offsetofLoc + value_ = ast->offsetofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{168}; - break; - case 2: // iftrueExpression - value_ = reinterpret_cast(ast->iftrueExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{105}; + slotNameIndex_ = SlotNameIndex{153}; break; - case 3: // colonLoc - value_ = ast->colonLoc.index(); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 4: // iffalseExpression - value_ = reinterpret_cast(ast->iffalseExpression); + case 2: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{104}; + slotNameIndex_ = SlotNameIndex{217}; break; - } // switch - - slotCount_ = 5; -} - -void ASTSlot::visit(YieldExpressionAST* ast) { - switch (slot_) { - case 0: // yieldLoc - value_ = ast->yieldLoc.index(); + case 3: // commaLoc + value_ = ast->commaLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{237}; + slotNameIndex_ = SlotNameIndex{38}; break; - case 1: // expression + case 4: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; + case 5: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; } // switch - slotCount_ = 2; + slotCount_ = 6; } -void ASTSlot::visit(ThrowExpressionAST* ast) { +void ASTSlot::visit(TypeidExpressionAST* ast) { switch (slot_) { - case 0: // throwLoc - value_ = ast->throwLoc.index(); + case 0: // typeidLoc + value_ = ast->typeidLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{225}; + break; + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{212}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // expression + case 2: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; } // switch - slotCount_ = 2; + slotCount_ = 4; } -void ASTSlot::visit(AssignmentExpressionAST* ast) { +void ASTSlot::visit(TypeidOfTypeExpressionAST* ast) { switch (slot_) { - case 0: // leftExpression - value_ = reinterpret_cast(ast->leftExpression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{129}; + case 0: // typeidLoc + value_ = ast->typeidLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{225}; break; - case 1: // opLoc - value_ = ast->opLoc.index(); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{155}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // rightExpression - value_ = reinterpret_cast(ast->rightExpression); + case 2: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{183}; + slotNameIndex_ = SlotNameIndex{217}; break; - case 3: // op - value_ = std::intptr_t(ast->op); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{154}; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch slotCount_ = 4; } -void ASTSlot::visit(PackExpansionExpressionAST* ast) { +void ASTSlot::visit(SpliceExpressionAST* ast) { switch (slot_) { - case 0: // expression - value_ = reinterpret_cast(ast->expression); + case 0: // splicer + value_ = reinterpret_cast(ast->splicer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; - break; - case 1: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{193}; break; } // switch - slotCount_ = 2; + slotCount_ = 1; } -void ASTSlot::visit(DesignatedInitializerClauseAST* ast) { +void ASTSlot::visit(GlobalScopeReflectExpressionAST* ast) { switch (slot_) { - case 0: // designatorList - value_ = reinterpret_cast(ast->designatorList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{62}; + case 0: // caretLoc + value_ = ast->caretLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{28}; break; - case 1: // initializer - value_ = reinterpret_cast(ast->initializer); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + case 1: // scopeLoc + value_ = ast->scopeLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{186}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(TypeTraitExpressionAST* ast) { +void ASTSlot::visit(NamespaceReflectExpressionAST* ast) { switch (slot_) { - case 0: // typeTraitLoc - value_ = ast->typeTraitLoc.index(); + case 0: // caretLoc + value_ = ast->caretLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{223}; + slotNameIndex_ = SlotNameIndex{28}; break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 2: // typeIdList - value_ = reinterpret_cast(ast->typeIdList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{218}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + case 2: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; } // switch - slotCount_ = 4; + slotCount_ = 3; } -void ASTSlot::visit(ConditionExpressionAST* ast) { +void ASTSlot::visit(TypeIdReflectExpressionAST* ast) { switch (slot_) { - case 0: // attributeList - value_ = reinterpret_cast(ast->attributeList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{12}; - break; - case 1: // declSpecifierList - value_ = reinterpret_cast(ast->declSpecifierList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{53}; - break; - case 2: // declarator - value_ = reinterpret_cast(ast->declarator); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{56}; + case 0: // caretLoc + value_ = ast->caretLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{28}; break; - case 3: // initializer - value_ = reinterpret_cast(ast->initializer); + case 1: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + slotNameIndex_ = SlotNameIndex{217}; break; } // switch - slotCount_ = 4; + slotCount_ = 2; } -void ASTSlot::visit(EqualInitializerAST* ast) { +void ASTSlot::visit(ReflectExpressionAST* ast) { switch (slot_) { - case 0: // equalLoc - value_ = ast->equalLoc.index(); + case 0: // caretLoc + value_ = ast->caretLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{72}; + slotNameIndex_ = SlotNameIndex{28}; break; case 1: // expression value_ = reinterpret_cast(ast->expression); @@ -3450,806 +3559,697 @@ void ASTSlot::visit(EqualInitializerAST* ast) { slotCount_ = 2; } -void ASTSlot::visit(BracedInitListAST* ast) { +void ASTSlot::visit(LabelAddressExpressionAST* ast) { switch (slot_) { - case 0: // lbraceLoc - value_ = ast->lbraceLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{126}; - break; - case 1: // expressionList - value_ = reinterpret_cast(ast->expressionList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{80}; - break; - case 2: // commaLoc - value_ = ast->commaLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{38}; - break; - case 3: // rbraceLoc - value_ = ast->rbraceLoc.index(); + case 0: // ampAmpLoc + value_ = ast->ampAmpLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{171}; + slotNameIndex_ = SlotNameIndex{5}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(ParenInitializerAST* ast) { - switch (slot_) { - case 0: // lparenLoc - value_ = ast->lparenLoc.index(); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 1: // expressionList - value_ = reinterpret_cast(ast->expressionList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{80}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 2: // rparenLoc - value_ = ast->rparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + case 2: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; } // switch slotCount_ = 3; } -void ASTSlot::visit(DefaultGenericAssociationAST* ast) { +void ASTSlot::visit(UnaryExpressionAST* ast) { switch (slot_) { - case 0: // defaultLoc - value_ = ast->defaultLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{60}; - break; - case 1: // colonLoc - value_ = ast->colonLoc.index(); + case 0: // opLoc + value_ = ast->opLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{155}; break; - case 2: // expression + case 1: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; + case 2: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; + break; } // switch slotCount_ = 3; } -void ASTSlot::visit(TypeGenericAssociationAST* ast) { +void ASTSlot::visit(AwaitExpressionAST* ast) { switch (slot_) { - case 0: // typeId - value_ = reinterpret_cast(ast->typeId); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; - break; - case 1: // colonLoc - value_ = ast->colonLoc.index(); + case 0: // awaitLoc + value_ = ast->awaitLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{19}; break; - case 2: // expression + case 1: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; } // switch - slotCount_ = 3; + slotCount_ = 2; } -void ASTSlot::visit(DotDesignatorAST* ast) { +void ASTSlot::visit(SizeofExpressionAST* ast) { switch (slot_) { - case 0: // dotLoc - value_ = ast->dotLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{64}; - break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); + case 0: // sizeofLoc + value_ = ast->sizeofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{190}; break; - case 2: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch - slotCount_ = 3; + slotCount_ = 2; } -void ASTSlot::visit(SubscriptDesignatorAST* ast) { +void ASTSlot::visit(SizeofTypeExpressionAST* ast) { switch (slot_) { - case 0: // lbracketLoc - value_ = ast->lbracketLoc.index(); + case 0: // sizeofLoc + value_ = ast->sizeofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{128}; + slotNameIndex_ = SlotNameIndex{190}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{135}; + break; + case 2: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{217}; break; - case 2: // rbracketLoc - value_ = ast->rbracketLoc.index(); + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{173}; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 3; + slotCount_ = 4; } -void ASTSlot::visit(SplicerAST* ast) { +void ASTSlot::visit(SizeofPackExpressionAST* ast) { switch (slot_) { - case 0: // lbracketLoc - value_ = ast->lbracketLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{128}; - break; - case 1: // colonLoc - value_ = ast->colonLoc.index(); + case 0: // sizeofLoc + value_ = ast->sizeofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{190}; break; - case 2: // ellipsisLoc + case 1: // ellipsisLoc value_ = ast->ellipsisLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{65}; break; - case 3: // expression - value_ = reinterpret_cast(ast->expression); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + case 2: // lparenLoc + value_ = ast->lparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{135}; break; - case 4: // secondColonLoc - value_ = ast->secondColonLoc.index(); + case 3: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{187}; + slotNameIndex_ = SlotNameIndex{102}; break; - case 5: // rbracketLoc - value_ = ast->rbracketLoc.index(); + case 4: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{173}; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 5: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; } // switch slotCount_ = 6; } -void ASTSlot::visit(GlobalModuleFragmentAST* ast) { +void ASTSlot::visit(AlignofTypeExpressionAST* ast) { switch (slot_) { - case 0: // moduleLoc - value_ = ast->moduleLoc.index(); + case 0: // alignofLoc + value_ = ast->alignofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{140}; + slotNameIndex_ = SlotNameIndex{4}; break; - case 1: // semicolonLoc - value_ = ast->semicolonLoc.index(); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 2: // declarationList - value_ = reinterpret_cast(ast->declarationList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{55}; + case 2: // typeId + value_ = reinterpret_cast(ast->typeId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{217}; + break; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 3; + slotCount_ = 4; } -void ASTSlot::visit(PrivateModuleFragmentAST* ast) { +void ASTSlot::visit(AlignofExpressionAST* ast) { switch (slot_) { - case 0: // moduleLoc - value_ = ast->moduleLoc.index(); + case 0: // alignofLoc + value_ = ast->alignofLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{140}; + slotNameIndex_ = SlotNameIndex{4}; break; - case 1: // colonLoc - value_ = ast->colonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; - case 2: // privateLoc - value_ = ast->privateLoc.index(); + } // switch + + slotCount_ = 2; +} + +void ASTSlot::visit(NoexceptExpressionAST* ast) { + switch (slot_) { + case 0: // noexceptLoc + value_ = ast->noexceptLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{163}; + slotNameIndex_ = SlotNameIndex{151}; break; - case 3: // semicolonLoc - value_ = ast->semicolonLoc.index(); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 4: // declarationList - value_ = reinterpret_cast(ast->declarationList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{55}; + case 2: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; + break; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 5; + slotCount_ = 4; } -void ASTSlot::visit(ModuleDeclarationAST* ast) { +void ASTSlot::visit(NewExpressionAST* ast) { switch (slot_) { - case 0: // exportLoc - value_ = ast->exportLoc.index(); + case 0: // scopeLoc + value_ = ast->scopeLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{78}; + slotNameIndex_ = SlotNameIndex{186}; break; - case 1: // moduleLoc - value_ = ast->moduleLoc.index(); + case 1: // newLoc + value_ = ast->newLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{140}; + slotNameIndex_ = SlotNameIndex{149}; break; - case 2: // moduleName - value_ = reinterpret_cast(ast->moduleName); + case 2: // newPlacement + value_ = reinterpret_cast(ast->newPlacement); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{141}; + slotNameIndex_ = SlotNameIndex{150}; break; - case 3: // modulePartition - value_ = reinterpret_cast(ast->modulePartition); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{142}; + case 3: // lparenLoc + value_ = ast->lparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{135}; break; - case 4: // attributeList - value_ = reinterpret_cast(ast->attributeList); + case 4: // typeSpecifierList + value_ = reinterpret_cast(ast->typeSpecifierList); slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{12}; - break; - case 5: // semicolonLoc - value_ = ast->semicolonLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{188}; + slotNameIndex_ = SlotNameIndex{222}; break; - } // switch - - slotCount_ = 6; -} - -void ASTSlot::visit(ModuleNameAST* ast) { - switch (slot_) { - case 0: // moduleQualifier - value_ = reinterpret_cast(ast->moduleQualifier); + case 5: // declarator + value_ = reinterpret_cast(ast->declarator); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{143}; + slotNameIndex_ = SlotNameIndex{56}; break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); + case 6: // rparenLoc + value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{185}; break; - case 2: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 7: // newInitalizer + value_ = reinterpret_cast(ast->newInitalizer); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{148}; break; } // switch - slotCount_ = 3; + slotCount_ = 8; } -void ASTSlot::visit(ModuleQualifierAST* ast) { +void ASTSlot::visit(DeleteExpressionAST* ast) { switch (slot_) { - case 0: // moduleQualifier - value_ = reinterpret_cast(ast->moduleQualifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{143}; - break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); + case 0: // scopeLoc + value_ = ast->scopeLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + slotNameIndex_ = SlotNameIndex{186}; break; - case 2: // dotLoc - value_ = ast->dotLoc.index(); + case 1: // deleteLoc + value_ = ast->deleteLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{64}; + slotNameIndex_ = SlotNameIndex{61}; break; - case 3: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 2: // lbracketLoc + value_ = ast->lbracketLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{128}; break; - } // switch - - slotCount_ = 4; -} - -void ASTSlot::visit(ModulePartitionAST* ast) { - switch (slot_) { - case 0: // colonLoc - value_ = ast->colonLoc.index(); + case 3: // rbracketLoc + value_ = ast->rbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{37}; + slotNameIndex_ = SlotNameIndex{173}; break; - case 1: // moduleName - value_ = reinterpret_cast(ast->moduleName); + case 4: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{141}; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch - slotCount_ = 2; + slotCount_ = 5; } -void ASTSlot::visit(ImportNameAST* ast) { +void ASTSlot::visit(CastExpressionAST* ast) { switch (slot_) { - case 0: // headerLoc - value_ = ast->headerLoc.index(); + case 0: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{98}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // modulePartition - value_ = reinterpret_cast(ast->modulePartition); + case 1: // typeId + value_ = reinterpret_cast(ast->typeId); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{142}; + slotNameIndex_ = SlotNameIndex{217}; break; - case 2: // moduleName - value_ = reinterpret_cast(ast->moduleName); + case 2: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; + break; + case 3: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{141}; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch - slotCount_ = 3; + slotCount_ = 4; } -void ASTSlot::visit(InitDeclaratorAST* ast) { +void ASTSlot::visit(ImplicitCastExpressionAST* ast) { switch (slot_) { - case 0: // declarator - value_ = reinterpret_cast(ast->declarator); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{56}; - break; - case 1: // requiresClause - value_ = reinterpret_cast(ast->requiresClause); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{179}; - break; - case 2: // initializer - value_ = reinterpret_cast(ast->initializer); + case 0: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{110}; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch - slotCount_ = 3; + slotCount_ = 1; } -void ASTSlot::visit(DeclaratorAST* ast) { +void ASTSlot::visit(BinaryExpressionAST* ast) { switch (slot_) { - case 0: // ptrOpList - value_ = reinterpret_cast(ast->ptrOpList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{165}; + case 0: // leftExpression + value_ = reinterpret_cast(ast->leftExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{129}; break; - case 1: // coreDeclarator - value_ = reinterpret_cast(ast->coreDeclarator); + case 1: // opLoc + value_ = ast->opLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{155}; + break; + case 2: // rightExpression + value_ = reinterpret_cast(ast->rightExpression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{50}; + slotNameIndex_ = SlotNameIndex{183}; break; - case 2: // declaratorChunkList - value_ = reinterpret_cast(ast->declaratorChunkList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{57}; + case 3: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; break; } // switch - slotCount_ = 3; + slotCount_ = 4; } -void ASTSlot::visit(UsingDeclaratorAST* ast) { +void ASTSlot::visit(ConditionalExpressionAST* ast) { switch (slot_) { - case 0: // typenameLoc - value_ = ast->typenameLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{226}; - break; - case 1: // nestedNameSpecifier - value_ = reinterpret_cast(ast->nestedNameSpecifier); + case 0: // condition + value_ = reinterpret_cast(ast->condition); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{146}; + slotNameIndex_ = SlotNameIndex{41}; break; - case 2: // unqualifiedId - value_ = reinterpret_cast(ast->unqualifiedId); + case 1: // questionLoc + value_ = ast->questionLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{168}; + break; + case 2: // iftrueExpression + value_ = reinterpret_cast(ast->iftrueExpression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{228}; + slotNameIndex_ = SlotNameIndex{105}; break; - case 3: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 3: // colonLoc + value_ = ast->colonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{37}; break; - case 4: // isPack - value_ = std::intptr_t(ast->isPack != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{118}; + case 4: // iffalseExpression + value_ = reinterpret_cast(ast->iffalseExpression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{104}; break; } // switch slotCount_ = 5; } -void ASTSlot::visit(EnumeratorAST* ast) { +void ASTSlot::visit(YieldExpressionAST* ast) { switch (slot_) { - case 0: // identifierLoc - value_ = ast->identifierLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; - break; - case 1: // attributeList - value_ = reinterpret_cast(ast->attributeList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{12}; - break; - case 2: // equalLoc - value_ = ast->equalLoc.index(); + case 0: // yieldLoc + value_ = ast->yieldLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{72}; + slotNameIndex_ = SlotNameIndex{237}; break; - case 3: // expression + case 1: // expression value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; slotNameIndex_ = SlotNameIndex{79}; break; - case 4: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; - break; } // switch - slotCount_ = 5; + slotCount_ = 2; } -void ASTSlot::visit(TypeIdAST* ast) { +void ASTSlot::visit(ThrowExpressionAST* ast) { switch (slot_) { - case 0: // typeSpecifierList - value_ = reinterpret_cast(ast->typeSpecifierList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{222}; + case 0: // throwLoc + value_ = ast->throwLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{212}; break; - case 1: // declarator - value_ = reinterpret_cast(ast->declarator); + case 1: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{56}; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(HandlerAST* ast) { +void ASTSlot::visit(AssignmentExpressionAST* ast) { switch (slot_) { - case 0: // catchLoc - value_ = ast->catchLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{31}; - break; - case 1: // lparenLoc - value_ = ast->lparenLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 2: // exceptionDeclaration - value_ = reinterpret_cast(ast->exceptionDeclaration); + case 0: // leftExpression + value_ = reinterpret_cast(ast->leftExpression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{73}; + slotNameIndex_ = SlotNameIndex{129}; break; - case 3: // rparenLoc - value_ = ast->rparenLoc.index(); + case 1: // opLoc + value_ = ast->opLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{155}; break; - case 4: // statement - value_ = reinterpret_cast(ast->statement); + case 2: // rightExpression + value_ = reinterpret_cast(ast->rightExpression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{195}; + slotNameIndex_ = SlotNameIndex{183}; + break; + case 3: // op + value_ = std::intptr_t(ast->op); + slotKind_ = ASTSlotKind::kIntAttribute; + slotNameIndex_ = SlotNameIndex{154}; break; } // switch - slotCount_ = 5; + slotCount_ = 4; } -void ASTSlot::visit(BaseSpecifierAST* ast) { +void ASTSlot::visit(PackExpansionExpressionAST* ast) { switch (slot_) { - case 0: // attributeList - value_ = reinterpret_cast(ast->attributeList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{12}; - break; - case 1: // virtualOrAccessLoc - value_ = ast->virtualOrAccessLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{233}; - break; - case 2: // otherVirtualOrAccessLoc - value_ = ast->otherVirtualOrAccessLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{159}; - break; - case 3: // nestedNameSpecifier - value_ = reinterpret_cast(ast->nestedNameSpecifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{146}; - break; - case 4: // templateLoc - value_ = ast->templateLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{206}; - break; - case 5: // unqualifiedId - value_ = reinterpret_cast(ast->unqualifiedId); + case 0: // expression + value_ = reinterpret_cast(ast->expression); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{228}; - break; - case 6: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; - break; - case 7: // isTemplateIntroduced - value_ = std::intptr_t(ast->isTemplateIntroduced != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{120}; - break; - case 8: // isVirtual - value_ = std::intptr_t(ast->isVirtual != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{124}; - break; - case 9: // isVariadic - value_ = std::intptr_t(ast->isVariadic != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{123}; - break; - case 10: // accessSpecifier - value_ = std::intptr_t(ast->accessSpecifier); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{2}; + slotNameIndex_ = SlotNameIndex{79}; + break; + case 1: // ellipsisLoc + value_ = ast->ellipsisLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{65}; break; } // switch - slotCount_ = 11; + slotCount_ = 2; } -void ASTSlot::visit(RequiresClauseAST* ast) { +void ASTSlot::visit(DesignatedInitializerClauseAST* ast) { switch (slot_) { - case 0: // requiresLoc - value_ = ast->requiresLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{180}; + case 0: // designatorList + value_ = reinterpret_cast(ast->designatorList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{62}; break; - case 1: // expression - value_ = reinterpret_cast(ast->expression); + case 1: // initializer + value_ = reinterpret_cast(ast->initializer); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{79}; + slotNameIndex_ = SlotNameIndex{110}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(ParameterDeclarationClauseAST* ast) { +void ASTSlot::visit(TypeTraitExpressionAST* ast) { switch (slot_) { - case 0: // parameterDeclarationList - value_ = reinterpret_cast(ast->parameterDeclarationList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{162}; - break; - case 1: // commaLoc - value_ = ast->commaLoc.index(); + case 0: // typeTraitLoc + value_ = ast->typeTraitLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{38}; + slotNameIndex_ = SlotNameIndex{223}; break; - case 2: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 1: // lparenLoc + value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{135}; break; - case 3: // isVariadic - value_ = std::intptr_t(ast->isVariadic != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{123}; + case 2: // typeIdList + value_ = reinterpret_cast(ast->typeIdList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{218}; + break; + case 3: // rparenLoc + value_ = ast->rparenLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{185}; break; } // switch slotCount_ = 4; } -void ASTSlot::visit(TrailingReturnTypeAST* ast) { +void ASTSlot::visit(ConditionExpressionAST* ast) { switch (slot_) { - case 0: // minusGreaterLoc - value_ = ast->minusGreaterLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{138}; + case 0: // attributeList + value_ = reinterpret_cast(ast->attributeList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{12}; break; - case 1: // typeId - value_ = reinterpret_cast(ast->typeId); + case 1: // declSpecifierList + value_ = reinterpret_cast(ast->declSpecifierList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{53}; + break; + case 2: // declarator + value_ = reinterpret_cast(ast->declarator); slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{217}; + slotNameIndex_ = SlotNameIndex{56}; + break; + case 3: // initializer + value_ = reinterpret_cast(ast->initializer); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{110}; break; } // switch - slotCount_ = 2; + slotCount_ = 4; } -void ASTSlot::visit(LambdaSpecifierAST* ast) { +void ASTSlot::visit(EqualInitializerAST* ast) { switch (slot_) { - case 0: // specifierLoc - value_ = ast->specifierLoc.index(); + case 0: // equalLoc + value_ = ast->equalLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{192}; + slotNameIndex_ = SlotNameIndex{72}; break; - case 1: // specifier - value_ = std::intptr_t(ast->specifier); - slotKind_ = ASTSlotKind::kIntAttribute; - slotNameIndex_ = SlotNameIndex{191}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch slotCount_ = 2; } -void ASTSlot::visit(TypeConstraintAST* ast) { +void ASTSlot::visit(BracedInitListAST* ast) { switch (slot_) { - case 0: // nestedNameSpecifier - value_ = reinterpret_cast(ast->nestedNameSpecifier); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{146}; - break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; - break; - case 2: // lessLoc - value_ = ast->lessLoc.index(); + case 0: // lbraceLoc + value_ = ast->lbraceLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{130}; + slotNameIndex_ = SlotNameIndex{126}; break; - case 3: // templateArgumentList - value_ = reinterpret_cast(ast->templateArgumentList); + case 1: // expressionList + value_ = reinterpret_cast(ast->expressionList); slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{204}; + slotNameIndex_ = SlotNameIndex{80}; break; - case 4: // greaterLoc - value_ = ast->greaterLoc.index(); + case 2: // commaLoc + value_ = ast->commaLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{96}; + slotNameIndex_ = SlotNameIndex{38}; break; - case 5: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; + case 3: // rbraceLoc + value_ = ast->rbraceLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{171}; break; } // switch - slotCount_ = 6; + slotCount_ = 4; } -void ASTSlot::visit(AttributeArgumentClauseAST* ast) { +void ASTSlot::visit(ParenInitializerAST* ast) { switch (slot_) { case 0: // lparenLoc value_ = ast->lparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{135}; break; - case 1: // rparenLoc + case 1: // expressionList + value_ = reinterpret_cast(ast->expressionList); + slotKind_ = ASTSlotKind::kNodeList; + slotNameIndex_ = SlotNameIndex{80}; + break; + case 2: // rparenLoc value_ = ast->rparenLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{185}; break; } // switch - slotCount_ = 2; + slotCount_ = 3; } -void ASTSlot::visit(AttributeAST* ast) { +void ASTSlot::visit(DefaultGenericAssociationAST* ast) { switch (slot_) { - case 0: // attributeToken - value_ = reinterpret_cast(ast->attributeToken); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{16}; - break; - case 1: // attributeArgumentClause - value_ = reinterpret_cast(ast->attributeArgumentClause); - slotKind_ = ASTSlotKind::kNode; - slotNameIndex_ = SlotNameIndex{11}; + case 0: // defaultLoc + value_ = ast->defaultLoc.index(); + slotKind_ = ASTSlotKind::kToken; + slotNameIndex_ = SlotNameIndex{60}; break; - case 2: // ellipsisLoc - value_ = ast->ellipsisLoc.index(); + case 1: // colonLoc + value_ = ast->colonLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{65}; + slotNameIndex_ = SlotNameIndex{37}; + break; + case 2: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; } // switch slotCount_ = 3; } -void ASTSlot::visit(AttributeUsingPrefixAST* ast) { +void ASTSlot::visit(TypeGenericAssociationAST* ast) { switch (slot_) { - case 0: // usingLoc - value_ = ast->usingLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{230}; - break; - case 1: // attributeNamespaceLoc - value_ = ast->attributeNamespaceLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{15}; + case 0: // typeId + value_ = reinterpret_cast(ast->typeId); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{217}; break; - case 2: // colonLoc + case 1: // colonLoc value_ = ast->colonLoc.index(); slotKind_ = ASTSlotKind::kToken; slotNameIndex_ = SlotNameIndex{37}; break; + case 2: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; + break; } // switch slotCount_ = 3; } -void ASTSlot::visit(NewPlacementAST* ast) { +void ASTSlot::visit(DotDesignatorAST* ast) { switch (slot_) { - case 0: // lparenLoc - value_ = ast->lparenLoc.index(); + case 0: // dotLoc + value_ = ast->dotLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{135}; - break; - case 1: // expressionList - value_ = reinterpret_cast(ast->expressionList); - slotKind_ = ASTSlotKind::kNodeList; - slotNameIndex_ = SlotNameIndex{80}; + slotNameIndex_ = SlotNameIndex{64}; break; - case 2: // rparenLoc - value_ = ast->rparenLoc.index(); + case 1: // identifierLoc + value_ = ast->identifierLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{185}; + slotNameIndex_ = SlotNameIndex{102}; + break; + case 2: // identifier + value_ = reinterpret_cast(ast->identifier); + slotKind_ = ASTSlotKind::kIdentifierAttribute; + slotNameIndex_ = SlotNameIndex{101}; break; } // switch slotCount_ = 3; } -void ASTSlot::visit(NestedNamespaceSpecifierAST* ast) { +void ASTSlot::visit(SubscriptDesignatorAST* ast) { switch (slot_) { - case 0: // inlineLoc - value_ = ast->inlineLoc.index(); + case 0: // lbracketLoc + value_ = ast->lbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{111}; + slotNameIndex_ = SlotNameIndex{128}; break; - case 1: // identifierLoc - value_ = ast->identifierLoc.index(); - slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{102}; + case 1: // expression + value_ = reinterpret_cast(ast->expression); + slotKind_ = ASTSlotKind::kNode; + slotNameIndex_ = SlotNameIndex{79}; break; - case 2: // scopeLoc - value_ = ast->scopeLoc.index(); + case 2: // rbracketLoc + value_ = ast->rbracketLoc.index(); slotKind_ = ASTSlotKind::kToken; - slotNameIndex_ = SlotNameIndex{186}; - break; - case 3: // identifier - value_ = reinterpret_cast(ast->identifier); - slotKind_ = ASTSlotKind::kIdentifierAttribute; - slotNameIndex_ = SlotNameIndex{101}; - break; - case 4: // isInline - value_ = std::intptr_t(ast->isInline != 0); - slotKind_ = ASTSlotKind::kBoolAttribute; - slotNameIndex_ = SlotNameIndex{115}; + slotNameIndex_ = SlotNameIndex{173}; break; } // switch - slotCount_ = 5; + slotCount_ = 3; } void ASTSlot::visit(TemplateTypeParameterAST* ast) { diff --git a/src/parser/cxx/ast_slot.h b/src/parser/cxx/ast_slot.h index f3162ab6..74dc29ca 100644 --- a/src/parser/cxx/ast_slot.h +++ b/src/parser/cxx/ast_slot.h @@ -82,10 +82,36 @@ class ASTSlot final : ASTVisitor { void visit(AccessDeclarationAST* ast) override; void visit(ForRangeDeclarationAST* ast) override; void visit(StructuredBindingDeclarationAST* ast) override; + void visit(AsmOperandAST* ast) override; void visit(AsmQualifierAST* ast) override; void visit(AsmClobberAST* ast) override; void visit(AsmGotoLabelAST* ast) override; + void visit(SplicerAST* ast) override; + void visit(GlobalModuleFragmentAST* ast) override; + void visit(PrivateModuleFragmentAST* ast) override; + void visit(ModuleDeclarationAST* ast) override; + void visit(ModuleNameAST* ast) override; + void visit(ModuleQualifierAST* ast) override; + void visit(ModulePartitionAST* ast) override; + void visit(ImportNameAST* ast) override; + void visit(InitDeclaratorAST* ast) override; + void visit(DeclaratorAST* ast) override; + void visit(UsingDeclaratorAST* ast) override; + void visit(EnumeratorAST* ast) override; + void visit(TypeIdAST* ast) override; + void visit(HandlerAST* ast) override; + void visit(BaseSpecifierAST* ast) override; + void visit(RequiresClauseAST* ast) override; + void visit(ParameterDeclarationClauseAST* ast) override; + void visit(TrailingReturnTypeAST* ast) override; + void visit(LambdaSpecifierAST* ast) override; + void visit(TypeConstraintAST* ast) override; + void visit(AttributeArgumentClauseAST* ast) override; + void visit(AttributeAST* ast) override; + void visit(AttributeUsingPrefixAST* ast) override; + void visit(NewPlacementAST* ast) override; + void visit(NestedNamespaceSpecifierAST* ast) override; void visit(LabeledStatementAST* ast) override; void visit(CaseStatementAST* ast) override; @@ -176,32 +202,6 @@ class ASTSlot final : ASTVisitor { void visit(DotDesignatorAST* ast) override; void visit(SubscriptDesignatorAST* ast) override; - void visit(SplicerAST* ast) override; - void visit(GlobalModuleFragmentAST* ast) override; - void visit(PrivateModuleFragmentAST* ast) override; - void visit(ModuleDeclarationAST* ast) override; - void visit(ModuleNameAST* ast) override; - void visit(ModuleQualifierAST* ast) override; - void visit(ModulePartitionAST* ast) override; - void visit(ImportNameAST* ast) override; - void visit(InitDeclaratorAST* ast) override; - void visit(DeclaratorAST* ast) override; - void visit(UsingDeclaratorAST* ast) override; - void visit(EnumeratorAST* ast) override; - void visit(TypeIdAST* ast) override; - void visit(HandlerAST* ast) override; - void visit(BaseSpecifierAST* ast) override; - void visit(RequiresClauseAST* ast) override; - void visit(ParameterDeclarationClauseAST* ast) override; - void visit(TrailingReturnTypeAST* ast) override; - void visit(LambdaSpecifierAST* ast) override; - void visit(TypeConstraintAST* ast) override; - void visit(AttributeArgumentClauseAST* ast) override; - void visit(AttributeAST* ast) override; - void visit(AttributeUsingPrefixAST* ast) override; - void visit(NewPlacementAST* ast) override; - void visit(NestedNamespaceSpecifierAST* ast) override; - void visit(TemplateTypeParameterAST* ast) override; void visit(NonTypeTemplateParameterAST* ast) override; void visit(TypenameTypeParameterAST* ast) override; diff --git a/src/parser/cxx/ast_visitor.cc b/src/parser/cxx/ast_visitor.cc index cdc81466..db9d935c 100644 --- a/src/parser/cxx/ast_visitor.cc +++ b/src/parser/cxx/ast_visitor.cc @@ -245,6 +245,125 @@ void ASTVisitor::visit(AsmClobberAST* ast) {} void ASTVisitor::visit(AsmGotoLabelAST* ast) {} +void ASTVisitor::visit(SplicerAST* ast) { accept(ast->expression); } + +void ASTVisitor::visit(GlobalModuleFragmentAST* ast) { + for (auto node : ListView{ast->declarationList}) { + accept(node); + } +} + +void ASTVisitor::visit(PrivateModuleFragmentAST* ast) { + for (auto node : ListView{ast->declarationList}) { + accept(node); + } +} + +void ASTVisitor::visit(ModuleDeclarationAST* ast) { + accept(ast->moduleName); + accept(ast->modulePartition); + for (auto node : ListView{ast->attributeList}) { + accept(node); + } +} + +void ASTVisitor::visit(ModuleNameAST* ast) { accept(ast->moduleQualifier); } + +void ASTVisitor::visit(ModuleQualifierAST* ast) { + accept(ast->moduleQualifier); +} + +void ASTVisitor::visit(ModulePartitionAST* ast) { accept(ast->moduleName); } + +void ASTVisitor::visit(ImportNameAST* ast) { + accept(ast->modulePartition); + accept(ast->moduleName); +} + +void ASTVisitor::visit(InitDeclaratorAST* ast) { + accept(ast->declarator); + accept(ast->requiresClause); + accept(ast->initializer); +} + +void ASTVisitor::visit(DeclaratorAST* ast) { + for (auto node : ListView{ast->ptrOpList}) { + accept(node); + } + accept(ast->coreDeclarator); + for (auto node : ListView{ast->declaratorChunkList}) { + accept(node); + } +} + +void ASTVisitor::visit(UsingDeclaratorAST* ast) { + accept(ast->nestedNameSpecifier); + accept(ast->unqualifiedId); +} + +void ASTVisitor::visit(EnumeratorAST* ast) { + for (auto node : ListView{ast->attributeList}) { + accept(node); + } + accept(ast->expression); +} + +void ASTVisitor::visit(TypeIdAST* ast) { + for (auto node : ListView{ast->typeSpecifierList}) { + accept(node); + } + accept(ast->declarator); +} + +void ASTVisitor::visit(HandlerAST* ast) { + accept(ast->exceptionDeclaration); + accept(ast->statement); +} + +void ASTVisitor::visit(BaseSpecifierAST* ast) { + for (auto node : ListView{ast->attributeList}) { + accept(node); + } + accept(ast->nestedNameSpecifier); + accept(ast->unqualifiedId); +} + +void ASTVisitor::visit(RequiresClauseAST* ast) { accept(ast->expression); } + +void ASTVisitor::visit(ParameterDeclarationClauseAST* ast) { + for (auto node : ListView{ast->parameterDeclarationList}) { + accept(node); + } +} + +void ASTVisitor::visit(TrailingReturnTypeAST* ast) { accept(ast->typeId); } + +void ASTVisitor::visit(LambdaSpecifierAST* ast) {} + +void ASTVisitor::visit(TypeConstraintAST* ast) { + accept(ast->nestedNameSpecifier); + for (auto node : ListView{ast->templateArgumentList}) { + accept(node); + } +} + +void ASTVisitor::visit(AttributeArgumentClauseAST* ast) {} + +void ASTVisitor::visit(AttributeAST* ast) { + accept(ast->attributeToken); + accept(ast->attributeArgumentClause); +} + +void ASTVisitor::visit(AttributeUsingPrefixAST* ast) {} + +void ASTVisitor::visit(NewPlacementAST* ast) { + for (auto node : ListView{ast->expressionList}) { + accept(node); + } +} + +void ASTVisitor::visit(NestedNamespaceSpecifierAST* ast) {} + void ASTVisitor::visit(LabeledStatementAST* ast) {} void ASTVisitor::visit(CaseStatementAST* ast) { accept(ast->expression); } @@ -591,125 +710,6 @@ void ASTVisitor::visit(DotDesignatorAST* ast) {} void ASTVisitor::visit(SubscriptDesignatorAST* ast) { accept(ast->expression); } -void ASTVisitor::visit(SplicerAST* ast) { accept(ast->expression); } - -void ASTVisitor::visit(GlobalModuleFragmentAST* ast) { - for (auto node : ListView{ast->declarationList}) { - accept(node); - } -} - -void ASTVisitor::visit(PrivateModuleFragmentAST* ast) { - for (auto node : ListView{ast->declarationList}) { - accept(node); - } -} - -void ASTVisitor::visit(ModuleDeclarationAST* ast) { - accept(ast->moduleName); - accept(ast->modulePartition); - for (auto node : ListView{ast->attributeList}) { - accept(node); - } -} - -void ASTVisitor::visit(ModuleNameAST* ast) { accept(ast->moduleQualifier); } - -void ASTVisitor::visit(ModuleQualifierAST* ast) { - accept(ast->moduleQualifier); -} - -void ASTVisitor::visit(ModulePartitionAST* ast) { accept(ast->moduleName); } - -void ASTVisitor::visit(ImportNameAST* ast) { - accept(ast->modulePartition); - accept(ast->moduleName); -} - -void ASTVisitor::visit(InitDeclaratorAST* ast) { - accept(ast->declarator); - accept(ast->requiresClause); - accept(ast->initializer); -} - -void ASTVisitor::visit(DeclaratorAST* ast) { - for (auto node : ListView{ast->ptrOpList}) { - accept(node); - } - accept(ast->coreDeclarator); - for (auto node : ListView{ast->declaratorChunkList}) { - accept(node); - } -} - -void ASTVisitor::visit(UsingDeclaratorAST* ast) { - accept(ast->nestedNameSpecifier); - accept(ast->unqualifiedId); -} - -void ASTVisitor::visit(EnumeratorAST* ast) { - for (auto node : ListView{ast->attributeList}) { - accept(node); - } - accept(ast->expression); -} - -void ASTVisitor::visit(TypeIdAST* ast) { - for (auto node : ListView{ast->typeSpecifierList}) { - accept(node); - } - accept(ast->declarator); -} - -void ASTVisitor::visit(HandlerAST* ast) { - accept(ast->exceptionDeclaration); - accept(ast->statement); -} - -void ASTVisitor::visit(BaseSpecifierAST* ast) { - for (auto node : ListView{ast->attributeList}) { - accept(node); - } - accept(ast->nestedNameSpecifier); - accept(ast->unqualifiedId); -} - -void ASTVisitor::visit(RequiresClauseAST* ast) { accept(ast->expression); } - -void ASTVisitor::visit(ParameterDeclarationClauseAST* ast) { - for (auto node : ListView{ast->parameterDeclarationList}) { - accept(node); - } -} - -void ASTVisitor::visit(TrailingReturnTypeAST* ast) { accept(ast->typeId); } - -void ASTVisitor::visit(LambdaSpecifierAST* ast) {} - -void ASTVisitor::visit(TypeConstraintAST* ast) { - accept(ast->nestedNameSpecifier); - for (auto node : ListView{ast->templateArgumentList}) { - accept(node); - } -} - -void ASTVisitor::visit(AttributeArgumentClauseAST* ast) {} - -void ASTVisitor::visit(AttributeAST* ast) { - accept(ast->attributeToken); - accept(ast->attributeArgumentClause); -} - -void ASTVisitor::visit(AttributeUsingPrefixAST* ast) {} - -void ASTVisitor::visit(NewPlacementAST* ast) { - for (auto node : ListView{ast->expressionList}) { - accept(node); - } -} - -void ASTVisitor::visit(NestedNamespaceSpecifierAST* ast) {} - void ASTVisitor::visit(TemplateTypeParameterAST* ast) { for (auto node : ListView{ast->templateParameterList}) { accept(node); diff --git a/src/parser/cxx/ast_visitor.h b/src/parser/cxx/ast_visitor.h index 91f95731..7cb27a93 100644 --- a/src/parser/cxx/ast_visitor.h +++ b/src/parser/cxx/ast_visitor.h @@ -64,10 +64,37 @@ class ASTVisitor { virtual void visit(AccessDeclarationAST* ast); virtual void visit(ForRangeDeclarationAST* ast); virtual void visit(StructuredBindingDeclarationAST* ast); + + // AST virtual void visit(AsmOperandAST* ast); virtual void visit(AsmQualifierAST* ast); virtual void visit(AsmClobberAST* ast); virtual void visit(AsmGotoLabelAST* ast); + virtual void visit(SplicerAST* ast); + virtual void visit(GlobalModuleFragmentAST* ast); + virtual void visit(PrivateModuleFragmentAST* ast); + virtual void visit(ModuleDeclarationAST* ast); + virtual void visit(ModuleNameAST* ast); + virtual void visit(ModuleQualifierAST* ast); + virtual void visit(ModulePartitionAST* ast); + virtual void visit(ImportNameAST* ast); + virtual void visit(InitDeclaratorAST* ast); + virtual void visit(DeclaratorAST* ast); + virtual void visit(UsingDeclaratorAST* ast); + virtual void visit(EnumeratorAST* ast); + virtual void visit(TypeIdAST* ast); + virtual void visit(HandlerAST* ast); + virtual void visit(BaseSpecifierAST* ast); + virtual void visit(RequiresClauseAST* ast); + virtual void visit(ParameterDeclarationClauseAST* ast); + virtual void visit(TrailingReturnTypeAST* ast); + virtual void visit(LambdaSpecifierAST* ast); + virtual void visit(TypeConstraintAST* ast); + virtual void visit(AttributeArgumentClauseAST* ast); + virtual void visit(AttributeAST* ast); + virtual void visit(AttributeUsingPrefixAST* ast); + virtual void visit(NewPlacementAST* ast); + virtual void visit(NestedNamespaceSpecifierAST* ast); // StatementAST virtual void visit(LabeledStatementAST* ast); @@ -162,33 +189,6 @@ class ASTVisitor { virtual void visit(DotDesignatorAST* ast); virtual void visit(SubscriptDesignatorAST* ast); - // AST - virtual void visit(SplicerAST* ast); - virtual void visit(GlobalModuleFragmentAST* ast); - virtual void visit(PrivateModuleFragmentAST* ast); - virtual void visit(ModuleDeclarationAST* ast); - virtual void visit(ModuleNameAST* ast); - virtual void visit(ModuleQualifierAST* ast); - virtual void visit(ModulePartitionAST* ast); - virtual void visit(ImportNameAST* ast); - virtual void visit(InitDeclaratorAST* ast); - virtual void visit(DeclaratorAST* ast); - virtual void visit(UsingDeclaratorAST* ast); - virtual void visit(EnumeratorAST* ast); - virtual void visit(TypeIdAST* ast); - virtual void visit(HandlerAST* ast); - virtual void visit(BaseSpecifierAST* ast); - virtual void visit(RequiresClauseAST* ast); - virtual void visit(ParameterDeclarationClauseAST* ast); - virtual void visit(TrailingReturnTypeAST* ast); - virtual void visit(LambdaSpecifierAST* ast); - virtual void visit(TypeConstraintAST* ast); - virtual void visit(AttributeArgumentClauseAST* ast); - virtual void visit(AttributeAST* ast); - virtual void visit(AttributeUsingPrefixAST* ast); - virtual void visit(NewPlacementAST* ast); - virtual void visit(NestedNamespaceSpecifierAST* ast); - // TemplateParameterAST virtual void visit(TemplateTypeParameterAST* ast); virtual void visit(NonTypeTemplateParameterAST* ast); diff --git a/src/parser/cxx/flatbuffers/ast_decoder.cc b/src/parser/cxx/flatbuffers/ast_decoder.cc index 27a03dc9..f09da715 100644 --- a/src/parser/cxx/flatbuffers/ast_decoder.cc +++ b/src/parser/cxx/flatbuffers/ast_decoder.cc @@ -138,14 +138,6 @@ auto ASTDecoder::decodeDeclaration(const void* ptr, io::Declaration type) case io::Declaration_StructuredBindingDeclaration: return decodeStructuredBindingDeclaration( reinterpret_cast(ptr)); - case io::Declaration_AsmOperand: - return decodeAsmOperand(reinterpret_cast(ptr)); - case io::Declaration_AsmQualifier: - return decodeAsmQualifier(reinterpret_cast(ptr)); - case io::Declaration_AsmClobber: - return decodeAsmClobber(reinterpret_cast(ptr)); - case io::Declaration_AsmGotoLabel: - return decodeAsmGotoLabel(reinterpret_cast(ptr)); default: return nullptr; } // switch @@ -1564,240 +1556,338 @@ auto ASTDecoder::decodeAsmGotoLabel(const io::AsmGotoLabel* node) return ast; } -auto ASTDecoder::decodeLabeledStatement(const io::LabeledStatement* node) - -> LabeledStatementAST* { +auto ASTDecoder::decodeSplicer(const io::Splicer* node) -> SplicerAST* { if (!node) return nullptr; - auto ast = new (pool_) LabeledStatementAST(); - ast->identifierLoc = SourceLocation(node->identifier_loc()); + auto ast = new (pool_) SplicerAST(); + ast->lbracketLoc = SourceLocation(node->lbracket_loc()); ast->colonLoc = SourceLocation(node->colon_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->secondColonLoc = SourceLocation(node->second_colon_loc()); + ast->rbracketLoc = SourceLocation(node->rbracket_loc()); return ast; } -auto ASTDecoder::decodeCaseStatement(const io::CaseStatement* node) - -> CaseStatementAST* { +auto ASTDecoder::decodeGlobalModuleFragment( + const io::GlobalModuleFragment* node) -> GlobalModuleFragmentAST* { if (!node) return nullptr; - auto ast = new (pool_) CaseStatementAST(); - ast->caseLoc = SourceLocation(node->case_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->colonLoc = SourceLocation(node->colon_loc()); + auto ast = new (pool_) GlobalModuleFragmentAST(); + ast->moduleLoc = SourceLocation(node->module_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + if (node->declaration_list()) { + auto* inserter = &ast->declarationList; + for (std::uint32_t i = 0; i < node->declaration_list()->size(); ++i) { + *inserter = new (pool_) List(decodeDeclaration( + node->declaration_list()->Get(i), + io::Declaration(node->declaration_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } return ast; } -auto ASTDecoder::decodeDefaultStatement(const io::DefaultStatement* node) - -> DefaultStatementAST* { +auto ASTDecoder::decodePrivateModuleFragment( + const io::PrivateModuleFragment* node) -> PrivateModuleFragmentAST* { if (!node) return nullptr; - auto ast = new (pool_) DefaultStatementAST(); - ast->defaultLoc = SourceLocation(node->default_loc()); + auto ast = new (pool_) PrivateModuleFragmentAST(); + ast->moduleLoc = SourceLocation(node->module_loc()); ast->colonLoc = SourceLocation(node->colon_loc()); + ast->privateLoc = SourceLocation(node->private_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + if (node->declaration_list()) { + auto* inserter = &ast->declarationList; + for (std::uint32_t i = 0; i < node->declaration_list()->size(); ++i) { + *inserter = new (pool_) List(decodeDeclaration( + node->declaration_list()->Get(i), + io::Declaration(node->declaration_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } return ast; } -auto ASTDecoder::decodeExpressionStatement(const io::ExpressionStatement* node) - -> ExpressionStatementAST* { +auto ASTDecoder::decodeModuleDeclaration(const io::ModuleDeclaration* node) + -> ModuleDeclarationAST* { if (!node) return nullptr; - auto ast = new (pool_) ExpressionStatementAST(); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + auto ast = new (pool_) ModuleDeclarationAST(); + ast->exportLoc = SourceLocation(node->export_loc()); + ast->moduleLoc = SourceLocation(node->module_loc()); + ast->moduleName = decodeModuleName(node->module_name()); + ast->modulePartition = decodeModulePartition(node->module_partition()); + if (node->attribute_list()) { + auto* inserter = &ast->attributeList; + for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { + *inserter = new (pool_) List(decodeAttributeSpecifier( + node->attribute_list()->Get(i), + io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeCompoundStatement(const io::CompoundStatement* node) - -> CompoundStatementAST* { +auto ASTDecoder::decodeModuleName(const io::ModuleName* node) + -> ModuleNameAST* { if (!node) return nullptr; - auto ast = new (pool_) CompoundStatementAST(); - ast->lbraceLoc = SourceLocation(node->lbrace_loc()); - if (node->statement_list()) { - auto* inserter = &ast->statementList; - for (std::uint32_t i = 0; i < node->statement_list()->size(); ++i) { - *inserter = new (pool_) List( - decodeStatement(node->statement_list()->Get(i), - io::Statement(node->statement_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } + auto ast = new (pool_) ModuleNameAST(); + ast->moduleQualifier = decodeModuleQualifier(node->module_qualifier()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); } - ast->rbraceLoc = SourceLocation(node->rbrace_loc()); return ast; } -auto ASTDecoder::decodeIfStatement(const io::IfStatement* node) - -> IfStatementAST* { +auto ASTDecoder::decodeModuleQualifier(const io::ModuleQualifier* node) + -> ModuleQualifierAST* { if (!node) return nullptr; - auto ast = new (pool_) IfStatementAST(); - ast->ifLoc = SourceLocation(node->if_loc()); - ast->constexprLoc = SourceLocation(node->constexpr_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->initializer = - decodeStatement(node->initializer(), node->initializer_type()); - ast->condition = decodeExpression(node->condition(), node->condition_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); - ast->elseLoc = SourceLocation(node->else_loc()); - ast->elseStatement = - decodeStatement(node->else_statement(), node->else_statement_type()); + auto ast = new (pool_) ModuleQualifierAST(); + ast->moduleQualifier = decodeModuleQualifier(node->module_qualifier()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->dotLoc = SourceLocation(node->dot_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); + } return ast; } -auto ASTDecoder::decodeConstevalIfStatement( - const io::ConstevalIfStatement* node) -> ConstevalIfStatementAST* { +auto ASTDecoder::decodeModulePartition(const io::ModulePartition* node) + -> ModulePartitionAST* { if (!node) return nullptr; - auto ast = new (pool_) ConstevalIfStatementAST(); - ast->ifLoc = SourceLocation(node->if_loc()); - ast->exclaimLoc = SourceLocation(node->exclaim_loc()); - ast->constvalLoc = SourceLocation(node->constval_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); - ast->elseLoc = SourceLocation(node->else_loc()); - ast->elseStatement = - decodeStatement(node->else_statement(), node->else_statement_type()); + auto ast = new (pool_) ModulePartitionAST(); + ast->colonLoc = SourceLocation(node->colon_loc()); + ast->moduleName = decodeModuleName(node->module_name()); return ast; } -auto ASTDecoder::decodeSwitchStatement(const io::SwitchStatement* node) - -> SwitchStatementAST* { +auto ASTDecoder::decodeImportName(const io::ImportName* node) + -> ImportNameAST* { if (!node) return nullptr; - auto ast = new (pool_) SwitchStatementAST(); - ast->switchLoc = SourceLocation(node->switch_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); + auto ast = new (pool_) ImportNameAST(); + ast->headerLoc = SourceLocation(node->header_loc()); + ast->modulePartition = decodeModulePartition(node->module_partition()); + ast->moduleName = decodeModuleName(node->module_name()); + return ast; +} + +auto ASTDecoder::decodeInitDeclarator(const io::InitDeclarator* node) + -> InitDeclaratorAST* { + if (!node) return nullptr; + + auto ast = new (pool_) InitDeclaratorAST(); + ast->declarator = decodeDeclarator(node->declarator()); + ast->requiresClause = decodeRequiresClause(node->requires_clause()); ast->initializer = - decodeStatement(node->initializer(), node->initializer_type()); - ast->condition = decodeExpression(node->condition(), node->condition_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); + decodeExpression(node->initializer(), node->initializer_type()); return ast; } -auto ASTDecoder::decodeWhileStatement(const io::WhileStatement* node) - -> WhileStatementAST* { +auto ASTDecoder::decodeDeclarator(const io::Declarator* node) + -> DeclaratorAST* { if (!node) return nullptr; - auto ast = new (pool_) WhileStatementAST(); - ast->whileLoc = SourceLocation(node->while_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->condition = decodeExpression(node->condition(), node->condition_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); + auto ast = new (pool_) DeclaratorAST(); + if (node->ptr_op_list()) { + auto* inserter = &ast->ptrOpList; + for (std::uint32_t i = 0; i < node->ptr_op_list()->size(); ++i) { + *inserter = new (pool_) List( + decodePtrOperator(node->ptr_op_list()->Get(i), + io::PtrOperator(node->ptr_op_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->coreDeclarator = decodeCoreDeclarator(node->core_declarator(), + node->core_declarator_type()); + if (node->declarator_chunk_list()) { + auto* inserter = &ast->declaratorChunkList; + for (std::uint32_t i = 0; i < node->declarator_chunk_list()->size(); ++i) { + *inserter = new (pool_) List(decodeDeclaratorChunk( + node->declarator_chunk_list()->Get(i), + io::DeclaratorChunk(node->declarator_chunk_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } return ast; } -auto ASTDecoder::decodeDoStatement(const io::DoStatement* node) - -> DoStatementAST* { +auto ASTDecoder::decodeUsingDeclarator(const io::UsingDeclarator* node) + -> UsingDeclaratorAST* { if (!node) return nullptr; - auto ast = new (pool_) DoStatementAST(); - ast->doLoc = SourceLocation(node->do_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); - ast->whileLoc = SourceLocation(node->while_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); + auto ast = new (pool_) UsingDeclaratorAST(); + ast->typenameLoc = SourceLocation(node->typename_loc()); + ast->nestedNameSpecifier = decodeNestedNameSpecifier( + node->nested_name_specifier(), node->nested_name_specifier_type()); + ast->unqualifiedId = + decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + return ast; +} + +auto ASTDecoder::decodeEnumerator(const io::Enumerator* node) + -> EnumeratorAST* { + if (!node) return nullptr; + + auto ast = new (pool_) EnumeratorAST(); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + if (node->attribute_list()) { + auto* inserter = &ast->attributeList; + for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { + *inserter = new (pool_) List(decodeAttributeSpecifier( + node->attribute_list()->Get(i), + io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->equalLoc = SourceLocation(node->equal_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); + } return ast; } -auto ASTDecoder::decodeForRangeStatement(const io::ForRangeStatement* node) - -> ForRangeStatementAST* { +auto ASTDecoder::decodeTypeId(const io::TypeId* node) -> TypeIdAST* { if (!node) return nullptr; - auto ast = new (pool_) ForRangeStatementAST(); - ast->forLoc = SourceLocation(node->for_loc()); + auto ast = new (pool_) TypeIdAST(); + if (node->type_specifier_list()) { + auto* inserter = &ast->typeSpecifierList; + for (std::uint32_t i = 0; i < node->type_specifier_list()->size(); ++i) { + *inserter = new (pool_) List(decodeSpecifier( + node->type_specifier_list()->Get(i), + io::Specifier(node->type_specifier_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->declarator = decodeDeclarator(node->declarator()); + return ast; +} + +auto ASTDecoder::decodeHandler(const io::Handler* node) -> HandlerAST* { + if (!node) return nullptr; + + auto ast = new (pool_) HandlerAST(); + ast->catchLoc = SourceLocation(node->catch_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->initializer = - decodeStatement(node->initializer(), node->initializer_type()); - ast->rangeDeclaration = decodeDeclaration(node->range_declaration(), - node->range_declaration_type()); - ast->colonLoc = SourceLocation(node->colon_loc()); - ast->rangeInitializer = decodeExpression(node->range_initializer(), - node->range_initializer_type()); + ast->exceptionDeclaration = decodeExceptionDeclaration( + node->exception_declaration(), node->exception_declaration_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); + ast->statement = decodeCompoundStatement(node->statement()); return ast; } -auto ASTDecoder::decodeForStatement(const io::ForStatement* node) - -> ForStatementAST* { +auto ASTDecoder::decodeBaseSpecifier(const io::BaseSpecifier* node) + -> BaseSpecifierAST* { if (!node) return nullptr; - auto ast = new (pool_) ForStatementAST(); - ast->forLoc = SourceLocation(node->for_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->initializer = - decodeStatement(node->initializer(), node->initializer_type()); - ast->condition = decodeExpression(node->condition(), node->condition_type()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeStatement(node->statement(), node->statement_type()); + auto ast = new (pool_) BaseSpecifierAST(); + if (node->attribute_list()) { + auto* inserter = &ast->attributeList; + for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { + *inserter = new (pool_) List(decodeAttributeSpecifier( + node->attribute_list()->Get(i), + io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->virtualOrAccessLoc = SourceLocation(node->virtual_or_access_loc()); + ast->otherVirtualOrAccessLoc = + SourceLocation(node->other_virtual_or_access_loc()); + ast->nestedNameSpecifier = decodeNestedNameSpecifier( + node->nested_name_specifier(), node->nested_name_specifier_type()); + ast->templateLoc = SourceLocation(node->template_loc()); + ast->unqualifiedId = + decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->accessSpecifier = static_cast(node->access_specifier()); return ast; } -auto ASTDecoder::decodeBreakStatement(const io::BreakStatement* node) - -> BreakStatementAST* { +auto ASTDecoder::decodeRequiresClause(const io::RequiresClause* node) + -> RequiresClauseAST* { if (!node) return nullptr; - auto ast = new (pool_) BreakStatementAST(); - ast->breakLoc = SourceLocation(node->break_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + auto ast = new (pool_) RequiresClauseAST(); + ast->requiresLoc = SourceLocation(node->requires_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeContinueStatement(const io::ContinueStatement* node) - -> ContinueStatementAST* { +auto ASTDecoder::decodeParameterDeclarationClause( + const io::ParameterDeclarationClause* node) + -> ParameterDeclarationClauseAST* { if (!node) return nullptr; - auto ast = new (pool_) ContinueStatementAST(); - ast->continueLoc = SourceLocation(node->continue_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + auto ast = new (pool_) ParameterDeclarationClauseAST(); + if (node->parameter_declaration_list()) { + auto* inserter = &ast->parameterDeclarationList; + for (std::uint32_t i = 0; i < node->parameter_declaration_list()->size(); + ++i) { + *inserter = new (pool_) List(decodeParameterDeclaration( + node->parameter_declaration_list()->Get(i))); + inserter = &(*inserter)->next; + } + } + ast->commaLoc = SourceLocation(node->comma_loc()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); return ast; } -auto ASTDecoder::decodeReturnStatement(const io::ReturnStatement* node) - -> ReturnStatementAST* { +auto ASTDecoder::decodeTrailingReturnType(const io::TrailingReturnType* node) + -> TrailingReturnTypeAST* { if (!node) return nullptr; - auto ast = new (pool_) ReturnStatementAST(); - ast->returnLoc = SourceLocation(node->return_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + auto ast = new (pool_) TrailingReturnTypeAST(); + ast->minusGreaterLoc = SourceLocation(node->minus_greater_loc()); + ast->typeId = decodeTypeId(node->type_id()); return ast; } -auto ASTDecoder::decodeCoroutineReturnStatement( - const io::CoroutineReturnStatement* node) -> CoroutineReturnStatementAST* { +auto ASTDecoder::decodeLambdaSpecifier(const io::LambdaSpecifier* node) + -> LambdaSpecifierAST* { if (!node) return nullptr; - auto ast = new (pool_) CoroutineReturnStatementAST(); - ast->coreturnLoc = SourceLocation(node->coreturn_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + auto ast = new (pool_) LambdaSpecifierAST(); + ast->specifierLoc = SourceLocation(node->specifier_loc()); + ast->specifier = static_cast(node->specifier()); return ast; } -auto ASTDecoder::decodeGotoStatement(const io::GotoStatement* node) - -> GotoStatementAST* { +auto ASTDecoder::decodeTypeConstraint(const io::TypeConstraint* node) + -> TypeConstraintAST* { if (!node) return nullptr; - auto ast = new (pool_) GotoStatementAST(); - ast->gotoLoc = SourceLocation(node->goto_loc()); - ast->starLoc = SourceLocation(node->star_loc()); + auto ast = new (pool_) TypeConstraintAST(); + ast->nestedNameSpecifier = decodeNestedNameSpecifier( + node->nested_name_specifier(), node->nested_name_specifier_type()); ast->identifierLoc = SourceLocation(node->identifier_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + ast->lessLoc = SourceLocation(node->less_loc()); + if (node->template_argument_list()) { + auto* inserter = &ast->templateArgumentList; + for (std::uint32_t i = 0; i < node->template_argument_list()->size(); ++i) { + *inserter = new (pool_) List(decodeTemplateArgument( + node->template_argument_list()->Get(i), + io::TemplateArgument(node->template_argument_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->greaterLoc = SourceLocation(node->greater_loc()); if (node->identifier()) { ast->identifier = unit_->control()->getIdentifier(node->identifier()->str()); @@ -1805,1004 +1895,982 @@ auto ASTDecoder::decodeGotoStatement(const io::GotoStatement* node) return ast; } -auto ASTDecoder::decodeDeclarationStatement( - const io::DeclarationStatement* node) -> DeclarationStatementAST* { +auto ASTDecoder::decodeAttributeArgumentClause( + const io::AttributeArgumentClause* node) -> AttributeArgumentClauseAST* { if (!node) return nullptr; - auto ast = new (pool_) DeclarationStatementAST(); - ast->declaration = - decodeDeclaration(node->declaration(), node->declaration_type()); + auto ast = new (pool_) AttributeArgumentClauseAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeTryBlockStatement(const io::TryBlockStatement* node) - -> TryBlockStatementAST* { +auto ASTDecoder::decodeAttribute(const io::Attribute* node) -> AttributeAST* { if (!node) return nullptr; - auto ast = new (pool_) TryBlockStatementAST(); - ast->tryLoc = SourceLocation(node->try_loc()); - ast->statement = decodeCompoundStatement(node->statement()); - if (node->handler_list()) { - auto* inserter = &ast->handlerList; - for (std::uint32_t i = 0; i < node->handler_list()->size(); ++i) { - *inserter = new (pool_) List(decodeHandler(node->handler_list()->Get(i))); - inserter = &(*inserter)->next; - } - } + auto ast = new (pool_) AttributeAST(); + ast->attributeToken = decodeAttributeToken(node->attribute_token(), + node->attribute_token_type()); + ast->attributeArgumentClause = + decodeAttributeArgumentClause(node->attribute_argument_clause()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); return ast; } -auto ASTDecoder::decodeGeneratedLiteralExpression( - const io::GeneratedLiteralExpression* node) - -> GeneratedLiteralExpressionAST* { +auto ASTDecoder::decodeAttributeUsingPrefix( + const io::AttributeUsingPrefix* node) -> AttributeUsingPrefixAST* { if (!node) return nullptr; - auto ast = new (pool_) GeneratedLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); + auto ast = new (pool_) AttributeUsingPrefixAST(); + ast->usingLoc = SourceLocation(node->using_loc()); + ast->attributeNamespaceLoc = SourceLocation(node->attribute_namespace_loc()); + ast->colonLoc = SourceLocation(node->colon_loc()); return ast; } -auto ASTDecoder::decodeCharLiteralExpression( - const io::CharLiteralExpression* node) -> CharLiteralExpressionAST* { +auto ASTDecoder::decodeNewPlacement(const io::NewPlacement* node) + -> NewPlacementAST* { if (!node) return nullptr; - auto ast = new (pool_) CharLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - if (node->literal()) { - ast->literal = unit_->control()->charLiteral(node->literal()->str()); + auto ast = new (pool_) NewPlacementAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + if (node->expression_list()) { + auto* inserter = &ast->expressionList; + for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { + *inserter = new (pool_) List(decodeExpression( + node->expression_list()->Get(i), + io::Expression(node->expression_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } } + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeBoolLiteralExpression( - const io::BoolLiteralExpression* node) -> BoolLiteralExpressionAST* { +auto ASTDecoder::decodeNestedNamespaceSpecifier( + const io::NestedNamespaceSpecifier* node) -> NestedNamespaceSpecifierAST* { if (!node) return nullptr; - auto ast = new (pool_) BoolLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); + auto ast = new (pool_) NestedNamespaceSpecifierAST(); + ast->inlineLoc = SourceLocation(node->inline_loc()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->scopeLoc = SourceLocation(node->scope_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); + } return ast; } -auto ASTDecoder::decodeIntLiteralExpression( - const io::IntLiteralExpression* node) -> IntLiteralExpressionAST* { +auto ASTDecoder::decodeLabeledStatement(const io::LabeledStatement* node) + -> LabeledStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) IntLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - if (node->literal()) { - ast->literal = unit_->control()->integerLiteral(node->literal()->str()); + auto ast = new (pool_) LabeledStatementAST(); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->colonLoc = SourceLocation(node->colon_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); } return ast; } -auto ASTDecoder::decodeFloatLiteralExpression( - const io::FloatLiteralExpression* node) -> FloatLiteralExpressionAST* { +auto ASTDecoder::decodeCaseStatement(const io::CaseStatement* node) + -> CaseStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) FloatLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - if (node->literal()) { - ast->literal = unit_->control()->floatLiteral(node->literal()->str()); - } + auto ast = new (pool_) CaseStatementAST(); + ast->caseLoc = SourceLocation(node->case_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->colonLoc = SourceLocation(node->colon_loc()); return ast; } -auto ASTDecoder::decodeNullptrLiteralExpression( - const io::NullptrLiteralExpression* node) -> NullptrLiteralExpressionAST* { +auto ASTDecoder::decodeDefaultStatement(const io::DefaultStatement* node) + -> DefaultStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) NullptrLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - ast->literal = static_cast(node->literal()); + auto ast = new (pool_) DefaultStatementAST(); + ast->defaultLoc = SourceLocation(node->default_loc()); + ast->colonLoc = SourceLocation(node->colon_loc()); return ast; } -auto ASTDecoder::decodeStringLiteralExpression( - const io::StringLiteralExpression* node) -> StringLiteralExpressionAST* { +auto ASTDecoder::decodeExpressionStatement(const io::ExpressionStatement* node) + -> ExpressionStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) StringLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - if (node->literal()) { - ast->literal = unit_->control()->stringLiteral(node->literal()->str()); - } + auto ast = new (pool_) ExpressionStatementAST(); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeUserDefinedStringLiteralExpression( - const io::UserDefinedStringLiteralExpression* node) - -> UserDefinedStringLiteralExpressionAST* { +auto ASTDecoder::decodeCompoundStatement(const io::CompoundStatement* node) + -> CompoundStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) UserDefinedStringLiteralExpressionAST(); - ast->literalLoc = SourceLocation(node->literal_loc()); - if (node->literal()) { - ast->literal = unit_->control()->stringLiteral(node->literal()->str()); + auto ast = new (pool_) CompoundStatementAST(); + ast->lbraceLoc = SourceLocation(node->lbrace_loc()); + if (node->statement_list()) { + auto* inserter = &ast->statementList; + for (std::uint32_t i = 0; i < node->statement_list()->size(); ++i) { + *inserter = new (pool_) List( + decodeStatement(node->statement_list()->Get(i), + io::Statement(node->statement_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } } + ast->rbraceLoc = SourceLocation(node->rbrace_loc()); return ast; } -auto ASTDecoder::decodeObjectLiteralExpression( - const io::ObjectLiteralExpression* node) -> ObjectLiteralExpressionAST* { +auto ASTDecoder::decodeIfStatement(const io::IfStatement* node) + -> IfStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) ObjectLiteralExpressionAST(); + auto ast = new (pool_) IfStatementAST(); + ast->ifLoc = SourceLocation(node->if_loc()); + ast->constexprLoc = SourceLocation(node->constexpr_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->typeId = decodeTypeId(node->type_id()); + ast->initializer = + decodeStatement(node->initializer(), node->initializer_type()); + ast->condition = decodeExpression(node->condition(), node->condition_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->bracedInitList = decodeBracedInitList(node->braced_init_list()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); + ast->elseLoc = SourceLocation(node->else_loc()); + ast->elseStatement = + decodeStatement(node->else_statement(), node->else_statement_type()); return ast; } -auto ASTDecoder::decodeThisExpression(const io::ThisExpression* node) - -> ThisExpressionAST* { +auto ASTDecoder::decodeConstevalIfStatement( + const io::ConstevalIfStatement* node) -> ConstevalIfStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) ThisExpressionAST(); - ast->thisLoc = SourceLocation(node->this_loc()); + auto ast = new (pool_) ConstevalIfStatementAST(); + ast->ifLoc = SourceLocation(node->if_loc()); + ast->exclaimLoc = SourceLocation(node->exclaim_loc()); + ast->constvalLoc = SourceLocation(node->constval_loc()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); + ast->elseLoc = SourceLocation(node->else_loc()); + ast->elseStatement = + decodeStatement(node->else_statement(), node->else_statement_type()); return ast; } -auto ASTDecoder::decodeGenericSelectionExpression( - const io::GenericSelectionExpression* node) - -> GenericSelectionExpressionAST* { +auto ASTDecoder::decodeSwitchStatement(const io::SwitchStatement* node) + -> SwitchStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) GenericSelectionExpressionAST(); - ast->genericLoc = SourceLocation(node->generic_loc()); + auto ast = new (pool_) SwitchStatementAST(); + ast->switchLoc = SourceLocation(node->switch_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->commaLoc = SourceLocation(node->comma_loc()); - if (node->generic_association_list()) { - auto* inserter = &ast->genericAssociationList; - for (std::uint32_t i = 0; i < node->generic_association_list()->size(); - ++i) { - *inserter = new (pool_) List(decodeGenericAssociation( - node->generic_association_list()->Get(i), - io::GenericAssociation( - node->generic_association_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } + ast->initializer = + decodeStatement(node->initializer(), node->initializer_type()); + ast->condition = decodeExpression(node->condition(), node->condition_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); return ast; } -auto ASTDecoder::decodeNestedStatementExpression( - const io::NestedStatementExpression* node) - -> NestedStatementExpressionAST* { +auto ASTDecoder::decodeWhileStatement(const io::WhileStatement* node) + -> WhileStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) NestedStatementExpressionAST(); + auto ast = new (pool_) WhileStatementAST(); + ast->whileLoc = SourceLocation(node->while_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->statement = decodeCompoundStatement(node->statement()); + ast->condition = decodeExpression(node->condition(), node->condition_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); return ast; } -auto ASTDecoder::decodeNestedExpression(const io::NestedExpression* node) - -> NestedExpressionAST* { +auto ASTDecoder::decodeDoStatement(const io::DoStatement* node) + -> DoStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) NestedExpressionAST(); + auto ast = new (pool_) DoStatementAST(); + ast->doLoc = SourceLocation(node->do_loc()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); + ast->whileLoc = SourceLocation(node->while_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeIdExpression(const io::IdExpression* node) - -> IdExpressionAST* { - if (!node) return nullptr; - - auto ast = new (pool_) IdExpressionAST(); - ast->nestedNameSpecifier = decodeNestedNameSpecifier( - node->nested_name_specifier(), node->nested_name_specifier_type()); - ast->templateLoc = SourceLocation(node->template_loc()); - ast->unqualifiedId = - decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); - return ast; -} - -auto ASTDecoder::decodeLambdaExpression(const io::LambdaExpression* node) - -> LambdaExpressionAST* { +auto ASTDecoder::decodeForRangeStatement(const io::ForRangeStatement* node) + -> ForRangeStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) LambdaExpressionAST(); - ast->lbracketLoc = SourceLocation(node->lbracket_loc()); - ast->captureDefaultLoc = SourceLocation(node->capture_default_loc()); - if (node->capture_list()) { - auto* inserter = &ast->captureList; - for (std::uint32_t i = 0; i < node->capture_list()->size(); ++i) { - *inserter = new (pool_) List(decodeLambdaCapture( - node->capture_list()->Get(i), - io::LambdaCapture(node->capture_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->rbracketLoc = SourceLocation(node->rbracket_loc()); - ast->lessLoc = SourceLocation(node->less_loc()); - if (node->template_parameter_list()) { - auto* inserter = &ast->templateParameterList; - for (std::uint32_t i = 0; i < node->template_parameter_list()->size(); - ++i) { - *inserter = new (pool_) List(decodeTemplateParameter( - node->template_parameter_list()->Get(i), - io::TemplateParameter(node->template_parameter_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->greaterLoc = SourceLocation(node->greater_loc()); - ast->templateRequiresClause = - decodeRequiresClause(node->template_requires_clause()); + auto ast = new (pool_) ForRangeStatementAST(); + ast->forLoc = SourceLocation(node->for_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->parameterDeclarationClause = - decodeParameterDeclarationClause(node->parameter_declaration_clause()); + ast->initializer = + decodeStatement(node->initializer(), node->initializer_type()); + ast->rangeDeclaration = decodeDeclaration(node->range_declaration(), + node->range_declaration_type()); + ast->colonLoc = SourceLocation(node->colon_loc()); + ast->rangeInitializer = decodeExpression(node->range_initializer(), + node->range_initializer_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - if (node->gnu_atribute_list()) { - auto* inserter = &ast->gnuAtributeList; - for (std::uint32_t i = 0; i < node->gnu_atribute_list()->size(); ++i) { - *inserter = new (pool_) List(decodeAttributeSpecifier( - node->gnu_atribute_list()->Get(i), - io::AttributeSpecifier(node->gnu_atribute_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - if (node->lambda_specifier_list()) { - auto* inserter = &ast->lambdaSpecifierList; - for (std::uint32_t i = 0; i < node->lambda_specifier_list()->size(); ++i) { - *inserter = new (pool_) - List(decodeLambdaSpecifier(node->lambda_specifier_list()->Get(i))); - inserter = &(*inserter)->next; - } - } - ast->exceptionSpecifier = decodeExceptionSpecifier( - node->exception_specifier(), node->exception_specifier_type()); - if (node->attribute_list()) { - auto* inserter = &ast->attributeList; - for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { - *inserter = new (pool_) List(decodeAttributeSpecifier( - node->attribute_list()->Get(i), - io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->trailingReturnType = - decodeTrailingReturnType(node->trailing_return_type()); - ast->requiresClause = decodeRequiresClause(node->requires_clause()); - ast->statement = decodeCompoundStatement(node->statement()); - ast->captureDefault = static_cast(node->capture_default()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); return ast; } -auto ASTDecoder::decodeFoldExpression(const io::FoldExpression* node) - -> FoldExpressionAST* { +auto ASTDecoder::decodeForStatement(const io::ForStatement* node) + -> ForStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) FoldExpressionAST(); + auto ast = new (pool_) ForStatementAST(); + ast->forLoc = SourceLocation(node->for_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->leftExpression = - decodeExpression(node->left_expression(), node->left_expression_type()); - ast->opLoc = SourceLocation(node->op_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); - ast->foldOpLoc = SourceLocation(node->fold_op_loc()); - ast->rightExpression = - decodeExpression(node->right_expression(), node->right_expression_type()); + ast->initializer = + decodeStatement(node->initializer(), node->initializer_type()); + ast->condition = decodeExpression(node->condition(), node->condition_type()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->op = static_cast(node->op()); - ast->foldOp = static_cast(node->fold_op()); + ast->statement = decodeStatement(node->statement(), node->statement_type()); return ast; } -auto ASTDecoder::decodeRightFoldExpression(const io::RightFoldExpression* node) - -> RightFoldExpressionAST* { +auto ASTDecoder::decodeBreakStatement(const io::BreakStatement* node) + -> BreakStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) RightFoldExpressionAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->opLoc = SourceLocation(node->op_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->op = static_cast(node->op()); + auto ast = new (pool_) BreakStatementAST(); + ast->breakLoc = SourceLocation(node->break_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeLeftFoldExpression(const io::LeftFoldExpression* node) - -> LeftFoldExpressionAST* { +auto ASTDecoder::decodeContinueStatement(const io::ContinueStatement* node) + -> ContinueStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) LeftFoldExpressionAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); - ast->opLoc = SourceLocation(node->op_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->op = static_cast(node->op()); + auto ast = new (pool_) ContinueStatementAST(); + ast->continueLoc = SourceLocation(node->continue_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeRequiresExpression(const io::RequiresExpression* node) - -> RequiresExpressionAST* { +auto ASTDecoder::decodeReturnStatement(const io::ReturnStatement* node) + -> ReturnStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) RequiresExpressionAST(); - ast->requiresLoc = SourceLocation(node->requires_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->parameterDeclarationClause = - decodeParameterDeclarationClause(node->parameter_declaration_clause()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->lbraceLoc = SourceLocation(node->lbrace_loc()); - if (node->requirement_list()) { - auto* inserter = &ast->requirementList; - for (std::uint32_t i = 0; i < node->requirement_list()->size(); ++i) { - *inserter = new (pool_) List(decodeRequirement( - node->requirement_list()->Get(i), - io::Requirement(node->requirement_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->rbraceLoc = SourceLocation(node->rbrace_loc()); + auto ast = new (pool_) ReturnStatementAST(); + ast->returnLoc = SourceLocation(node->return_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeVaArgExpression(const io::VaArgExpression* node) - -> VaArgExpressionAST* { +auto ASTDecoder::decodeCoroutineReturnStatement( + const io::CoroutineReturnStatement* node) -> CoroutineReturnStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) VaArgExpressionAST(); - ast->vaArgLoc = SourceLocation(node->va_arg_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); + auto ast = new (pool_) CoroutineReturnStatementAST(); + ast->coreturnLoc = SourceLocation(node->coreturn_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); - ast->commaLoc = SourceLocation(node->comma_loc()); - ast->typeId = decodeTypeId(node->type_id()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); return ast; } -auto ASTDecoder::decodeSubscriptExpression(const io::SubscriptExpression* node) - -> SubscriptExpressionAST* { +auto ASTDecoder::decodeGotoStatement(const io::GotoStatement* node) + -> GotoStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) SubscriptExpressionAST(); - ast->baseExpression = - decodeExpression(node->base_expression(), node->base_expression_type()); - ast->lbracketLoc = SourceLocation(node->lbracket_loc()); - ast->indexExpression = - decodeExpression(node->index_expression(), node->index_expression_type()); - ast->rbracketLoc = SourceLocation(node->rbracket_loc()); + auto ast = new (pool_) GotoStatementAST(); + ast->gotoLoc = SourceLocation(node->goto_loc()); + ast->starLoc = SourceLocation(node->star_loc()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); + } return ast; } -auto ASTDecoder::decodeCallExpression(const io::CallExpression* node) - -> CallExpressionAST* { +auto ASTDecoder::decodeDeclarationStatement( + const io::DeclarationStatement* node) -> DeclarationStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) CallExpressionAST(); - ast->baseExpression = - decodeExpression(node->base_expression(), node->base_expression_type()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->expression_list()) { - auto* inserter = &ast->expressionList; - for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { - *inserter = new (pool_) List(decodeExpression( - node->expression_list()->Get(i), - io::Expression(node->expression_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) DeclarationStatementAST(); + ast->declaration = + decodeDeclaration(node->declaration(), node->declaration_type()); return ast; } -auto ASTDecoder::decodeTypeConstruction(const io::TypeConstruction* node) - -> TypeConstructionAST* { +auto ASTDecoder::decodeTryBlockStatement(const io::TryBlockStatement* node) + -> TryBlockStatementAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeConstructionAST(); - ast->typeSpecifier = - decodeSpecifier(node->type_specifier(), node->type_specifier_type()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->expression_list()) { - auto* inserter = &ast->expressionList; - for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { - *inserter = new (pool_) List(decodeExpression( - node->expression_list()->Get(i), - io::Expression(node->expression_list_type()->Get(i)))); + auto ast = new (pool_) TryBlockStatementAST(); + ast->tryLoc = SourceLocation(node->try_loc()); + ast->statement = decodeCompoundStatement(node->statement()); + if (node->handler_list()) { + auto* inserter = &ast->handlerList; + for (std::uint32_t i = 0; i < node->handler_list()->size(); ++i) { + *inserter = new (pool_) List(decodeHandler(node->handler_list()->Get(i))); inserter = &(*inserter)->next; } } - ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeBracedTypeConstruction( - const io::BracedTypeConstruction* node) -> BracedTypeConstructionAST* { +auto ASTDecoder::decodeGeneratedLiteralExpression( + const io::GeneratedLiteralExpression* node) + -> GeneratedLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BracedTypeConstructionAST(); - ast->typeSpecifier = - decodeSpecifier(node->type_specifier(), node->type_specifier_type()); - ast->bracedInitList = decodeBracedInitList(node->braced_init_list()); + auto ast = new (pool_) GeneratedLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); return ast; } -auto ASTDecoder::decodeSpliceMemberExpression( - const io::SpliceMemberExpression* node) -> SpliceMemberExpressionAST* { +auto ASTDecoder::decodeCharLiteralExpression( + const io::CharLiteralExpression* node) -> CharLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SpliceMemberExpressionAST(); - ast->baseExpression = - decodeExpression(node->base_expression(), node->base_expression_type()); - ast->accessLoc = SourceLocation(node->access_loc()); - ast->templateLoc = SourceLocation(node->template_loc()); - ast->splicer = decodeSplicer(node->splicer()); - ast->accessOp = static_cast(node->access_op()); + auto ast = new (pool_) CharLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + if (node->literal()) { + ast->literal = unit_->control()->charLiteral(node->literal()->str()); + } return ast; } -auto ASTDecoder::decodeMemberExpression(const io::MemberExpression* node) - -> MemberExpressionAST* { +auto ASTDecoder::decodeBoolLiteralExpression( + const io::BoolLiteralExpression* node) -> BoolLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) MemberExpressionAST(); - ast->baseExpression = - decodeExpression(node->base_expression(), node->base_expression_type()); - ast->accessLoc = SourceLocation(node->access_loc()); - ast->nestedNameSpecifier = decodeNestedNameSpecifier( - node->nested_name_specifier(), node->nested_name_specifier_type()); - ast->templateLoc = SourceLocation(node->template_loc()); - ast->unqualifiedId = - decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); - ast->accessOp = static_cast(node->access_op()); + auto ast = new (pool_) BoolLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); return ast; } -auto ASTDecoder::decodePostIncrExpression(const io::PostIncrExpression* node) - -> PostIncrExpressionAST* { +auto ASTDecoder::decodeIntLiteralExpression( + const io::IntLiteralExpression* node) -> IntLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) PostIncrExpressionAST(); - ast->baseExpression = - decodeExpression(node->base_expression(), node->base_expression_type()); - ast->opLoc = SourceLocation(node->op_loc()); - ast->op = static_cast(node->op()); + auto ast = new (pool_) IntLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + if (node->literal()) { + ast->literal = unit_->control()->integerLiteral(node->literal()->str()); + } return ast; } -auto ASTDecoder::decodeCppCastExpression(const io::CppCastExpression* node) - -> CppCastExpressionAST* { +auto ASTDecoder::decodeFloatLiteralExpression( + const io::FloatLiteralExpression* node) -> FloatLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) CppCastExpressionAST(); - ast->castLoc = SourceLocation(node->cast_loc()); - ast->lessLoc = SourceLocation(node->less_loc()); - ast->typeId = decodeTypeId(node->type_id()); - ast->greaterLoc = SourceLocation(node->greater_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) FloatLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + if (node->literal()) { + ast->literal = unit_->control()->floatLiteral(node->literal()->str()); + } return ast; } -auto ASTDecoder::decodeBuiltinBitCastExpression( - const io::BuiltinBitCastExpression* node) -> BuiltinBitCastExpressionAST* { +auto ASTDecoder::decodeNullptrLiteralExpression( + const io::NullptrLiteralExpression* node) -> NullptrLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BuiltinBitCastExpressionAST(); - ast->castLoc = SourceLocation(node->cast_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->typeId = decodeTypeId(node->type_id()); - ast->commaLoc = SourceLocation(node->comma_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) NullptrLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + ast->literal = static_cast(node->literal()); return ast; } -auto ASTDecoder::decodeBuiltinOffsetofExpression( - const io::BuiltinOffsetofExpression* node) - -> BuiltinOffsetofExpressionAST* { +auto ASTDecoder::decodeStringLiteralExpression( + const io::StringLiteralExpression* node) -> StringLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BuiltinOffsetofExpressionAST(); - ast->offsetofLoc = SourceLocation(node->offsetof_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->typeId = decodeTypeId(node->type_id()); - ast->commaLoc = SourceLocation(node->comma_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) StringLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + if (node->literal()) { + ast->literal = unit_->control()->stringLiteral(node->literal()->str()); + } return ast; } -auto ASTDecoder::decodeTypeidExpression(const io::TypeidExpression* node) - -> TypeidExpressionAST* { +auto ASTDecoder::decodeUserDefinedStringLiteralExpression( + const io::UserDefinedStringLiteralExpression* node) + -> UserDefinedStringLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeidExpressionAST(); - ast->typeidLoc = SourceLocation(node->typeid_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) UserDefinedStringLiteralExpressionAST(); + ast->literalLoc = SourceLocation(node->literal_loc()); + if (node->literal()) { + ast->literal = unit_->control()->stringLiteral(node->literal()->str()); + } return ast; } -auto ASTDecoder::decodeTypeidOfTypeExpression( - const io::TypeidOfTypeExpression* node) -> TypeidOfTypeExpressionAST* { +auto ASTDecoder::decodeObjectLiteralExpression( + const io::ObjectLiteralExpression* node) -> ObjectLiteralExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeidOfTypeExpressionAST(); - ast->typeidLoc = SourceLocation(node->typeid_loc()); + auto ast = new (pool_) ObjectLiteralExpressionAST(); ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->typeId = decodeTypeId(node->type_id()); ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->bracedInitList = decodeBracedInitList(node->braced_init_list()); return ast; } -auto ASTDecoder::decodeSpliceExpression(const io::SpliceExpression* node) - -> SpliceExpressionAST* { - if (!node) return nullptr; - - auto ast = new (pool_) SpliceExpressionAST(); - ast->splicer = decodeSplicer(node->splicer()); - return ast; -} - -auto ASTDecoder::decodeGlobalScopeReflectExpression( - const io::GlobalScopeReflectExpression* node) - -> GlobalScopeReflectExpressionAST* { +auto ASTDecoder::decodeThisExpression(const io::ThisExpression* node) + -> ThisExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) GlobalScopeReflectExpressionAST(); - ast->caretLoc = SourceLocation(node->caret_loc()); - ast->scopeLoc = SourceLocation(node->scope_loc()); + auto ast = new (pool_) ThisExpressionAST(); + ast->thisLoc = SourceLocation(node->this_loc()); return ast; } -auto ASTDecoder::decodeNamespaceReflectExpression( - const io::NamespaceReflectExpression* node) - -> NamespaceReflectExpressionAST* { +auto ASTDecoder::decodeGenericSelectionExpression( + const io::GenericSelectionExpression* node) + -> GenericSelectionExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) NamespaceReflectExpressionAST(); - ast->caretLoc = SourceLocation(node->caret_loc()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); + auto ast = new (pool_) GenericSelectionExpressionAST(); + ast->genericLoc = SourceLocation(node->generic_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->commaLoc = SourceLocation(node->comma_loc()); + if (node->generic_association_list()) { + auto* inserter = &ast->genericAssociationList; + for (std::uint32_t i = 0; i < node->generic_association_list()->size(); + ++i) { + *inserter = new (pool_) List(decodeGenericAssociation( + node->generic_association_list()->Get(i), + io::GenericAssociation( + node->generic_association_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } } + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeTypeIdReflectExpression( - const io::TypeIdReflectExpression* node) -> TypeIdReflectExpressionAST* { +auto ASTDecoder::decodeNestedStatementExpression( + const io::NestedStatementExpression* node) + -> NestedStatementExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeIdReflectExpressionAST(); - ast->caretLoc = SourceLocation(node->caret_loc()); - ast->typeId = decodeTypeId(node->type_id()); + auto ast = new (pool_) NestedStatementExpressionAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->statement = decodeCompoundStatement(node->statement()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeReflectExpression(const io::ReflectExpression* node) - -> ReflectExpressionAST* { +auto ASTDecoder::decodeNestedExpression(const io::NestedExpression* node) + -> NestedExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ReflectExpressionAST(); - ast->caretLoc = SourceLocation(node->caret_loc()); + auto ast = new (pool_) NestedExpressionAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeLabelAddressExpression( - const io::LabelAddressExpression* node) -> LabelAddressExpressionAST* { +auto ASTDecoder::decodeIdExpression(const io::IdExpression* node) + -> IdExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) LabelAddressExpressionAST(); - ast->ampAmpLoc = SourceLocation(node->amp_amp_loc()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + auto ast = new (pool_) IdExpressionAST(); + ast->nestedNameSpecifier = decodeNestedNameSpecifier( + node->nested_name_specifier(), node->nested_name_specifier_type()); + ast->templateLoc = SourceLocation(node->template_loc()); + ast->unqualifiedId = + decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); return ast; } -auto ASTDecoder::decodeUnaryExpression(const io::UnaryExpression* node) - -> UnaryExpressionAST* { +auto ASTDecoder::decodeLambdaExpression(const io::LambdaExpression* node) + -> LambdaExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) UnaryExpressionAST(); - ast->opLoc = SourceLocation(node->op_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->op = static_cast(node->op()); + auto ast = new (pool_) LambdaExpressionAST(); + ast->lbracketLoc = SourceLocation(node->lbracket_loc()); + ast->captureDefaultLoc = SourceLocation(node->capture_default_loc()); + if (node->capture_list()) { + auto* inserter = &ast->captureList; + for (std::uint32_t i = 0; i < node->capture_list()->size(); ++i) { + *inserter = new (pool_) List(decodeLambdaCapture( + node->capture_list()->Get(i), + io::LambdaCapture(node->capture_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->rbracketLoc = SourceLocation(node->rbracket_loc()); + ast->lessLoc = SourceLocation(node->less_loc()); + if (node->template_parameter_list()) { + auto* inserter = &ast->templateParameterList; + for (std::uint32_t i = 0; i < node->template_parameter_list()->size(); + ++i) { + *inserter = new (pool_) List(decodeTemplateParameter( + node->template_parameter_list()->Get(i), + io::TemplateParameter(node->template_parameter_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->greaterLoc = SourceLocation(node->greater_loc()); + ast->templateRequiresClause = + decodeRequiresClause(node->template_requires_clause()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->parameterDeclarationClause = + decodeParameterDeclarationClause(node->parameter_declaration_clause()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + if (node->gnu_atribute_list()) { + auto* inserter = &ast->gnuAtributeList; + for (std::uint32_t i = 0; i < node->gnu_atribute_list()->size(); ++i) { + *inserter = new (pool_) List(decodeAttributeSpecifier( + node->gnu_atribute_list()->Get(i), + io::AttributeSpecifier(node->gnu_atribute_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + if (node->lambda_specifier_list()) { + auto* inserter = &ast->lambdaSpecifierList; + for (std::uint32_t i = 0; i < node->lambda_specifier_list()->size(); ++i) { + *inserter = new (pool_) + List(decodeLambdaSpecifier(node->lambda_specifier_list()->Get(i))); + inserter = &(*inserter)->next; + } + } + ast->exceptionSpecifier = decodeExceptionSpecifier( + node->exception_specifier(), node->exception_specifier_type()); + if (node->attribute_list()) { + auto* inserter = &ast->attributeList; + for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { + *inserter = new (pool_) List(decodeAttributeSpecifier( + node->attribute_list()->Get(i), + io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->trailingReturnType = + decodeTrailingReturnType(node->trailing_return_type()); + ast->requiresClause = decodeRequiresClause(node->requires_clause()); + ast->statement = decodeCompoundStatement(node->statement()); + ast->captureDefault = static_cast(node->capture_default()); return ast; } -auto ASTDecoder::decodeAwaitExpression(const io::AwaitExpression* node) - -> AwaitExpressionAST* { +auto ASTDecoder::decodeFoldExpression(const io::FoldExpression* node) + -> FoldExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) AwaitExpressionAST(); - ast->awaitLoc = SourceLocation(node->await_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + auto ast = new (pool_) FoldExpressionAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->leftExpression = + decodeExpression(node->left_expression(), node->left_expression_type()); + ast->opLoc = SourceLocation(node->op_loc()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->foldOpLoc = SourceLocation(node->fold_op_loc()); + ast->rightExpression = + decodeExpression(node->right_expression(), node->right_expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->op = static_cast(node->op()); + ast->foldOp = static_cast(node->fold_op()); return ast; } -auto ASTDecoder::decodeSizeofExpression(const io::SizeofExpression* node) - -> SizeofExpressionAST* { +auto ASTDecoder::decodeRightFoldExpression(const io::RightFoldExpression* node) + -> RightFoldExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SizeofExpressionAST(); - ast->sizeofLoc = SourceLocation(node->sizeof_loc()); + auto ast = new (pool_) RightFoldExpressionAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); + ast->opLoc = SourceLocation(node->op_loc()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeSizeofTypeExpression( - const io::SizeofTypeExpression* node) -> SizeofTypeExpressionAST* { +auto ASTDecoder::decodeLeftFoldExpression(const io::LeftFoldExpression* node) + -> LeftFoldExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SizeofTypeExpressionAST(); - ast->sizeofLoc = SourceLocation(node->sizeof_loc()); + auto ast = new (pool_) LeftFoldExpressionAST(); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->typeId = decodeTypeId(node->type_id()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->opLoc = SourceLocation(node->op_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeSizeofPackExpression( - const io::SizeofPackExpression* node) -> SizeofPackExpressionAST* { +auto ASTDecoder::decodeRequiresExpression(const io::RequiresExpression* node) + -> RequiresExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SizeofPackExpressionAST(); - ast->sizeofLoc = SourceLocation(node->sizeof_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + auto ast = new (pool_) RequiresExpressionAST(); + ast->requiresLoc = SourceLocation(node->requires_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->parameterDeclarationClause = + decodeParameterDeclarationClause(node->parameter_declaration_clause()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); + ast->lbraceLoc = SourceLocation(node->lbrace_loc()); + if (node->requirement_list()) { + auto* inserter = &ast->requirementList; + for (std::uint32_t i = 0; i < node->requirement_list()->size(); ++i) { + *inserter = new (pool_) List(decodeRequirement( + node->requirement_list()->Get(i), + io::Requirement(node->requirement_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } } + ast->rbraceLoc = SourceLocation(node->rbrace_loc()); return ast; } -auto ASTDecoder::decodeAlignofTypeExpression( - const io::AlignofTypeExpression* node) -> AlignofTypeExpressionAST* { +auto ASTDecoder::decodeVaArgExpression(const io::VaArgExpression* node) + -> VaArgExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) AlignofTypeExpressionAST(); - ast->alignofLoc = SourceLocation(node->alignof_loc()); + auto ast = new (pool_) VaArgExpressionAST(); + ast->vaArgLoc = SourceLocation(node->va_arg_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->commaLoc = SourceLocation(node->comma_loc()); ast->typeId = decodeTypeId(node->type_id()); ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeAlignofExpression(const io::AlignofExpression* node) - -> AlignofExpressionAST* { +auto ASTDecoder::decodeSubscriptExpression(const io::SubscriptExpression* node) + -> SubscriptExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) AlignofExpressionAST(); - ast->alignofLoc = SourceLocation(node->alignof_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + auto ast = new (pool_) SubscriptExpressionAST(); + ast->baseExpression = + decodeExpression(node->base_expression(), node->base_expression_type()); + ast->lbracketLoc = SourceLocation(node->lbracket_loc()); + ast->indexExpression = + decodeExpression(node->index_expression(), node->index_expression_type()); + ast->rbracketLoc = SourceLocation(node->rbracket_loc()); return ast; } -auto ASTDecoder::decodeNoexceptExpression(const io::NoexceptExpression* node) - -> NoexceptExpressionAST* { +auto ASTDecoder::decodeCallExpression(const io::CallExpression* node) + -> CallExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) NoexceptExpressionAST(); - ast->noexceptLoc = SourceLocation(node->noexcept_loc()); + auto ast = new (pool_) CallExpressionAST(); + ast->baseExpression = + decodeExpression(node->base_expression(), node->base_expression_type()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + if (node->expression_list()) { + auto* inserter = &ast->expressionList; + for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { + *inserter = new (pool_) List(decodeExpression( + node->expression_list()->Get(i), + io::Expression(node->expression_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeNewExpression(const io::NewExpression* node) - -> NewExpressionAST* { +auto ASTDecoder::decodeTypeConstruction(const io::TypeConstruction* node) + -> TypeConstructionAST* { if (!node) return nullptr; - auto ast = new (pool_) NewExpressionAST(); - ast->scopeLoc = SourceLocation(node->scope_loc()); - ast->newLoc = SourceLocation(node->new_loc()); - ast->newPlacement = decodeNewPlacement(node->new_placement()); + auto ast = new (pool_) TypeConstructionAST(); + ast->typeSpecifier = + decodeSpecifier(node->type_specifier(), node->type_specifier_type()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->type_specifier_list()) { - auto* inserter = &ast->typeSpecifierList; - for (std::uint32_t i = 0; i < node->type_specifier_list()->size(); ++i) { - *inserter = new (pool_) List(decodeSpecifier( - node->type_specifier_list()->Get(i), - io::Specifier(node->type_specifier_list_type()->Get(i)))); + if (node->expression_list()) { + auto* inserter = &ast->expressionList; + for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { + *inserter = new (pool_) List(decodeExpression( + node->expression_list()->Get(i), + io::Expression(node->expression_list_type()->Get(i)))); inserter = &(*inserter)->next; } } - ast->declarator = decodeDeclarator(node->declarator()); ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->newInitalizer = - decodeNewInitializer(node->new_initalizer(), node->new_initalizer_type()); return ast; } -auto ASTDecoder::decodeDeleteExpression(const io::DeleteExpression* node) - -> DeleteExpressionAST* { - if (!node) return nullptr; - - auto ast = new (pool_) DeleteExpressionAST(); - ast->scopeLoc = SourceLocation(node->scope_loc()); - ast->deleteLoc = SourceLocation(node->delete_loc()); - ast->lbracketLoc = SourceLocation(node->lbracket_loc()); - ast->rbracketLoc = SourceLocation(node->rbracket_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); +auto ASTDecoder::decodeBracedTypeConstruction( + const io::BracedTypeConstruction* node) -> BracedTypeConstructionAST* { + if (!node) return nullptr; + + auto ast = new (pool_) BracedTypeConstructionAST(); + ast->typeSpecifier = + decodeSpecifier(node->type_specifier(), node->type_specifier_type()); + ast->bracedInitList = decodeBracedInitList(node->braced_init_list()); return ast; } -auto ASTDecoder::decodeCastExpression(const io::CastExpression* node) - -> CastExpressionAST* { +auto ASTDecoder::decodeSpliceMemberExpression( + const io::SpliceMemberExpression* node) -> SpliceMemberExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) CastExpressionAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->typeId = decodeTypeId(node->type_id()); - ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + auto ast = new (pool_) SpliceMemberExpressionAST(); + ast->baseExpression = + decodeExpression(node->base_expression(), node->base_expression_type()); + ast->accessLoc = SourceLocation(node->access_loc()); + ast->templateLoc = SourceLocation(node->template_loc()); + ast->splicer = decodeSplicer(node->splicer()); + ast->accessOp = static_cast(node->access_op()); return ast; } -auto ASTDecoder::decodeImplicitCastExpression( - const io::ImplicitCastExpression* node) -> ImplicitCastExpressionAST* { +auto ASTDecoder::decodeMemberExpression(const io::MemberExpression* node) + -> MemberExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ImplicitCastExpressionAST(); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); + auto ast = new (pool_) MemberExpressionAST(); + ast->baseExpression = + decodeExpression(node->base_expression(), node->base_expression_type()); + ast->accessLoc = SourceLocation(node->access_loc()); + ast->nestedNameSpecifier = decodeNestedNameSpecifier( + node->nested_name_specifier(), node->nested_name_specifier_type()); + ast->templateLoc = SourceLocation(node->template_loc()); + ast->unqualifiedId = + decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); + ast->accessOp = static_cast(node->access_op()); return ast; } -auto ASTDecoder::decodeBinaryExpression(const io::BinaryExpression* node) - -> BinaryExpressionAST* { +auto ASTDecoder::decodePostIncrExpression(const io::PostIncrExpression* node) + -> PostIncrExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BinaryExpressionAST(); - ast->leftExpression = - decodeExpression(node->left_expression(), node->left_expression_type()); + auto ast = new (pool_) PostIncrExpressionAST(); + ast->baseExpression = + decodeExpression(node->base_expression(), node->base_expression_type()); ast->opLoc = SourceLocation(node->op_loc()); - ast->rightExpression = - decodeExpression(node->right_expression(), node->right_expression_type()); ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeConditionalExpression( - const io::ConditionalExpression* node) -> ConditionalExpressionAST* { +auto ASTDecoder::decodeCppCastExpression(const io::CppCastExpression* node) + -> CppCastExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ConditionalExpressionAST(); - ast->condition = decodeExpression(node->condition(), node->condition_type()); - ast->questionLoc = SourceLocation(node->question_loc()); - ast->iftrueExpression = decodeExpression(node->iftrue_expression(), - node->iftrue_expression_type()); - ast->colonLoc = SourceLocation(node->colon_loc()); - ast->iffalseExpression = decodeExpression(node->iffalse_expression(), - node->iffalse_expression_type()); + auto ast = new (pool_) CppCastExpressionAST(); + ast->castLoc = SourceLocation(node->cast_loc()); + ast->lessLoc = SourceLocation(node->less_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->greaterLoc = SourceLocation(node->greater_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeYieldExpression(const io::YieldExpression* node) - -> YieldExpressionAST* { +auto ASTDecoder::decodeBuiltinBitCastExpression( + const io::BuiltinBitCastExpression* node) -> BuiltinBitCastExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) YieldExpressionAST(); - ast->yieldLoc = SourceLocation(node->yield_loc()); + auto ast = new (pool_) BuiltinBitCastExpressionAST(); + ast->castLoc = SourceLocation(node->cast_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->commaLoc = SourceLocation(node->comma_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeThrowExpression(const io::ThrowExpression* node) - -> ThrowExpressionAST* { +auto ASTDecoder::decodeBuiltinOffsetofExpression( + const io::BuiltinOffsetofExpression* node) + -> BuiltinOffsetofExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ThrowExpressionAST(); - ast->throwLoc = SourceLocation(node->throw_loc()); + auto ast = new (pool_) BuiltinOffsetofExpressionAST(); + ast->offsetofLoc = SourceLocation(node->offsetof_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->commaLoc = SourceLocation(node->comma_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeAssignmentExpression( - const io::AssignmentExpression* node) -> AssignmentExpressionAST* { +auto ASTDecoder::decodeTypeidExpression(const io::TypeidExpression* node) + -> TypeidExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) AssignmentExpressionAST(); - ast->leftExpression = - decodeExpression(node->left_expression(), node->left_expression_type()); - ast->opLoc = SourceLocation(node->op_loc()); - ast->rightExpression = - decodeExpression(node->right_expression(), node->right_expression_type()); - ast->op = static_cast(node->op()); + auto ast = new (pool_) TypeidExpressionAST(); + ast->typeidLoc = SourceLocation(node->typeid_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodePackExpansionExpression( - const io::PackExpansionExpression* node) -> PackExpansionExpressionAST* { +auto ASTDecoder::decodeTypeidOfTypeExpression( + const io::TypeidOfTypeExpression* node) -> TypeidOfTypeExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) PackExpansionExpressionAST(); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + auto ast = new (pool_) TypeidOfTypeExpressionAST(); + ast->typeidLoc = SourceLocation(node->typeid_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeDesignatedInitializerClause( - const io::DesignatedInitializerClause* node) - -> DesignatedInitializerClauseAST* { +auto ASTDecoder::decodeSpliceExpression(const io::SpliceExpression* node) + -> SpliceExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) DesignatedInitializerClauseAST(); - if (node->designator_list()) { - auto* inserter = &ast->designatorList; - for (std::uint32_t i = 0; i < node->designator_list()->size(); ++i) { - *inserter = new (pool_) List(decodeDesignator( - node->designator_list()->Get(i), - io::Designator(node->designator_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->initializer = - decodeExpression(node->initializer(), node->initializer_type()); + auto ast = new (pool_) SpliceExpressionAST(); + ast->splicer = decodeSplicer(node->splicer()); return ast; } -auto ASTDecoder::decodeTypeTraitExpression(const io::TypeTraitExpression* node) - -> TypeTraitExpressionAST* { +auto ASTDecoder::decodeGlobalScopeReflectExpression( + const io::GlobalScopeReflectExpression* node) + -> GlobalScopeReflectExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeTraitExpressionAST(); - ast->typeTraitLoc = SourceLocation(node->type_trait_loc()); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->type_id_list()) { - auto* inserter = &ast->typeIdList; - for (std::uint32_t i = 0; i < node->type_id_list()->size(); ++i) { - *inserter = new (pool_) List(decodeTypeId(node->type_id_list()->Get(i))); - inserter = &(*inserter)->next; - } - } - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) GlobalScopeReflectExpressionAST(); + ast->caretLoc = SourceLocation(node->caret_loc()); + ast->scopeLoc = SourceLocation(node->scope_loc()); return ast; } -auto ASTDecoder::decodeConditionExpression(const io::ConditionExpression* node) - -> ConditionExpressionAST* { +auto ASTDecoder::decodeNamespaceReflectExpression( + const io::NamespaceReflectExpression* node) + -> NamespaceReflectExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ConditionExpressionAST(); - if (node->attribute_list()) { - auto* inserter = &ast->attributeList; - for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { - *inserter = new (pool_) List(decodeAttributeSpecifier( - node->attribute_list()->Get(i), - io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - if (node->decl_specifier_list()) { - auto* inserter = &ast->declSpecifierList; - for (std::uint32_t i = 0; i < node->decl_specifier_list()->size(); ++i) { - *inserter = new (pool_) List(decodeSpecifier( - node->decl_specifier_list()->Get(i), - io::Specifier(node->decl_specifier_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } + auto ast = new (pool_) NamespaceReflectExpressionAST(); + ast->caretLoc = SourceLocation(node->caret_loc()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); } - ast->declarator = decodeDeclarator(node->declarator()); - ast->initializer = - decodeExpression(node->initializer(), node->initializer_type()); return ast; } -auto ASTDecoder::decodeEqualInitializer(const io::EqualInitializer* node) - -> EqualInitializerAST* { +auto ASTDecoder::decodeTypeIdReflectExpression( + const io::TypeIdReflectExpression* node) -> TypeIdReflectExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) EqualInitializerAST(); - ast->equalLoc = SourceLocation(node->equal_loc()); + auto ast = new (pool_) TypeIdReflectExpressionAST(); + ast->caretLoc = SourceLocation(node->caret_loc()); + ast->typeId = decodeTypeId(node->type_id()); + return ast; +} + +auto ASTDecoder::decodeReflectExpression(const io::ReflectExpression* node) + -> ReflectExpressionAST* { + if (!node) return nullptr; + + auto ast = new (pool_) ReflectExpressionAST(); + ast->caretLoc = SourceLocation(node->caret_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeBracedInitList(const io::BracedInitList* node) - -> BracedInitListAST* { +auto ASTDecoder::decodeLabelAddressExpression( + const io::LabelAddressExpression* node) -> LabelAddressExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BracedInitListAST(); - ast->lbraceLoc = SourceLocation(node->lbrace_loc()); - if (node->expression_list()) { - auto* inserter = &ast->expressionList; - for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { - *inserter = new (pool_) List(decodeExpression( - node->expression_list()->Get(i), - io::Expression(node->expression_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } + auto ast = new (pool_) LabelAddressExpressionAST(); + ast->ampAmpLoc = SourceLocation(node->amp_amp_loc()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); } - ast->commaLoc = SourceLocation(node->comma_loc()); - ast->rbraceLoc = SourceLocation(node->rbrace_loc()); return ast; } -auto ASTDecoder::decodeParenInitializer(const io::ParenInitializer* node) - -> ParenInitializerAST* { +auto ASTDecoder::decodeUnaryExpression(const io::UnaryExpression* node) + -> UnaryExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ParenInitializerAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->expression_list()) { - auto* inserter = &ast->expressionList; - for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { - *inserter = new (pool_) List(decodeExpression( - node->expression_list()->Get(i), - io::Expression(node->expression_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->rparenLoc = SourceLocation(node->rparen_loc()); + auto ast = new (pool_) UnaryExpressionAST(); + ast->opLoc = SourceLocation(node->op_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeDefaultGenericAssociation( - const io::DefaultGenericAssociation* node) - -> DefaultGenericAssociationAST* { +auto ASTDecoder::decodeAwaitExpression(const io::AwaitExpression* node) + -> AwaitExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) DefaultGenericAssociationAST(); - ast->defaultLoc = SourceLocation(node->default_loc()); - ast->colonLoc = SourceLocation(node->colon_loc()); + auto ast = new (pool_) AwaitExpressionAST(); + ast->awaitLoc = SourceLocation(node->await_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeTypeGenericAssociation( - const io::TypeGenericAssociation* node) -> TypeGenericAssociationAST* { +auto ASTDecoder::decodeSizeofExpression(const io::SizeofExpression* node) + -> SizeofExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeGenericAssociationAST(); - ast->typeId = decodeTypeId(node->type_id()); - ast->colonLoc = SourceLocation(node->colon_loc()); + auto ast = new (pool_) SizeofExpressionAST(); + ast->sizeofLoc = SourceLocation(node->sizeof_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeDotDesignator(const io::DotDesignator* node) - -> DotDesignatorAST* { +auto ASTDecoder::decodeSizeofTypeExpression( + const io::SizeofTypeExpression* node) -> SizeofTypeExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) DotDesignatorAST(); - ast->dotLoc = SourceLocation(node->dot_loc()); + auto ast = new (pool_) SizeofTypeExpressionAST(); + ast->sizeofLoc = SourceLocation(node->sizeof_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + return ast; +} + +auto ASTDecoder::decodeSizeofPackExpression( + const io::SizeofPackExpression* node) -> SizeofPackExpressionAST* { + if (!node) return nullptr; + + auto ast = new (pool_) SizeofPackExpressionAST(); + ast->sizeofLoc = SourceLocation(node->sizeof_loc()); + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->identifierLoc = SourceLocation(node->identifier_loc()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); if (node->identifier()) { ast->identifier = unit_->control()->getIdentifier(node->identifier()->str()); @@ -2810,258 +2878,223 @@ auto ASTDecoder::decodeDotDesignator(const io::DotDesignator* node) return ast; } -auto ASTDecoder::decodeSubscriptDesignator(const io::SubscriptDesignator* node) - -> SubscriptDesignatorAST* { +auto ASTDecoder::decodeAlignofTypeExpression( + const io::AlignofTypeExpression* node) -> AlignofTypeExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SubscriptDesignatorAST(); - ast->lbracketLoc = SourceLocation(node->lbracket_loc()); - ast->expression = - decodeExpression(node->expression(), node->expression_type()); - ast->rbracketLoc = SourceLocation(node->rbracket_loc()); + auto ast = new (pool_) AlignofTypeExpressionAST(); + ast->alignofLoc = SourceLocation(node->alignof_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeSplicer(const io::Splicer* node) -> SplicerAST* { +auto ASTDecoder::decodeAlignofExpression(const io::AlignofExpression* node) + -> AlignofExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) SplicerAST(); - ast->lbracketLoc = SourceLocation(node->lbracket_loc()); - ast->colonLoc = SourceLocation(node->colon_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + auto ast = new (pool_) AlignofExpressionAST(); + ast->alignofLoc = SourceLocation(node->alignof_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); - ast->secondColonLoc = SourceLocation(node->second_colon_loc()); - ast->rbracketLoc = SourceLocation(node->rbracket_loc()); return ast; } -auto ASTDecoder::decodeGlobalModuleFragment( - const io::GlobalModuleFragment* node) -> GlobalModuleFragmentAST* { +auto ASTDecoder::decodeNoexceptExpression(const io::NoexceptExpression* node) + -> NoexceptExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) GlobalModuleFragmentAST(); - ast->moduleLoc = SourceLocation(node->module_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); - if (node->declaration_list()) { - auto* inserter = &ast->declarationList; - for (std::uint32_t i = 0; i < node->declaration_list()->size(); ++i) { - *inserter = new (pool_) List(decodeDeclaration( - node->declaration_list()->Get(i), - io::Declaration(node->declaration_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } + auto ast = new (pool_) NoexceptExpressionAST(); + ast->noexceptLoc = SourceLocation(node->noexcept_loc()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodePrivateModuleFragment( - const io::PrivateModuleFragment* node) -> PrivateModuleFragmentAST* { +auto ASTDecoder::decodeNewExpression(const io::NewExpression* node) + -> NewExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) PrivateModuleFragmentAST(); - ast->moduleLoc = SourceLocation(node->module_loc()); - ast->colonLoc = SourceLocation(node->colon_loc()); - ast->privateLoc = SourceLocation(node->private_loc()); - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); - if (node->declaration_list()) { - auto* inserter = &ast->declarationList; - for (std::uint32_t i = 0; i < node->declaration_list()->size(); ++i) { - *inserter = new (pool_) List(decodeDeclaration( - node->declaration_list()->Get(i), - io::Declaration(node->declaration_list_type()->Get(i)))); + auto ast = new (pool_) NewExpressionAST(); + ast->scopeLoc = SourceLocation(node->scope_loc()); + ast->newLoc = SourceLocation(node->new_loc()); + ast->newPlacement = decodeNewPlacement(node->new_placement()); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + if (node->type_specifier_list()) { + auto* inserter = &ast->typeSpecifierList; + for (std::uint32_t i = 0; i < node->type_specifier_list()->size(); ++i) { + *inserter = new (pool_) List(decodeSpecifier( + node->type_specifier_list()->Get(i), + io::Specifier(node->type_specifier_list_type()->Get(i)))); inserter = &(*inserter)->next; } } + ast->declarator = decodeDeclarator(node->declarator()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->newInitalizer = + decodeNewInitializer(node->new_initalizer(), node->new_initalizer_type()); return ast; } -auto ASTDecoder::decodeModuleDeclaration(const io::ModuleDeclaration* node) - -> ModuleDeclarationAST* { +auto ASTDecoder::decodeDeleteExpression(const io::DeleteExpression* node) + -> DeleteExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ModuleDeclarationAST(); - ast->exportLoc = SourceLocation(node->export_loc()); - ast->moduleLoc = SourceLocation(node->module_loc()); - ast->moduleName = decodeModuleName(node->module_name()); - ast->modulePartition = decodeModulePartition(node->module_partition()); - if (node->attribute_list()) { - auto* inserter = &ast->attributeList; - for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { - *inserter = new (pool_) List(decodeAttributeSpecifier( - node->attribute_list()->Get(i), - io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->semicolonLoc = SourceLocation(node->semicolon_loc()); + auto ast = new (pool_) DeleteExpressionAST(); + ast->scopeLoc = SourceLocation(node->scope_loc()); + ast->deleteLoc = SourceLocation(node->delete_loc()); + ast->lbracketLoc = SourceLocation(node->lbracket_loc()); + ast->rbracketLoc = SourceLocation(node->rbracket_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeModuleName(const io::ModuleName* node) - -> ModuleNameAST* { +auto ASTDecoder::decodeCastExpression(const io::CastExpression* node) + -> CastExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ModuleNameAST(); - ast->moduleQualifier = decodeModuleQualifier(node->module_qualifier()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + auto ast = new (pool_) CastExpressionAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + ast->typeId = decodeTypeId(node->type_id()); + ast->rparenLoc = SourceLocation(node->rparen_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeModuleQualifier(const io::ModuleQualifier* node) - -> ModuleQualifierAST* { +auto ASTDecoder::decodeImplicitCastExpression( + const io::ImplicitCastExpression* node) -> ImplicitCastExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ModuleQualifierAST(); - ast->moduleQualifier = decodeModuleQualifier(node->module_qualifier()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - ast->dotLoc = SourceLocation(node->dot_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + auto ast = new (pool_) ImplicitCastExpressionAST(); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeModulePartition(const io::ModulePartition* node) - -> ModulePartitionAST* { +auto ASTDecoder::decodeBinaryExpression(const io::BinaryExpression* node) + -> BinaryExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ModulePartitionAST(); - ast->colonLoc = SourceLocation(node->colon_loc()); - ast->moduleName = decodeModuleName(node->module_name()); + auto ast = new (pool_) BinaryExpressionAST(); + ast->leftExpression = + decodeExpression(node->left_expression(), node->left_expression_type()); + ast->opLoc = SourceLocation(node->op_loc()); + ast->rightExpression = + decodeExpression(node->right_expression(), node->right_expression_type()); + ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeImportName(const io::ImportName* node) - -> ImportNameAST* { +auto ASTDecoder::decodeConditionalExpression( + const io::ConditionalExpression* node) -> ConditionalExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) ImportNameAST(); - ast->headerLoc = SourceLocation(node->header_loc()); - ast->modulePartition = decodeModulePartition(node->module_partition()); - ast->moduleName = decodeModuleName(node->module_name()); + auto ast = new (pool_) ConditionalExpressionAST(); + ast->condition = decodeExpression(node->condition(), node->condition_type()); + ast->questionLoc = SourceLocation(node->question_loc()); + ast->iftrueExpression = decodeExpression(node->iftrue_expression(), + node->iftrue_expression_type()); + ast->colonLoc = SourceLocation(node->colon_loc()); + ast->iffalseExpression = decodeExpression(node->iffalse_expression(), + node->iffalse_expression_type()); return ast; } -auto ASTDecoder::decodeInitDeclarator(const io::InitDeclarator* node) - -> InitDeclaratorAST* { +auto ASTDecoder::decodeYieldExpression(const io::YieldExpression* node) + -> YieldExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) InitDeclaratorAST(); - ast->declarator = decodeDeclarator(node->declarator()); - ast->requiresClause = decodeRequiresClause(node->requires_clause()); - ast->initializer = - decodeExpression(node->initializer(), node->initializer_type()); + auto ast = new (pool_) YieldExpressionAST(); + ast->yieldLoc = SourceLocation(node->yield_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeDeclarator(const io::Declarator* node) - -> DeclaratorAST* { +auto ASTDecoder::decodeThrowExpression(const io::ThrowExpression* node) + -> ThrowExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) DeclaratorAST(); - if (node->ptr_op_list()) { - auto* inserter = &ast->ptrOpList; - for (std::uint32_t i = 0; i < node->ptr_op_list()->size(); ++i) { - *inserter = new (pool_) List( - decodePtrOperator(node->ptr_op_list()->Get(i), - io::PtrOperator(node->ptr_op_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->coreDeclarator = decodeCoreDeclarator(node->core_declarator(), - node->core_declarator_type()); - if (node->declarator_chunk_list()) { - auto* inserter = &ast->declaratorChunkList; - for (std::uint32_t i = 0; i < node->declarator_chunk_list()->size(); ++i) { - *inserter = new (pool_) List(decodeDeclaratorChunk( - node->declarator_chunk_list()->Get(i), - io::DeclaratorChunk(node->declarator_chunk_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } + auto ast = new (pool_) ThrowExpressionAST(); + ast->throwLoc = SourceLocation(node->throw_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } - -auto ASTDecoder::decodeUsingDeclarator(const io::UsingDeclarator* node) - -> UsingDeclaratorAST* { + +auto ASTDecoder::decodeAssignmentExpression( + const io::AssignmentExpression* node) -> AssignmentExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) UsingDeclaratorAST(); - ast->typenameLoc = SourceLocation(node->typename_loc()); - ast->nestedNameSpecifier = decodeNestedNameSpecifier( - node->nested_name_specifier(), node->nested_name_specifier_type()); - ast->unqualifiedId = - decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + auto ast = new (pool_) AssignmentExpressionAST(); + ast->leftExpression = + decodeExpression(node->left_expression(), node->left_expression_type()); + ast->opLoc = SourceLocation(node->op_loc()); + ast->rightExpression = + decodeExpression(node->right_expression(), node->right_expression_type()); + ast->op = static_cast(node->op()); return ast; } -auto ASTDecoder::decodeEnumerator(const io::Enumerator* node) - -> EnumeratorAST* { +auto ASTDecoder::decodePackExpansionExpression( + const io::PackExpansionExpression* node) -> PackExpansionExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) EnumeratorAST(); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - if (node->attribute_list()) { - auto* inserter = &ast->attributeList; - for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { - *inserter = new (pool_) List(decodeAttributeSpecifier( - node->attribute_list()->Get(i), - io::AttributeSpecifier(node->attribute_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } - } - ast->equalLoc = SourceLocation(node->equal_loc()); + auto ast = new (pool_) PackExpansionExpressionAST(); ast->expression = decodeExpression(node->expression(), node->expression_type()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); return ast; } -auto ASTDecoder::decodeTypeId(const io::TypeId* node) -> TypeIdAST* { +auto ASTDecoder::decodeDesignatedInitializerClause( + const io::DesignatedInitializerClause* node) + -> DesignatedInitializerClauseAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeIdAST(); - if (node->type_specifier_list()) { - auto* inserter = &ast->typeSpecifierList; - for (std::uint32_t i = 0; i < node->type_specifier_list()->size(); ++i) { - *inserter = new (pool_) List(decodeSpecifier( - node->type_specifier_list()->Get(i), - io::Specifier(node->type_specifier_list_type()->Get(i)))); + auto ast = new (pool_) DesignatedInitializerClauseAST(); + if (node->designator_list()) { + auto* inserter = &ast->designatorList; + for (std::uint32_t i = 0; i < node->designator_list()->size(); ++i) { + *inserter = new (pool_) List(decodeDesignator( + node->designator_list()->Get(i), + io::Designator(node->designator_list_type()->Get(i)))); inserter = &(*inserter)->next; } } - ast->declarator = decodeDeclarator(node->declarator()); + ast->initializer = + decodeExpression(node->initializer(), node->initializer_type()); return ast; } -auto ASTDecoder::decodeHandler(const io::Handler* node) -> HandlerAST* { +auto ASTDecoder::decodeTypeTraitExpression(const io::TypeTraitExpression* node) + -> TypeTraitExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) HandlerAST(); - ast->catchLoc = SourceLocation(node->catch_loc()); + auto ast = new (pool_) TypeTraitExpressionAST(); + ast->typeTraitLoc = SourceLocation(node->type_trait_loc()); ast->lparenLoc = SourceLocation(node->lparen_loc()); - ast->exceptionDeclaration = decodeExceptionDeclaration( - node->exception_declaration(), node->exception_declaration_type()); + if (node->type_id_list()) { + auto* inserter = &ast->typeIdList; + for (std::uint32_t i = 0; i < node->type_id_list()->size(); ++i) { + *inserter = new (pool_) List(decodeTypeId(node->type_id_list()->Get(i))); + inserter = &(*inserter)->next; + } + } ast->rparenLoc = SourceLocation(node->rparen_loc()); - ast->statement = decodeCompoundStatement(node->statement()); return ast; } -auto ASTDecoder::decodeBaseSpecifier(const io::BaseSpecifier* node) - -> BaseSpecifierAST* { +auto ASTDecoder::decodeConditionExpression(const io::ConditionExpression* node) + -> ConditionExpressionAST* { if (!node) return nullptr; - auto ast = new (pool_) BaseSpecifierAST(); + auto ast = new (pool_) ConditionExpressionAST(); if (node->attribute_list()) { auto* inserter = &ast->attributeList; for (std::uint32_t i = 0; i < node->attribute_list()->size(); ++i) { @@ -3071,160 +3104,119 @@ auto ASTDecoder::decodeBaseSpecifier(const io::BaseSpecifier* node) inserter = &(*inserter)->next; } } - ast->virtualOrAccessLoc = SourceLocation(node->virtual_or_access_loc()); - ast->otherVirtualOrAccessLoc = - SourceLocation(node->other_virtual_or_access_loc()); - ast->nestedNameSpecifier = decodeNestedNameSpecifier( - node->nested_name_specifier(), node->nested_name_specifier_type()); - ast->templateLoc = SourceLocation(node->template_loc()); - ast->unqualifiedId = - decodeUnqualifiedId(node->unqualified_id(), node->unqualified_id_type()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); - ast->accessSpecifier = static_cast(node->access_specifier()); + if (node->decl_specifier_list()) { + auto* inserter = &ast->declSpecifierList; + for (std::uint32_t i = 0; i < node->decl_specifier_list()->size(); ++i) { + *inserter = new (pool_) List(decodeSpecifier( + node->decl_specifier_list()->Get(i), + io::Specifier(node->decl_specifier_list_type()->Get(i)))); + inserter = &(*inserter)->next; + } + } + ast->declarator = decodeDeclarator(node->declarator()); + ast->initializer = + decodeExpression(node->initializer(), node->initializer_type()); return ast; } -auto ASTDecoder::decodeRequiresClause(const io::RequiresClause* node) - -> RequiresClauseAST* { +auto ASTDecoder::decodeEqualInitializer(const io::EqualInitializer* node) + -> EqualInitializerAST* { if (!node) return nullptr; - auto ast = new (pool_) RequiresClauseAST(); - ast->requiresLoc = SourceLocation(node->requires_loc()); + auto ast = new (pool_) EqualInitializerAST(); + ast->equalLoc = SourceLocation(node->equal_loc()); ast->expression = decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeParameterDeclarationClause( - const io::ParameterDeclarationClause* node) - -> ParameterDeclarationClauseAST* { +auto ASTDecoder::decodeBracedInitList(const io::BracedInitList* node) + -> BracedInitListAST* { if (!node) return nullptr; - auto ast = new (pool_) ParameterDeclarationClauseAST(); - if (node->parameter_declaration_list()) { - auto* inserter = &ast->parameterDeclarationList; - for (std::uint32_t i = 0; i < node->parameter_declaration_list()->size(); - ++i) { - *inserter = new (pool_) List(decodeParameterDeclaration( - node->parameter_declaration_list()->Get(i))); + auto ast = new (pool_) BracedInitListAST(); + ast->lbraceLoc = SourceLocation(node->lbrace_loc()); + if (node->expression_list()) { + auto* inserter = &ast->expressionList; + for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { + *inserter = new (pool_) List(decodeExpression( + node->expression_list()->Get(i), + io::Expression(node->expression_list_type()->Get(i)))); inserter = &(*inserter)->next; } } ast->commaLoc = SourceLocation(node->comma_loc()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); - return ast; -} - -auto ASTDecoder::decodeTrailingReturnType(const io::TrailingReturnType* node) - -> TrailingReturnTypeAST* { - if (!node) return nullptr; - - auto ast = new (pool_) TrailingReturnTypeAST(); - ast->minusGreaterLoc = SourceLocation(node->minus_greater_loc()); - ast->typeId = decodeTypeId(node->type_id()); - return ast; -} - -auto ASTDecoder::decodeLambdaSpecifier(const io::LambdaSpecifier* node) - -> LambdaSpecifierAST* { - if (!node) return nullptr; - - auto ast = new (pool_) LambdaSpecifierAST(); - ast->specifierLoc = SourceLocation(node->specifier_loc()); - ast->specifier = static_cast(node->specifier()); + ast->rbraceLoc = SourceLocation(node->rbrace_loc()); return ast; } -auto ASTDecoder::decodeTypeConstraint(const io::TypeConstraint* node) - -> TypeConstraintAST* { +auto ASTDecoder::decodeParenInitializer(const io::ParenInitializer* node) + -> ParenInitializerAST* { if (!node) return nullptr; - auto ast = new (pool_) TypeConstraintAST(); - ast->nestedNameSpecifier = decodeNestedNameSpecifier( - node->nested_name_specifier(), node->nested_name_specifier_type()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - ast->lessLoc = SourceLocation(node->less_loc()); - if (node->template_argument_list()) { - auto* inserter = &ast->templateArgumentList; - for (std::uint32_t i = 0; i < node->template_argument_list()->size(); ++i) { - *inserter = new (pool_) List(decodeTemplateArgument( - node->template_argument_list()->Get(i), - io::TemplateArgument(node->template_argument_list_type()->Get(i)))); + auto ast = new (pool_) ParenInitializerAST(); + ast->lparenLoc = SourceLocation(node->lparen_loc()); + if (node->expression_list()) { + auto* inserter = &ast->expressionList; + for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { + *inserter = new (pool_) List(decodeExpression( + node->expression_list()->Get(i), + io::Expression(node->expression_list_type()->Get(i)))); inserter = &(*inserter)->next; } } - ast->greaterLoc = SourceLocation(node->greater_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } - return ast; -} - -auto ASTDecoder::decodeAttributeArgumentClause( - const io::AttributeArgumentClause* node) -> AttributeArgumentClauseAST* { - if (!node) return nullptr; - - auto ast = new (pool_) AttributeArgumentClauseAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeAttribute(const io::Attribute* node) -> AttributeAST* { +auto ASTDecoder::decodeDefaultGenericAssociation( + const io::DefaultGenericAssociation* node) + -> DefaultGenericAssociationAST* { if (!node) return nullptr; - auto ast = new (pool_) AttributeAST(); - ast->attributeToken = decodeAttributeToken(node->attribute_token(), - node->attribute_token_type()); - ast->attributeArgumentClause = - decodeAttributeArgumentClause(node->attribute_argument_clause()); - ast->ellipsisLoc = SourceLocation(node->ellipsis_loc()); + auto ast = new (pool_) DefaultGenericAssociationAST(); + ast->defaultLoc = SourceLocation(node->default_loc()); + ast->colonLoc = SourceLocation(node->colon_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeAttributeUsingPrefix( - const io::AttributeUsingPrefix* node) -> AttributeUsingPrefixAST* { +auto ASTDecoder::decodeTypeGenericAssociation( + const io::TypeGenericAssociation* node) -> TypeGenericAssociationAST* { if (!node) return nullptr; - auto ast = new (pool_) AttributeUsingPrefixAST(); - ast->usingLoc = SourceLocation(node->using_loc()); - ast->attributeNamespaceLoc = SourceLocation(node->attribute_namespace_loc()); + auto ast = new (pool_) TypeGenericAssociationAST(); + ast->typeId = decodeTypeId(node->type_id()); ast->colonLoc = SourceLocation(node->colon_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); return ast; } -auto ASTDecoder::decodeNewPlacement(const io::NewPlacement* node) - -> NewPlacementAST* { +auto ASTDecoder::decodeDotDesignator(const io::DotDesignator* node) + -> DotDesignatorAST* { if (!node) return nullptr; - auto ast = new (pool_) NewPlacementAST(); - ast->lparenLoc = SourceLocation(node->lparen_loc()); - if (node->expression_list()) { - auto* inserter = &ast->expressionList; - for (std::uint32_t i = 0; i < node->expression_list()->size(); ++i) { - *inserter = new (pool_) List(decodeExpression( - node->expression_list()->Get(i), - io::Expression(node->expression_list_type()->Get(i)))); - inserter = &(*inserter)->next; - } + auto ast = new (pool_) DotDesignatorAST(); + ast->dotLoc = SourceLocation(node->dot_loc()); + ast->identifierLoc = SourceLocation(node->identifier_loc()); + if (node->identifier()) { + ast->identifier = + unit_->control()->getIdentifier(node->identifier()->str()); } - ast->rparenLoc = SourceLocation(node->rparen_loc()); return ast; } -auto ASTDecoder::decodeNestedNamespaceSpecifier( - const io::NestedNamespaceSpecifier* node) -> NestedNamespaceSpecifierAST* { +auto ASTDecoder::decodeSubscriptDesignator(const io::SubscriptDesignator* node) + -> SubscriptDesignatorAST* { if (!node) return nullptr; - auto ast = new (pool_) NestedNamespaceSpecifierAST(); - ast->inlineLoc = SourceLocation(node->inline_loc()); - ast->identifierLoc = SourceLocation(node->identifier_loc()); - ast->scopeLoc = SourceLocation(node->scope_loc()); - if (node->identifier()) { - ast->identifier = - unit_->control()->getIdentifier(node->identifier()->str()); - } + auto ast = new (pool_) SubscriptDesignatorAST(); + ast->lbracketLoc = SourceLocation(node->lbracket_loc()); + ast->expression = + decodeExpression(node->expression(), node->expression_type()); + ast->rbracketLoc = SourceLocation(node->rbracket_loc()); return ast; } diff --git a/src/parser/cxx/flatbuffers/ast_encoder.cc b/src/parser/cxx/flatbuffers/ast_encoder.cc index 2b22d0d5..a67833f9 100644 --- a/src/parser/cxx/flatbuffers/ast_encoder.cc +++ b/src/parser/cxx/flatbuffers/ast_encoder.cc @@ -1364,7 +1364,6 @@ void ASTEncoder::visit(AsmOperandAST* ast) { } offset_ = builder.Finish().Union(); - type_ = io::Declaration_AsmOperand; } void ASTEncoder::visit(AsmQualifierAST* ast) { @@ -1373,7 +1372,6 @@ void ASTEncoder::visit(AsmQualifierAST* ast) { builder.add_qualifier(static_cast(ast->qualifier)); offset_ = builder.Finish().Union(); - type_ = io::Declaration_AsmQualifier; } void ASTEncoder::visit(AsmClobberAST* ast) { @@ -1394,7 +1392,6 @@ void ASTEncoder::visit(AsmClobberAST* ast) { } offset_ = builder.Finish().Union(); - type_ = io::Declaration_AsmClobber; } void ASTEncoder::visit(AsmGotoLabelAST* ast) { @@ -1415,303 +1412,271 @@ void ASTEncoder::visit(AsmGotoLabelAST* ast) { } offset_ = builder.Finish().Union(); - type_ = io::Declaration_AsmGotoLabel; } -void ASTEncoder::visit(LabeledStatementAST* ast) { - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } - - io::LabeledStatement::Builder builder{fbb_}; - builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_colon_loc(ast->colonLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); - } - - offset_ = builder.Finish().Union(); - type_ = io::Statement_LabeledStatement; -} - -void ASTEncoder::visit(CaseStatementAST* ast) { +void ASTEncoder::visit(SplicerAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::CaseStatement::Builder builder{fbb_}; - builder.add_case_loc(ast->caseLoc.index()); + io::Splicer::Builder builder{fbb_}; + builder.add_lbracket_loc(ast->lbracketLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_colon_loc(ast->colonLoc.index()); + builder.add_second_colon_loc(ast->secondColonLoc.index()); + builder.add_rbracket_loc(ast->rbracketLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Statement_CaseStatement; } -void ASTEncoder::visit(DefaultStatementAST* ast) { - io::DefaultStatement::Builder builder{fbb_}; - builder.add_default_loc(ast->defaultLoc.index()); - builder.add_colon_loc(ast->colonLoc.index()); +void ASTEncoder::visit(GlobalModuleFragmentAST* ast) { + std::vector> declarationListOffsets; + std::vector> declarationListTypes; - offset_ = builder.Finish().Union(); - type_ = io::Statement_DefaultStatement; -} + for (auto node : ListView{ast->declarationList}) { + if (!node) continue; + const auto [offset, type] = acceptDeclaration(node); + declarationListOffsets.push_back(offset); + declarationListTypes.push_back(type); + } -void ASTEncoder::visit(ExpressionStatementAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); + auto declarationListOffsetsVector = fbb_.CreateVector(declarationListOffsets); + auto declarationListTypesVector = fbb_.CreateVector(declarationListTypes); - io::ExpressionStatement::Builder builder{fbb_}; - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + io::GlobalModuleFragment::Builder builder{fbb_}; + builder.add_module_loc(ast->moduleLoc.index()); builder.add_semicolon_loc(ast->semicolonLoc.index()); + builder.add_declaration_list(declarationListOffsetsVector); + builder.add_declaration_list_type(declarationListTypesVector); offset_ = builder.Finish().Union(); - type_ = io::Statement_ExpressionStatement; } -void ASTEncoder::visit(CompoundStatementAST* ast) { - std::vector> statementListOffsets; - std::vector> statementListTypes; +void ASTEncoder::visit(PrivateModuleFragmentAST* ast) { + std::vector> declarationListOffsets; + std::vector> declarationListTypes; - for (auto node : ListView{ast->statementList}) { + for (auto node : ListView{ast->declarationList}) { if (!node) continue; - const auto [offset, type] = acceptStatement(node); - statementListOffsets.push_back(offset); - statementListTypes.push_back(type); + const auto [offset, type] = acceptDeclaration(node); + declarationListOffsets.push_back(offset); + declarationListTypes.push_back(type); } - auto statementListOffsetsVector = fbb_.CreateVector(statementListOffsets); - auto statementListTypesVector = fbb_.CreateVector(statementListTypes); + auto declarationListOffsetsVector = fbb_.CreateVector(declarationListOffsets); + auto declarationListTypesVector = fbb_.CreateVector(declarationListTypes); - io::CompoundStatement::Builder builder{fbb_}; - builder.add_lbrace_loc(ast->lbraceLoc.index()); - builder.add_statement_list(statementListOffsetsVector); - builder.add_statement_list_type(statementListTypesVector); - builder.add_rbrace_loc(ast->rbraceLoc.index()); + io::PrivateModuleFragment::Builder builder{fbb_}; + builder.add_module_loc(ast->moduleLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_private_loc(ast->privateLoc.index()); + builder.add_semicolon_loc(ast->semicolonLoc.index()); + builder.add_declaration_list(declarationListOffsetsVector); + builder.add_declaration_list_type(declarationListTypesVector); offset_ = builder.Finish().Union(); - type_ = io::Statement_CompoundStatement; } -void ASTEncoder::visit(IfStatementAST* ast) { - const auto [initializer, initializerType] = acceptStatement(ast->initializer); +void ASTEncoder::visit(ModuleDeclarationAST* ast) { + const auto moduleName = accept(ast->moduleName); - const auto [condition, conditionType] = acceptExpression(ast->condition); + const auto modulePartition = accept(ast->modulePartition); - const auto [statement, statementType] = acceptStatement(ast->statement); + std::vector> attributeListOffsets; + std::vector> + attributeListTypes; - const auto [elseStatement, elseStatementType] = - acceptStatement(ast->elseStatement); + for (auto node : ListView{ast->attributeList}) { + if (!node) continue; + const auto [offset, type] = acceptAttributeSpecifier(node); + attributeListOffsets.push_back(offset); + attributeListTypes.push_back(type); + } - io::IfStatement::Builder builder{fbb_}; - builder.add_if_loc(ast->ifLoc.index()); - builder.add_constexpr_loc(ast->constexprLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); - builder.add_condition(condition); - builder.add_condition_type(static_cast(conditionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); - builder.add_else_loc(ast->elseLoc.index()); - builder.add_else_statement(elseStatement); - builder.add_else_statement_type( - static_cast(elseStatementType)); + auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); + auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); + + io::ModuleDeclaration::Builder builder{fbb_}; + builder.add_export_loc(ast->exportLoc.index()); + builder.add_module_loc(ast->moduleLoc.index()); + builder.add_module_name(moduleName.o); + builder.add_module_partition(modulePartition.o); + builder.add_attribute_list(attributeListOffsetsVector); + builder.add_attribute_list_type(attributeListTypesVector); + builder.add_semicolon_loc(ast->semicolonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Statement_IfStatement; } -void ASTEncoder::visit(ConstevalIfStatementAST* ast) { - const auto [statement, statementType] = acceptStatement(ast->statement); +void ASTEncoder::visit(ModuleNameAST* ast) { + const auto moduleQualifier = accept(ast->moduleQualifier); - const auto [elseStatement, elseStatementType] = - acceptStatement(ast->elseStatement); + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } + } - io::ConstevalIfStatement::Builder builder{fbb_}; - builder.add_if_loc(ast->ifLoc.index()); - builder.add_exclaim_loc(ast->exclaimLoc.index()); - builder.add_constval_loc(ast->constvalLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); - builder.add_else_loc(ast->elseLoc.index()); - builder.add_else_statement(elseStatement); - builder.add_else_statement_type( - static_cast(elseStatementType)); + io::ModuleName::Builder builder{fbb_}; + builder.add_module_qualifier(moduleQualifier.o); + builder.add_identifier_loc(ast->identifierLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } offset_ = builder.Finish().Union(); - type_ = io::Statement_ConstevalIfStatement; } -void ASTEncoder::visit(SwitchStatementAST* ast) { - const auto [initializer, initializerType] = acceptStatement(ast->initializer); - - const auto [condition, conditionType] = acceptExpression(ast->condition); +void ASTEncoder::visit(ModuleQualifierAST* ast) { + const auto moduleQualifier = accept(ast->moduleQualifier); - const auto [statement, statementType] = acceptStatement(ast->statement); + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } + } - io::SwitchStatement::Builder builder{fbb_}; - builder.add_switch_loc(ast->switchLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); - builder.add_condition(condition); - builder.add_condition_type(static_cast(conditionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); + io::ModuleQualifier::Builder builder{fbb_}; + builder.add_module_qualifier(moduleQualifier.o); + builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_dot_loc(ast->dotLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } offset_ = builder.Finish().Union(); - type_ = io::Statement_SwitchStatement; } -void ASTEncoder::visit(WhileStatementAST* ast) { - const auto [condition, conditionType] = acceptExpression(ast->condition); - - const auto [statement, statementType] = acceptStatement(ast->statement); +void ASTEncoder::visit(ModulePartitionAST* ast) { + const auto moduleName = accept(ast->moduleName); - io::WhileStatement::Builder builder{fbb_}; - builder.add_while_loc(ast->whileLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_condition(condition); - builder.add_condition_type(static_cast(conditionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); + io::ModulePartition::Builder builder{fbb_}; + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_module_name(moduleName.o); offset_ = builder.Finish().Union(); - type_ = io::Statement_WhileStatement; } -void ASTEncoder::visit(DoStatementAST* ast) { - const auto [statement, statementType] = acceptStatement(ast->statement); +void ASTEncoder::visit(ImportNameAST* ast) { + const auto modulePartition = accept(ast->modulePartition); - const auto [expression, expressionType] = acceptExpression(ast->expression); + const auto moduleName = accept(ast->moduleName); - io::DoStatement::Builder builder{fbb_}; - builder.add_do_loc(ast->doLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); - builder.add_while_loc(ast->whileLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + io::ImportName::Builder builder{fbb_}; + builder.add_header_loc(ast->headerLoc.index()); + builder.add_module_partition(modulePartition.o); + builder.add_module_name(moduleName.o); offset_ = builder.Finish().Union(); - type_ = io::Statement_DoStatement; } -void ASTEncoder::visit(ForRangeStatementAST* ast) { - const auto [initializer, initializerType] = acceptStatement(ast->initializer); - - const auto [rangeDeclaration, rangeDeclarationType] = - acceptDeclaration(ast->rangeDeclaration); +void ASTEncoder::visit(InitDeclaratorAST* ast) { + const auto declarator = accept(ast->declarator); - const auto [rangeInitializer, rangeInitializerType] = - acceptExpression(ast->rangeInitializer); + const auto requiresClause = accept(ast->requiresClause); - const auto [statement, statementType] = acceptStatement(ast->statement); + const auto [initializer, initializerType] = + acceptExpression(ast->initializer); - io::ForRangeStatement::Builder builder{fbb_}; - builder.add_for_loc(ast->forLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); + io::InitDeclarator::Builder builder{fbb_}; + builder.add_declarator(declarator.o); + builder.add_requires_clause(requiresClause.o); builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); - builder.add_range_declaration(rangeDeclaration); - builder.add_range_declaration_type( - static_cast(rangeDeclarationType)); - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_range_initializer(rangeInitializer); - builder.add_range_initializer_type( - static_cast(rangeInitializerType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); + builder.add_initializer_type(static_cast(initializerType)); offset_ = builder.Finish().Union(); - type_ = io::Statement_ForRangeStatement; } -void ASTEncoder::visit(ForStatementAST* ast) { - const auto [initializer, initializerType] = acceptStatement(ast->initializer); - - const auto [condition, conditionType] = acceptExpression(ast->condition); +void ASTEncoder::visit(DeclaratorAST* ast) { + std::vector> ptrOpListOffsets; + std::vector> ptrOpListTypes; - const auto [expression, expressionType] = acceptExpression(ast->expression); + for (auto node : ListView{ast->ptrOpList}) { + if (!node) continue; + const auto [offset, type] = acceptPtrOperator(node); + ptrOpListOffsets.push_back(offset); + ptrOpListTypes.push_back(type); + } - const auto [statement, statementType] = acceptStatement(ast->statement); + auto ptrOpListOffsetsVector = fbb_.CreateVector(ptrOpListOffsets); + auto ptrOpListTypesVector = fbb_.CreateVector(ptrOpListTypes); - io::ForStatement::Builder builder{fbb_}; - builder.add_for_loc(ast->forLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); - builder.add_condition(condition); - builder.add_condition_type(static_cast(conditionType)); - builder.add_semicolon_loc(ast->semicolonLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement); - builder.add_statement_type(static_cast(statementType)); + const auto [coreDeclarator, coreDeclaratorType] = + acceptCoreDeclarator(ast->coreDeclarator); - offset_ = builder.Finish().Union(); - type_ = io::Statement_ForStatement; -} + std::vector> declaratorChunkListOffsets; + std::vector> + declaratorChunkListTypes; -void ASTEncoder::visit(BreakStatementAST* ast) { - io::BreakStatement::Builder builder{fbb_}; - builder.add_break_loc(ast->breakLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + for (auto node : ListView{ast->declaratorChunkList}) { + if (!node) continue; + const auto [offset, type] = acceptDeclaratorChunk(node); + declaratorChunkListOffsets.push_back(offset); + declaratorChunkListTypes.push_back(type); + } - offset_ = builder.Finish().Union(); - type_ = io::Statement_BreakStatement; -} + auto declaratorChunkListOffsetsVector = + fbb_.CreateVector(declaratorChunkListOffsets); + auto declaratorChunkListTypesVector = + fbb_.CreateVector(declaratorChunkListTypes); -void ASTEncoder::visit(ContinueStatementAST* ast) { - io::ContinueStatement::Builder builder{fbb_}; - builder.add_continue_loc(ast->continueLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + io::Declarator::Builder builder{fbb_}; + builder.add_ptr_op_list(ptrOpListOffsetsVector); + builder.add_ptr_op_list_type(ptrOpListTypesVector); + builder.add_core_declarator(coreDeclarator); + builder.add_core_declarator_type( + static_cast(coreDeclaratorType)); + builder.add_declarator_chunk_list(declaratorChunkListOffsetsVector); + builder.add_declarator_chunk_list_type(declaratorChunkListTypesVector); offset_ = builder.Finish().Union(); - type_ = io::Statement_ContinueStatement; } -void ASTEncoder::visit(ReturnStatementAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(UsingDeclaratorAST* ast) { + const auto [nestedNameSpecifier, nestedNameSpecifierType] = + acceptNestedNameSpecifier(ast->nestedNameSpecifier); - io::ReturnStatement::Builder builder{fbb_}; - builder.add_return_loc(ast->returnLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + const auto [unqualifiedId, unqualifiedIdType] = + acceptUnqualifiedId(ast->unqualifiedId); + + io::UsingDeclarator::Builder builder{fbb_}; + builder.add_typename_loc(ast->typenameLoc.index()); + builder.add_nested_name_specifier(nestedNameSpecifier); + builder.add_nested_name_specifier_type( + static_cast(nestedNameSpecifierType)); + builder.add_unqualified_id(unqualifiedId); + builder.add_unqualified_id_type( + static_cast(unqualifiedIdType)); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Statement_ReturnStatement; } -void ASTEncoder::visit(CoroutineReturnStatementAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(EnumeratorAST* ast) { + std::vector> attributeListOffsets; + std::vector> + attributeListTypes; - io::CoroutineReturnStatement::Builder builder{fbb_}; - builder.add_coreturn_loc(ast->coreturnLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + for (auto node : ListView{ast->attributeList}) { + if (!node) continue; + const auto [offset, type] = acceptAttributeSpecifier(node); + attributeListOffsets.push_back(offset); + attributeListTypes.push_back(type); + } - offset_ = builder.Finish().Union(); - type_ = io::Statement_CoroutineReturnStatement; -} + auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); + auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); + + const auto [expression, expressionType] = acceptExpression(ast->expression); -void ASTEncoder::visit(GotoStatementAST* ast) { flatbuffers::Offset identifier; if (ast->identifier) { if (identifiers_.contains(ast->identifier)) { @@ -1722,1310 +1687,1453 @@ void ASTEncoder::visit(GotoStatementAST* ast) { } } - io::GotoStatement::Builder builder{fbb_}; - builder.add_goto_loc(ast->gotoLoc.index()); - builder.add_star_loc(ast->starLoc.index()); + io::Enumerator::Builder builder{fbb_}; builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + builder.add_attribute_list(attributeListOffsetsVector); + builder.add_attribute_list_type(attributeListTypesVector); + builder.add_equal_loc(ast->equalLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); if (ast->identifier) { builder.add_identifier(identifier); } offset_ = builder.Finish().Union(); - type_ = io::Statement_GotoStatement; -} - -void ASTEncoder::visit(DeclarationStatementAST* ast) { - const auto [declaration, declarationType] = - acceptDeclaration(ast->declaration); - - io::DeclarationStatement::Builder builder{fbb_}; - builder.add_declaration(declaration); - builder.add_declaration_type(static_cast(declarationType)); - - offset_ = builder.Finish().Union(); - type_ = io::Statement_DeclarationStatement; } -void ASTEncoder::visit(TryBlockStatementAST* ast) { - const auto statement = accept(ast->statement); +void ASTEncoder::visit(TypeIdAST* ast) { + std::vector> typeSpecifierListOffsets; + std::vector> typeSpecifierListTypes; - std::vector> handlerListOffsets; - for (auto node : ListView{ast->handlerList}) { + for (auto node : ListView{ast->typeSpecifierList}) { if (!node) continue; - handlerListOffsets.emplace_back(accept(node).o); + const auto [offset, type] = acceptSpecifier(node); + typeSpecifierListOffsets.push_back(offset); + typeSpecifierListTypes.push_back(type); } - auto handlerListOffsetsVector = fbb_.CreateVector(handlerListOffsets); + auto typeSpecifierListOffsetsVector = + fbb_.CreateVector(typeSpecifierListOffsets); + auto typeSpecifierListTypesVector = fbb_.CreateVector(typeSpecifierListTypes); - io::TryBlockStatement::Builder builder{fbb_}; - builder.add_try_loc(ast->tryLoc.index()); - builder.add_statement(statement.o); - builder.add_handler_list(handlerListOffsetsVector); + const auto declarator = accept(ast->declarator); + + io::TypeId::Builder builder{fbb_}; + builder.add_type_specifier_list(typeSpecifierListOffsetsVector); + builder.add_type_specifier_list_type(typeSpecifierListTypesVector); + builder.add_declarator(declarator.o); offset_ = builder.Finish().Union(); - type_ = io::Statement_TryBlockStatement; } -void ASTEncoder::visit(GeneratedLiteralExpressionAST* ast) { - io::GeneratedLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); +void ASTEncoder::visit(HandlerAST* ast) { + const auto [exceptionDeclaration, exceptionDeclarationType] = + acceptExceptionDeclaration(ast->exceptionDeclaration); + + const auto statement = accept(ast->statement); + + io::Handler::Builder builder{fbb_}; + builder.add_catch_loc(ast->catchLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_exception_declaration(exceptionDeclaration); + builder.add_exception_declaration_type( + static_cast(exceptionDeclarationType)); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_statement(statement.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_GeneratedLiteralExpression; } -void ASTEncoder::visit(CharLiteralExpressionAST* ast) { - flatbuffers::Offset literal; - if (ast->literal) { - if (charLiterals_.contains(ast->literal)) { - literal = charLiterals_.at(ast->literal); - } else { - literal = fbb_.CreateString(ast->literal->value()); - charLiterals_.emplace(ast->literal, literal); - } - } +void ASTEncoder::visit(BaseSpecifierAST* ast) { + std::vector> attributeListOffsets; + std::vector> + attributeListTypes; - io::CharLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - if (ast->literal) { - builder.add_literal(literal); + for (auto node : ListView{ast->attributeList}) { + if (!node) continue; + const auto [offset, type] = acceptAttributeSpecifier(node); + attributeListOffsets.push_back(offset); + attributeListTypes.push_back(type); } - offset_ = builder.Finish().Union(); - type_ = io::Expression_CharLiteralExpression; -} + auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); + auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); -void ASTEncoder::visit(BoolLiteralExpressionAST* ast) { - io::BoolLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); + const auto [nestedNameSpecifier, nestedNameSpecifierType] = + acceptNestedNameSpecifier(ast->nestedNameSpecifier); + + const auto [unqualifiedId, unqualifiedIdType] = + acceptUnqualifiedId(ast->unqualifiedId); + + io::BaseSpecifier::Builder builder{fbb_}; + builder.add_attribute_list(attributeListOffsetsVector); + builder.add_attribute_list_type(attributeListTypesVector); + builder.add_virtual_or_access_loc(ast->virtualOrAccessLoc.index()); + builder.add_other_virtual_or_access_loc(ast->otherVirtualOrAccessLoc.index()); + builder.add_nested_name_specifier(nestedNameSpecifier); + builder.add_nested_name_specifier_type( + static_cast(nestedNameSpecifierType)); + builder.add_template_loc(ast->templateLoc.index()); + builder.add_unqualified_id(unqualifiedId); + builder.add_unqualified_id_type( + static_cast(unqualifiedIdType)); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_access_specifier( + static_cast(ast->accessSpecifier)); offset_ = builder.Finish().Union(); - type_ = io::Expression_BoolLiteralExpression; } -void ASTEncoder::visit(IntLiteralExpressionAST* ast) { - flatbuffers::Offset literal; - if (ast->literal) { - if (integerLiterals_.contains(ast->literal)) { - literal = integerLiterals_.at(ast->literal); - } else { - literal = fbb_.CreateString(ast->literal->value()); - integerLiterals_.emplace(ast->literal, literal); - } - } +void ASTEncoder::visit(RequiresClauseAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::IntLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - if (ast->literal) { - builder.add_literal(literal); - } + io::RequiresClause::Builder builder{fbb_}; + builder.add_requires_loc(ast->requiresLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_IntLiteralExpression; } -void ASTEncoder::visit(FloatLiteralExpressionAST* ast) { - flatbuffers::Offset literal; - if (ast->literal) { - if (floatLiterals_.contains(ast->literal)) { - literal = floatLiterals_.at(ast->literal); - } else { - literal = fbb_.CreateString(ast->literal->value()); - floatLiterals_.emplace(ast->literal, literal); - } +void ASTEncoder::visit(ParameterDeclarationClauseAST* ast) { + std::vector> + parameterDeclarationListOffsets; + for (auto node : ListView{ast->parameterDeclarationList}) { + if (!node) continue; + parameterDeclarationListOffsets.emplace_back(accept(node).o); } - io::FloatLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - if (ast->literal) { - builder.add_literal(literal); - } + auto parameterDeclarationListOffsetsVector = + fbb_.CreateVector(parameterDeclarationListOffsets); + + io::ParameterDeclarationClause::Builder builder{fbb_}; + builder.add_parameter_declaration_list(parameterDeclarationListOffsetsVector); + builder.add_comma_loc(ast->commaLoc.index()); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_FloatLiteralExpression; } -void ASTEncoder::visit(NullptrLiteralExpressionAST* ast) { - io::NullptrLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - builder.add_literal(static_cast(ast->literal)); +void ASTEncoder::visit(TrailingReturnTypeAST* ast) { + const auto typeId = accept(ast->typeId); + + io::TrailingReturnType::Builder builder{fbb_}; + builder.add_minus_greater_loc(ast->minusGreaterLoc.index()); + builder.add_type_id(typeId.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_NullptrLiteralExpression; } -void ASTEncoder::visit(StringLiteralExpressionAST* ast) { - flatbuffers::Offset literal; - if (ast->literal) { - if (stringLiterals_.contains(ast->literal)) { - literal = stringLiterals_.at(ast->literal); - } else { - literal = fbb_.CreateString(ast->literal->value()); - stringLiterals_.emplace(ast->literal, literal); - } - } - - io::StringLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - if (ast->literal) { - builder.add_literal(literal); - } +void ASTEncoder::visit(LambdaSpecifierAST* ast) { + io::LambdaSpecifier::Builder builder{fbb_}; + builder.add_specifier_loc(ast->specifierLoc.index()); + builder.add_specifier(static_cast(ast->specifier)); offset_ = builder.Finish().Union(); - type_ = io::Expression_StringLiteralExpression; } -void ASTEncoder::visit(UserDefinedStringLiteralExpressionAST* ast) { - flatbuffers::Offset literal; - if (ast->literal) { - if (stringLiterals_.contains(ast->literal)) { - literal = stringLiterals_.at(ast->literal); +void ASTEncoder::visit(TypeConstraintAST* ast) { + const auto [nestedNameSpecifier, nestedNameSpecifierType] = + acceptNestedNameSpecifier(ast->nestedNameSpecifier); + + std::vector> templateArgumentListOffsets; + std::vector> + templateArgumentListTypes; + + for (auto node : ListView{ast->templateArgumentList}) { + if (!node) continue; + const auto [offset, type] = acceptTemplateArgument(node); + templateArgumentListOffsets.push_back(offset); + templateArgumentListTypes.push_back(type); + } + + auto templateArgumentListOffsetsVector = + fbb_.CreateVector(templateArgumentListOffsets); + auto templateArgumentListTypesVector = + fbb_.CreateVector(templateArgumentListTypes); + + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); } else { - literal = fbb_.CreateString(ast->literal->value()); - stringLiterals_.emplace(ast->literal, literal); + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); } } - io::UserDefinedStringLiteralExpression::Builder builder{fbb_}; - builder.add_literal_loc(ast->literalLoc.index()); - if (ast->literal) { - builder.add_literal(literal); + io::TypeConstraint::Builder builder{fbb_}; + builder.add_nested_name_specifier(nestedNameSpecifier); + builder.add_nested_name_specifier_type( + static_cast(nestedNameSpecifierType)); + builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_less_loc(ast->lessLoc.index()); + builder.add_template_argument_list(templateArgumentListOffsetsVector); + builder.add_template_argument_list_type(templateArgumentListTypesVector); + builder.add_greater_loc(ast->greaterLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); } offset_ = builder.Finish().Union(); - type_ = io::Expression_UserDefinedStringLiteralExpression; } -void ASTEncoder::visit(ObjectLiteralExpressionAST* ast) { - const auto typeId = accept(ast->typeId); - - const auto bracedInitList = accept(ast->bracedInitList); - - io::ObjectLiteralExpression::Builder builder{fbb_}; +void ASTEncoder::visit(AttributeArgumentClauseAST* ast) { + io::AttributeArgumentClause::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_braced_init_list(bracedInitList.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_ObjectLiteralExpression; } -void ASTEncoder::visit(ThisExpressionAST* ast) { - io::ThisExpression::Builder builder{fbb_}; - builder.add_this_loc(ast->thisLoc.index()); +void ASTEncoder::visit(AttributeAST* ast) { + const auto [attributeToken, attributeTokenType] = + acceptAttributeToken(ast->attributeToken); + + const auto attributeArgumentClause = accept(ast->attributeArgumentClause); + + io::Attribute::Builder builder{fbb_}; + builder.add_attribute_token(attributeToken); + builder.add_attribute_token_type( + static_cast(attributeTokenType)); + builder.add_attribute_argument_clause(attributeArgumentClause.o); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_ThisExpression; } -void ASTEncoder::visit(GenericSelectionExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(AttributeUsingPrefixAST* ast) { + io::AttributeUsingPrefix::Builder builder{fbb_}; + builder.add_using_loc(ast->usingLoc.index()); + builder.add_attribute_namespace_loc(ast->attributeNamespaceLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); - std::vector> genericAssociationListOffsets; - std::vector> - genericAssociationListTypes; + offset_ = builder.Finish().Union(); +} - for (auto node : ListView{ast->genericAssociationList}) { +void ASTEncoder::visit(NewPlacementAST* ast) { + std::vector> expressionListOffsets; + std::vector> expressionListTypes; + + for (auto node : ListView{ast->expressionList}) { if (!node) continue; - const auto [offset, type] = acceptGenericAssociation(node); - genericAssociationListOffsets.push_back(offset); - genericAssociationListTypes.push_back(type); + const auto [offset, type] = acceptExpression(node); + expressionListOffsets.push_back(offset); + expressionListTypes.push_back(type); } - auto genericAssociationListOffsetsVector = - fbb_.CreateVector(genericAssociationListOffsets); - auto genericAssociationListTypesVector = - fbb_.CreateVector(genericAssociationListTypes); + auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); + auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); - io::GenericSelectionExpression::Builder builder{fbb_}; - builder.add_generic_loc(ast->genericLoc.index()); + io::NewPlacement::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_comma_loc(ast->commaLoc.index()); - builder.add_generic_association_list(genericAssociationListOffsetsVector); - builder.add_generic_association_list_type(genericAssociationListTypesVector); + builder.add_expression_list(expressionListOffsetsVector); + builder.add_expression_list_type(expressionListTypesVector); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_GenericSelectionExpression; } -void ASTEncoder::visit(NestedStatementExpressionAST* ast) { - const auto statement = accept(ast->statement); +void ASTEncoder::visit(NestedNamespaceSpecifierAST* ast) { + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } + } - io::NestedStatementExpression::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_statement(statement.o); - builder.add_rparen_loc(ast->rparenLoc.index()); + io::NestedNamespaceSpecifier::Builder builder{fbb_}; + builder.add_inline_loc(ast->inlineLoc.index()); + builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_scope_loc(ast->scopeLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } offset_ = builder.Finish().Union(); - type_ = io::Expression_NestedStatementExpression; } -void ASTEncoder::visit(NestedExpressionAST* ast) { +void ASTEncoder::visit(LabeledStatementAST* ast) { + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } + } + + io::LabeledStatement::Builder builder{fbb_}; + builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } + + offset_ = builder.Finish().Union(); + type_ = io::Statement_LabeledStatement; +} + +void ASTEncoder::visit(CaseStatementAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::NestedExpression::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); + io::CaseStatement::Builder builder{fbb_}; + builder.add_case_loc(ast->caseLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_NestedExpression; + type_ = io::Statement_CaseStatement; } -void ASTEncoder::visit(IdExpressionAST* ast) { - const auto [nestedNameSpecifier, nestedNameSpecifierType] = - acceptNestedNameSpecifier(ast->nestedNameSpecifier); - - const auto [unqualifiedId, unqualifiedIdType] = - acceptUnqualifiedId(ast->unqualifiedId); - - io::IdExpression::Builder builder{fbb_}; - builder.add_nested_name_specifier(nestedNameSpecifier); - builder.add_nested_name_specifier_type( - static_cast(nestedNameSpecifierType)); - builder.add_template_loc(ast->templateLoc.index()); - builder.add_unqualified_id(unqualifiedId); - builder.add_unqualified_id_type( - static_cast(unqualifiedIdType)); +void ASTEncoder::visit(DefaultStatementAST* ast) { + io::DefaultStatement::Builder builder{fbb_}; + builder.add_default_loc(ast->defaultLoc.index()); + builder.add_colon_loc(ast->colonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_IdExpression; + type_ = io::Statement_DefaultStatement; } -void ASTEncoder::visit(LambdaExpressionAST* ast) { - std::vector> captureListOffsets; - std::vector> captureListTypes; +void ASTEncoder::visit(ExpressionStatementAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - for (auto node : ListView{ast->captureList}) { - if (!node) continue; - const auto [offset, type] = acceptLambdaCapture(node); - captureListOffsets.push_back(offset); - captureListTypes.push_back(type); - } + io::ExpressionStatement::Builder builder{fbb_}; + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_semicolon_loc(ast->semicolonLoc.index()); - auto captureListOffsetsVector = fbb_.CreateVector(captureListOffsets); - auto captureListTypesVector = fbb_.CreateVector(captureListTypes); + offset_ = builder.Finish().Union(); + type_ = io::Statement_ExpressionStatement; +} - std::vector> templateParameterListOffsets; - std::vector> - templateParameterListTypes; +void ASTEncoder::visit(CompoundStatementAST* ast) { + std::vector> statementListOffsets; + std::vector> statementListTypes; - for (auto node : ListView{ast->templateParameterList}) { + for (auto node : ListView{ast->statementList}) { if (!node) continue; - const auto [offset, type] = acceptTemplateParameter(node); - templateParameterListOffsets.push_back(offset); - templateParameterListTypes.push_back(type); + const auto [offset, type] = acceptStatement(node); + statementListOffsets.push_back(offset); + statementListTypes.push_back(type); } - auto templateParameterListOffsetsVector = - fbb_.CreateVector(templateParameterListOffsets); - auto templateParameterListTypesVector = - fbb_.CreateVector(templateParameterListTypes); + auto statementListOffsetsVector = fbb_.CreateVector(statementListOffsets); + auto statementListTypesVector = fbb_.CreateVector(statementListTypes); - const auto templateRequiresClause = accept(ast->templateRequiresClause); + io::CompoundStatement::Builder builder{fbb_}; + builder.add_lbrace_loc(ast->lbraceLoc.index()); + builder.add_statement_list(statementListOffsetsVector); + builder.add_statement_list_type(statementListTypesVector); + builder.add_rbrace_loc(ast->rbraceLoc.index()); - const auto parameterDeclarationClause = - accept(ast->parameterDeclarationClause); + offset_ = builder.Finish().Union(); + type_ = io::Statement_CompoundStatement; +} - std::vector> gnuAtributeListOffsets; - std::vector> - gnuAtributeListTypes; +void ASTEncoder::visit(IfStatementAST* ast) { + const auto [initializer, initializerType] = acceptStatement(ast->initializer); - for (auto node : ListView{ast->gnuAtributeList}) { - if (!node) continue; - const auto [offset, type] = acceptAttributeSpecifier(node); - gnuAtributeListOffsets.push_back(offset); - gnuAtributeListTypes.push_back(type); - } + const auto [condition, conditionType] = acceptExpression(ast->condition); - auto gnuAtributeListOffsetsVector = fbb_.CreateVector(gnuAtributeListOffsets); - auto gnuAtributeListTypesVector = fbb_.CreateVector(gnuAtributeListTypes); + const auto [statement, statementType] = acceptStatement(ast->statement); - std::vector> - lambdaSpecifierListOffsets; - for (auto node : ListView{ast->lambdaSpecifierList}) { - if (!node) continue; - lambdaSpecifierListOffsets.emplace_back(accept(node).o); - } + const auto [elseStatement, elseStatementType] = + acceptStatement(ast->elseStatement); - auto lambdaSpecifierListOffsetsVector = - fbb_.CreateVector(lambdaSpecifierListOffsets); + io::IfStatement::Builder builder{fbb_}; + builder.add_if_loc(ast->ifLoc.index()); + builder.add_constexpr_loc(ast->constexprLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); + builder.add_condition(condition); + builder.add_condition_type(static_cast(conditionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); + builder.add_else_loc(ast->elseLoc.index()); + builder.add_else_statement(elseStatement); + builder.add_else_statement_type( + static_cast(elseStatementType)); - const auto [exceptionSpecifier, exceptionSpecifierType] = - acceptExceptionSpecifier(ast->exceptionSpecifier); + offset_ = builder.Finish().Union(); + type_ = io::Statement_IfStatement; +} - std::vector> attributeListOffsets; - std::vector> - attributeListTypes; +void ASTEncoder::visit(ConstevalIfStatementAST* ast) { + const auto [statement, statementType] = acceptStatement(ast->statement); - for (auto node : ListView{ast->attributeList}) { - if (!node) continue; - const auto [offset, type] = acceptAttributeSpecifier(node); - attributeListOffsets.push_back(offset); - attributeListTypes.push_back(type); - } + const auto [elseStatement, elseStatementType] = + acceptStatement(ast->elseStatement); - auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); - auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); + io::ConstevalIfStatement::Builder builder{fbb_}; + builder.add_if_loc(ast->ifLoc.index()); + builder.add_exclaim_loc(ast->exclaimLoc.index()); + builder.add_constval_loc(ast->constvalLoc.index()); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); + builder.add_else_loc(ast->elseLoc.index()); + builder.add_else_statement(elseStatement); + builder.add_else_statement_type( + static_cast(elseStatementType)); - const auto trailingReturnType = accept(ast->trailingReturnType); + offset_ = builder.Finish().Union(); + type_ = io::Statement_ConstevalIfStatement; +} - const auto requiresClause = accept(ast->requiresClause); +void ASTEncoder::visit(SwitchStatementAST* ast) { + const auto [initializer, initializerType] = acceptStatement(ast->initializer); - const auto statement = accept(ast->statement); + const auto [condition, conditionType] = acceptExpression(ast->condition); - io::LambdaExpression::Builder builder{fbb_}; - builder.add_lbracket_loc(ast->lbracketLoc.index()); - builder.add_capture_default_loc(ast->captureDefaultLoc.index()); - builder.add_capture_list(captureListOffsetsVector); - builder.add_capture_list_type(captureListTypesVector); - builder.add_rbracket_loc(ast->rbracketLoc.index()); - builder.add_less_loc(ast->lessLoc.index()); - builder.add_template_parameter_list(templateParameterListOffsetsVector); - builder.add_template_parameter_list_type(templateParameterListTypesVector); - builder.add_greater_loc(ast->greaterLoc.index()); - builder.add_template_requires_clause(templateRequiresClause.o); + const auto [statement, statementType] = acceptStatement(ast->statement); + + io::SwitchStatement::Builder builder{fbb_}; + builder.add_switch_loc(ast->switchLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_parameter_declaration_clause(parameterDeclarationClause.o); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); + builder.add_condition(condition); + builder.add_condition_type(static_cast(conditionType)); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_gnu_atribute_list(gnuAtributeListOffsetsVector); - builder.add_gnu_atribute_list_type(gnuAtributeListTypesVector); - builder.add_lambda_specifier_list(lambdaSpecifierListOffsetsVector); - builder.add_exception_specifier(exceptionSpecifier); - builder.add_exception_specifier_type( - static_cast(exceptionSpecifierType)); - builder.add_attribute_list(attributeListOffsetsVector); - builder.add_attribute_list_type(attributeListTypesVector); - builder.add_trailing_return_type(trailingReturnType.o); - builder.add_requires_clause(requiresClause.o); - builder.add_statement(statement.o); - builder.add_capture_default(static_cast(ast->captureDefault)); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_LambdaExpression; + type_ = io::Statement_SwitchStatement; } -void ASTEncoder::visit(FoldExpressionAST* ast) { - const auto [leftExpression, leftExpressionType] = - acceptExpression(ast->leftExpression); +void ASTEncoder::visit(WhileStatementAST* ast) { + const auto [condition, conditionType] = acceptExpression(ast->condition); - const auto [rightExpression, rightExpressionType] = - acceptExpression(ast->rightExpression); + const auto [statement, statementType] = acceptStatement(ast->statement); - io::FoldExpression::Builder builder{fbb_}; + io::WhileStatement::Builder builder{fbb_}; + builder.add_while_loc(ast->whileLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_left_expression(leftExpression); - builder.add_left_expression_type( - static_cast(leftExpressionType)); - builder.add_op_loc(ast->opLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); - builder.add_fold_op_loc(ast->foldOpLoc.index()); - builder.add_right_expression(rightExpression); - builder.add_right_expression_type( - static_cast(rightExpressionType)); + builder.add_condition(condition); + builder.add_condition_type(static_cast(conditionType)); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_op(static_cast(ast->op)); - builder.add_fold_op(static_cast(ast->foldOp)); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_FoldExpression; + type_ = io::Statement_WhileStatement; } -void ASTEncoder::visit(RightFoldExpressionAST* ast) { +void ASTEncoder::visit(DoStatementAST* ast) { + const auto [statement, statementType] = acceptStatement(ast->statement); + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::RightFoldExpression::Builder builder{fbb_}; + io::DoStatement::Builder builder{fbb_}; + builder.add_do_loc(ast->doLoc.index()); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); + builder.add_while_loc(ast->whileLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_op_loc(ast->opLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_op(static_cast(ast->op)); + builder.add_semicolon_loc(ast->semicolonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_RightFoldExpression; + type_ = io::Statement_DoStatement; } -void ASTEncoder::visit(LeftFoldExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); - - io::LeftFoldExpression::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); - builder.add_op_loc(ast->opLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_op(static_cast(ast->op)); +void ASTEncoder::visit(ForRangeStatementAST* ast) { + const auto [initializer, initializerType] = acceptStatement(ast->initializer); - offset_ = builder.Finish().Union(); - type_ = io::Expression_LeftFoldExpression; -} + const auto [rangeDeclaration, rangeDeclarationType] = + acceptDeclaration(ast->rangeDeclaration); -void ASTEncoder::visit(RequiresExpressionAST* ast) { - const auto parameterDeclarationClause = - accept(ast->parameterDeclarationClause); + const auto [rangeInitializer, rangeInitializerType] = + acceptExpression(ast->rangeInitializer); - std::vector> requirementListOffsets; - std::vector> requirementListTypes; + const auto [statement, statementType] = acceptStatement(ast->statement); - for (auto node : ListView{ast->requirementList}) { - if (!node) continue; - const auto [offset, type] = acceptRequirement(node); - requirementListOffsets.push_back(offset); - requirementListTypes.push_back(type); - } - - auto requirementListOffsetsVector = fbb_.CreateVector(requirementListOffsets); - auto requirementListTypesVector = fbb_.CreateVector(requirementListTypes); - - io::RequiresExpression::Builder builder{fbb_}; - builder.add_requires_loc(ast->requiresLoc.index()); + io::ForRangeStatement::Builder builder{fbb_}; + builder.add_for_loc(ast->forLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_parameter_declaration_clause(parameterDeclarationClause.o); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); + builder.add_range_declaration(rangeDeclaration); + builder.add_range_declaration_type( + static_cast(rangeDeclarationType)); + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_range_initializer(rangeInitializer); + builder.add_range_initializer_type( + static_cast(rangeInitializerType)); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_lbrace_loc(ast->lbraceLoc.index()); - builder.add_requirement_list(requirementListOffsetsVector); - builder.add_requirement_list_type(requirementListTypesVector); - builder.add_rbrace_loc(ast->rbraceLoc.index()); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_RequiresExpression; + type_ = io::Statement_ForRangeStatement; } -void ASTEncoder::visit(VaArgExpressionAST* ast) { +void ASTEncoder::visit(ForStatementAST* ast) { + const auto [initializer, initializerType] = acceptStatement(ast->initializer); + + const auto [condition, conditionType] = acceptExpression(ast->condition); + const auto [expression, expressionType] = acceptExpression(ast->expression); - const auto typeId = accept(ast->typeId); + const auto [statement, statementType] = acceptStatement(ast->statement); - io::VaArgExpression::Builder builder{fbb_}; - builder.add_va_arg_loc(ast->vaArgLoc.index()); + io::ForStatement::Builder builder{fbb_}; + builder.add_for_loc(ast->forLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); + builder.add_condition(condition); + builder.add_condition_type(static_cast(conditionType)); + builder.add_semicolon_loc(ast->semicolonLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_comma_loc(ast->commaLoc.index()); - builder.add_type_id(typeId.o); builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_statement(statement); + builder.add_statement_type(static_cast(statementType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_VaArgExpression; + type_ = io::Statement_ForStatement; } -void ASTEncoder::visit(SubscriptExpressionAST* ast) { - const auto [baseExpression, baseExpressionType] = - acceptExpression(ast->baseExpression); +void ASTEncoder::visit(BreakStatementAST* ast) { + io::BreakStatement::Builder builder{fbb_}; + builder.add_break_loc(ast->breakLoc.index()); + builder.add_semicolon_loc(ast->semicolonLoc.index()); - const auto [indexExpression, indexExpressionType] = - acceptExpression(ast->indexExpression); + offset_ = builder.Finish().Union(); + type_ = io::Statement_BreakStatement; +} - io::SubscriptExpression::Builder builder{fbb_}; - builder.add_base_expression(baseExpression); - builder.add_base_expression_type( - static_cast(baseExpressionType)); - builder.add_lbracket_loc(ast->lbracketLoc.index()); - builder.add_index_expression(indexExpression); - builder.add_index_expression_type( - static_cast(indexExpressionType)); - builder.add_rbracket_loc(ast->rbracketLoc.index()); +void ASTEncoder::visit(ContinueStatementAST* ast) { + io::ContinueStatement::Builder builder{fbb_}; + builder.add_continue_loc(ast->continueLoc.index()); + builder.add_semicolon_loc(ast->semicolonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_SubscriptExpression; + type_ = io::Statement_ContinueStatement; } -void ASTEncoder::visit(CallExpressionAST* ast) { - const auto [baseExpression, baseExpressionType] = - acceptExpression(ast->baseExpression); +void ASTEncoder::visit(ReturnStatementAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - std::vector> expressionListOffsets; - std::vector> expressionListTypes; + io::ReturnStatement::Builder builder{fbb_}; + builder.add_return_loc(ast->returnLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_semicolon_loc(ast->semicolonLoc.index()); - for (auto node : ListView{ast->expressionList}) { - if (!node) continue; - const auto [offset, type] = acceptExpression(node); - expressionListOffsets.push_back(offset); - expressionListTypes.push_back(type); - } + offset_ = builder.Finish().Union(); + type_ = io::Statement_ReturnStatement; +} - auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); - auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); +void ASTEncoder::visit(CoroutineReturnStatementAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::CallExpression::Builder builder{fbb_}; - builder.add_base_expression(baseExpression); - builder.add_base_expression_type( - static_cast(baseExpressionType)); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression_list(expressionListOffsetsVector); - builder.add_expression_list_type(expressionListTypesVector); - builder.add_rparen_loc(ast->rparenLoc.index()); + io::CoroutineReturnStatement::Builder builder{fbb_}; + builder.add_coreturn_loc(ast->coreturnLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_semicolon_loc(ast->semicolonLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_CallExpression; + type_ = io::Statement_CoroutineReturnStatement; } -void ASTEncoder::visit(TypeConstructionAST* ast) { - const auto [typeSpecifier, typeSpecifierType] = - acceptSpecifier(ast->typeSpecifier); +void ASTEncoder::visit(GotoStatementAST* ast) { + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } + } - std::vector> expressionListOffsets; - std::vector> expressionListTypes; + io::GotoStatement::Builder builder{fbb_}; + builder.add_goto_loc(ast->gotoLoc.index()); + builder.add_star_loc(ast->starLoc.index()); + builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_semicolon_loc(ast->semicolonLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } - for (auto node : ListView{ast->expressionList}) { + offset_ = builder.Finish().Union(); + type_ = io::Statement_GotoStatement; +} + +void ASTEncoder::visit(DeclarationStatementAST* ast) { + const auto [declaration, declarationType] = + acceptDeclaration(ast->declaration); + + io::DeclarationStatement::Builder builder{fbb_}; + builder.add_declaration(declaration); + builder.add_declaration_type(static_cast(declarationType)); + + offset_ = builder.Finish().Union(); + type_ = io::Statement_DeclarationStatement; +} + +void ASTEncoder::visit(TryBlockStatementAST* ast) { + const auto statement = accept(ast->statement); + + std::vector> handlerListOffsets; + for (auto node : ListView{ast->handlerList}) { if (!node) continue; - const auto [offset, type] = acceptExpression(node); - expressionListOffsets.push_back(offset); - expressionListTypes.push_back(type); + handlerListOffsets.emplace_back(accept(node).o); } - auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); - auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); + auto handlerListOffsetsVector = fbb_.CreateVector(handlerListOffsets); - io::TypeConstruction::Builder builder{fbb_}; - builder.add_type_specifier(typeSpecifier); - builder.add_type_specifier_type( - static_cast(typeSpecifierType)); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression_list(expressionListOffsetsVector); - builder.add_expression_list_type(expressionListTypesVector); - builder.add_rparen_loc(ast->rparenLoc.index()); + io::TryBlockStatement::Builder builder{fbb_}; + builder.add_try_loc(ast->tryLoc.index()); + builder.add_statement(statement.o); + builder.add_handler_list(handlerListOffsetsVector); offset_ = builder.Finish().Union(); - type_ = io::Expression_TypeConstruction; + type_ = io::Statement_TryBlockStatement; } -void ASTEncoder::visit(BracedTypeConstructionAST* ast) { - const auto [typeSpecifier, typeSpecifierType] = - acceptSpecifier(ast->typeSpecifier); +void ASTEncoder::visit(GeneratedLiteralExpressionAST* ast) { + io::GeneratedLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); - const auto bracedInitList = accept(ast->bracedInitList); + offset_ = builder.Finish().Union(); + type_ = io::Expression_GeneratedLiteralExpression; +} - io::BracedTypeConstruction::Builder builder{fbb_}; - builder.add_type_specifier(typeSpecifier); - builder.add_type_specifier_type( - static_cast(typeSpecifierType)); - builder.add_braced_init_list(bracedInitList.o); +void ASTEncoder::visit(CharLiteralExpressionAST* ast) { + flatbuffers::Offset literal; + if (ast->literal) { + if (charLiterals_.contains(ast->literal)) { + literal = charLiterals_.at(ast->literal); + } else { + literal = fbb_.CreateString(ast->literal->value()); + charLiterals_.emplace(ast->literal, literal); + } + } + + io::CharLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + if (ast->literal) { + builder.add_literal(literal); + } offset_ = builder.Finish().Union(); - type_ = io::Expression_BracedTypeConstruction; + type_ = io::Expression_CharLiteralExpression; } -void ASTEncoder::visit(SpliceMemberExpressionAST* ast) { - const auto [baseExpression, baseExpressionType] = - acceptExpression(ast->baseExpression); +void ASTEncoder::visit(BoolLiteralExpressionAST* ast) { + io::BoolLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); - const auto splicer = accept(ast->splicer); + offset_ = builder.Finish().Union(); + type_ = io::Expression_BoolLiteralExpression; +} - io::SpliceMemberExpression::Builder builder{fbb_}; - builder.add_base_expression(baseExpression); - builder.add_base_expression_type( - static_cast(baseExpressionType)); - builder.add_access_loc(ast->accessLoc.index()); - builder.add_template_loc(ast->templateLoc.index()); - builder.add_splicer(splicer.o); - builder.add_access_op(static_cast(ast->accessOp)); +void ASTEncoder::visit(IntLiteralExpressionAST* ast) { + flatbuffers::Offset literal; + if (ast->literal) { + if (integerLiterals_.contains(ast->literal)) { + literal = integerLiterals_.at(ast->literal); + } else { + literal = fbb_.CreateString(ast->literal->value()); + integerLiterals_.emplace(ast->literal, literal); + } + } + + io::IntLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + if (ast->literal) { + builder.add_literal(literal); + } offset_ = builder.Finish().Union(); - type_ = io::Expression_SpliceMemberExpression; + type_ = io::Expression_IntLiteralExpression; } -void ASTEncoder::visit(MemberExpressionAST* ast) { - const auto [baseExpression, baseExpressionType] = - acceptExpression(ast->baseExpression); +void ASTEncoder::visit(FloatLiteralExpressionAST* ast) { + flatbuffers::Offset literal; + if (ast->literal) { + if (floatLiterals_.contains(ast->literal)) { + literal = floatLiterals_.at(ast->literal); + } else { + literal = fbb_.CreateString(ast->literal->value()); + floatLiterals_.emplace(ast->literal, literal); + } + } - const auto [nestedNameSpecifier, nestedNameSpecifierType] = - acceptNestedNameSpecifier(ast->nestedNameSpecifier); + io::FloatLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + if (ast->literal) { + builder.add_literal(literal); + } - const auto [unqualifiedId, unqualifiedIdType] = - acceptUnqualifiedId(ast->unqualifiedId); + offset_ = builder.Finish().Union(); + type_ = io::Expression_FloatLiteralExpression; +} - io::MemberExpression::Builder builder{fbb_}; - builder.add_base_expression(baseExpression); - builder.add_base_expression_type( - static_cast(baseExpressionType)); - builder.add_access_loc(ast->accessLoc.index()); - builder.add_nested_name_specifier(nestedNameSpecifier); - builder.add_nested_name_specifier_type( - static_cast(nestedNameSpecifierType)); - builder.add_template_loc(ast->templateLoc.index()); - builder.add_unqualified_id(unqualifiedId); - builder.add_unqualified_id_type( - static_cast(unqualifiedIdType)); - builder.add_access_op(static_cast(ast->accessOp)); +void ASTEncoder::visit(NullptrLiteralExpressionAST* ast) { + io::NullptrLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + builder.add_literal(static_cast(ast->literal)); offset_ = builder.Finish().Union(); - type_ = io::Expression_MemberExpression; + type_ = io::Expression_NullptrLiteralExpression; } -void ASTEncoder::visit(PostIncrExpressionAST* ast) { - const auto [baseExpression, baseExpressionType] = - acceptExpression(ast->baseExpression); +void ASTEncoder::visit(StringLiteralExpressionAST* ast) { + flatbuffers::Offset literal; + if (ast->literal) { + if (stringLiterals_.contains(ast->literal)) { + literal = stringLiterals_.at(ast->literal); + } else { + literal = fbb_.CreateString(ast->literal->value()); + stringLiterals_.emplace(ast->literal, literal); + } + } + + io::StringLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + if (ast->literal) { + builder.add_literal(literal); + } + + offset_ = builder.Finish().Union(); + type_ = io::Expression_StringLiteralExpression; +} + +void ASTEncoder::visit(UserDefinedStringLiteralExpressionAST* ast) { + flatbuffers::Offset literal; + if (ast->literal) { + if (stringLiterals_.contains(ast->literal)) { + literal = stringLiterals_.at(ast->literal); + } else { + literal = fbb_.CreateString(ast->literal->value()); + stringLiterals_.emplace(ast->literal, literal); + } + } - io::PostIncrExpression::Builder builder{fbb_}; - builder.add_base_expression(baseExpression); - builder.add_base_expression_type( - static_cast(baseExpressionType)); - builder.add_op_loc(ast->opLoc.index()); - builder.add_op(static_cast(ast->op)); + io::UserDefinedStringLiteralExpression::Builder builder{fbb_}; + builder.add_literal_loc(ast->literalLoc.index()); + if (ast->literal) { + builder.add_literal(literal); + } offset_ = builder.Finish().Union(); - type_ = io::Expression_PostIncrExpression; + type_ = io::Expression_UserDefinedStringLiteralExpression; } -void ASTEncoder::visit(CppCastExpressionAST* ast) { +void ASTEncoder::visit(ObjectLiteralExpressionAST* ast) { const auto typeId = accept(ast->typeId); - const auto [expression, expressionType] = acceptExpression(ast->expression); + const auto bracedInitList = accept(ast->bracedInitList); - io::CppCastExpression::Builder builder{fbb_}; - builder.add_cast_loc(ast->castLoc.index()); - builder.add_less_loc(ast->lessLoc.index()); - builder.add_type_id(typeId.o); - builder.add_greater_loc(ast->greaterLoc.index()); + io::ObjectLiteralExpression::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + builder.add_type_id(typeId.o); builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_braced_init_list(bracedInitList.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_CppCastExpression; + type_ = io::Expression_ObjectLiteralExpression; } -void ASTEncoder::visit(BuiltinBitCastExpressionAST* ast) { - const auto typeId = accept(ast->typeId); +void ASTEncoder::visit(ThisExpressionAST* ast) { + io::ThisExpression::Builder builder{fbb_}; + builder.add_this_loc(ast->thisLoc.index()); + + offset_ = builder.Finish().Union(); + type_ = io::Expression_ThisExpression; +} +void ASTEncoder::visit(GenericSelectionExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::BuiltinBitCastExpression::Builder builder{fbb_}; - builder.add_cast_loc(ast->castLoc.index()); + std::vector> genericAssociationListOffsets; + std::vector> + genericAssociationListTypes; + + for (auto node : ListView{ast->genericAssociationList}) { + if (!node) continue; + const auto [offset, type] = acceptGenericAssociation(node); + genericAssociationListOffsets.push_back(offset); + genericAssociationListTypes.push_back(type); + } + + auto genericAssociationListOffsetsVector = + fbb_.CreateVector(genericAssociationListOffsets); + auto genericAssociationListTypesVector = + fbb_.CreateVector(genericAssociationListTypes); + + io::GenericSelectionExpression::Builder builder{fbb_}; + builder.add_generic_loc(ast->genericLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); - builder.add_comma_loc(ast->commaLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); + builder.add_comma_loc(ast->commaLoc.index()); + builder.add_generic_association_list(genericAssociationListOffsetsVector); + builder.add_generic_association_list_type(genericAssociationListTypesVector); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_BuiltinBitCastExpression; + type_ = io::Expression_GenericSelectionExpression; } -void ASTEncoder::visit(BuiltinOffsetofExpressionAST* ast) { - const auto typeId = accept(ast->typeId); - - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(NestedStatementExpressionAST* ast) { + const auto statement = accept(ast->statement); - io::BuiltinOffsetofExpression::Builder builder{fbb_}; - builder.add_offsetof_loc(ast->offsetofLoc.index()); + io::NestedStatementExpression::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); - builder.add_comma_loc(ast->commaLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + builder.add_statement(statement.o); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_BuiltinOffsetofExpression; + type_ = io::Expression_NestedStatementExpression; } -void ASTEncoder::visit(TypeidExpressionAST* ast) { +void ASTEncoder::visit(NestedExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::TypeidExpression::Builder builder{fbb_}; - builder.add_typeid_loc(ast->typeidLoc.index()); + io::NestedExpression::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_TypeidExpression; + type_ = io::Expression_NestedExpression; } -void ASTEncoder::visit(TypeidOfTypeExpressionAST* ast) { - const auto typeId = accept(ast->typeId); +void ASTEncoder::visit(IdExpressionAST* ast) { + const auto [nestedNameSpecifier, nestedNameSpecifierType] = + acceptNestedNameSpecifier(ast->nestedNameSpecifier); - io::TypeidOfTypeExpression::Builder builder{fbb_}; - builder.add_typeid_loc(ast->typeidLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); - builder.add_rparen_loc(ast->rparenLoc.index()); + const auto [unqualifiedId, unqualifiedIdType] = + acceptUnqualifiedId(ast->unqualifiedId); + + io::IdExpression::Builder builder{fbb_}; + builder.add_nested_name_specifier(nestedNameSpecifier); + builder.add_nested_name_specifier_type( + static_cast(nestedNameSpecifierType)); + builder.add_template_loc(ast->templateLoc.index()); + builder.add_unqualified_id(unqualifiedId); + builder.add_unqualified_id_type( + static_cast(unqualifiedIdType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_TypeidOfTypeExpression; + type_ = io::Expression_IdExpression; } -void ASTEncoder::visit(SpliceExpressionAST* ast) { - const auto splicer = accept(ast->splicer); +void ASTEncoder::visit(LambdaExpressionAST* ast) { + std::vector> captureListOffsets; + std::vector> captureListTypes; - io::SpliceExpression::Builder builder{fbb_}; - builder.add_splicer(splicer.o); + for (auto node : ListView{ast->captureList}) { + if (!node) continue; + const auto [offset, type] = acceptLambdaCapture(node); + captureListOffsets.push_back(offset); + captureListTypes.push_back(type); + } - offset_ = builder.Finish().Union(); - type_ = io::Expression_SpliceExpression; -} + auto captureListOffsetsVector = fbb_.CreateVector(captureListOffsets); + auto captureListTypesVector = fbb_.CreateVector(captureListTypes); -void ASTEncoder::visit(GlobalScopeReflectExpressionAST* ast) { - io::GlobalScopeReflectExpression::Builder builder{fbb_}; - builder.add_caret_loc(ast->caretLoc.index()); - builder.add_scope_loc(ast->scopeLoc.index()); + std::vector> templateParameterListOffsets; + std::vector> + templateParameterListTypes; - offset_ = builder.Finish().Union(); - type_ = io::Expression_GlobalScopeReflectExpression; -} + for (auto node : ListView{ast->templateParameterList}) { + if (!node) continue; + const auto [offset, type] = acceptTemplateParameter(node); + templateParameterListOffsets.push_back(offset); + templateParameterListTypes.push_back(type); + } -void ASTEncoder::visit(NamespaceReflectExpressionAST* ast) { - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } + auto templateParameterListOffsetsVector = + fbb_.CreateVector(templateParameterListOffsets); + auto templateParameterListTypesVector = + fbb_.CreateVector(templateParameterListTypes); + + const auto templateRequiresClause = accept(ast->templateRequiresClause); + + const auto parameterDeclarationClause = + accept(ast->parameterDeclarationClause); + + std::vector> gnuAtributeListOffsets; + std::vector> + gnuAtributeListTypes; + + for (auto node : ListView{ast->gnuAtributeList}) { + if (!node) continue; + const auto [offset, type] = acceptAttributeSpecifier(node); + gnuAtributeListOffsets.push_back(offset); + gnuAtributeListTypes.push_back(type); } - io::NamespaceReflectExpression::Builder builder{fbb_}; - builder.add_caret_loc(ast->caretLoc.index()); - builder.add_identifier_loc(ast->identifierLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); + auto gnuAtributeListOffsetsVector = fbb_.CreateVector(gnuAtributeListOffsets); + auto gnuAtributeListTypesVector = fbb_.CreateVector(gnuAtributeListTypes); + + std::vector> + lambdaSpecifierListOffsets; + for (auto node : ListView{ast->lambdaSpecifierList}) { + if (!node) continue; + lambdaSpecifierListOffsets.emplace_back(accept(node).o); } - offset_ = builder.Finish().Union(); - type_ = io::Expression_NamespaceReflectExpression; -} + auto lambdaSpecifierListOffsetsVector = + fbb_.CreateVector(lambdaSpecifierListOffsets); -void ASTEncoder::visit(TypeIdReflectExpressionAST* ast) { - const auto typeId = accept(ast->typeId); + const auto [exceptionSpecifier, exceptionSpecifierType] = + acceptExceptionSpecifier(ast->exceptionSpecifier); - io::TypeIdReflectExpression::Builder builder{fbb_}; - builder.add_caret_loc(ast->caretLoc.index()); - builder.add_type_id(typeId.o); + std::vector> attributeListOffsets; + std::vector> + attributeListTypes; - offset_ = builder.Finish().Union(); - type_ = io::Expression_TypeIdReflectExpression; -} + for (auto node : ListView{ast->attributeList}) { + if (!node) continue; + const auto [offset, type] = acceptAttributeSpecifier(node); + attributeListOffsets.push_back(offset); + attributeListTypes.push_back(type); + } -void ASTEncoder::visit(ReflectExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); + auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); + auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); - io::ReflectExpression::Builder builder{fbb_}; - builder.add_caret_loc(ast->caretLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + const auto trailingReturnType = accept(ast->trailingReturnType); - offset_ = builder.Finish().Union(); - type_ = io::Expression_ReflectExpression; -} + const auto requiresClause = accept(ast->requiresClause); -void ASTEncoder::visit(LabelAddressExpressionAST* ast) { - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } + const auto statement = accept(ast->statement); - io::LabelAddressExpression::Builder builder{fbb_}; - builder.add_amp_amp_loc(ast->ampAmpLoc.index()); - builder.add_identifier_loc(ast->identifierLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); - } + io::LambdaExpression::Builder builder{fbb_}; + builder.add_lbracket_loc(ast->lbracketLoc.index()); + builder.add_capture_default_loc(ast->captureDefaultLoc.index()); + builder.add_capture_list(captureListOffsetsVector); + builder.add_capture_list_type(captureListTypesVector); + builder.add_rbracket_loc(ast->rbracketLoc.index()); + builder.add_less_loc(ast->lessLoc.index()); + builder.add_template_parameter_list(templateParameterListOffsetsVector); + builder.add_template_parameter_list_type(templateParameterListTypesVector); + builder.add_greater_loc(ast->greaterLoc.index()); + builder.add_template_requires_clause(templateRequiresClause.o); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_parameter_declaration_clause(parameterDeclarationClause.o); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_gnu_atribute_list(gnuAtributeListOffsetsVector); + builder.add_gnu_atribute_list_type(gnuAtributeListTypesVector); + builder.add_lambda_specifier_list(lambdaSpecifierListOffsetsVector); + builder.add_exception_specifier(exceptionSpecifier); + builder.add_exception_specifier_type( + static_cast(exceptionSpecifierType)); + builder.add_attribute_list(attributeListOffsetsVector); + builder.add_attribute_list_type(attributeListTypesVector); + builder.add_trailing_return_type(trailingReturnType.o); + builder.add_requires_clause(requiresClause.o); + builder.add_statement(statement.o); + builder.add_capture_default(static_cast(ast->captureDefault)); offset_ = builder.Finish().Union(); - type_ = io::Expression_LabelAddressExpression; + type_ = io::Expression_LambdaExpression; } -void ASTEncoder::visit(UnaryExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(FoldExpressionAST* ast) { + const auto [leftExpression, leftExpressionType] = + acceptExpression(ast->leftExpression); - io::UnaryExpression::Builder builder{fbb_}; + const auto [rightExpression, rightExpressionType] = + acceptExpression(ast->rightExpression); + + io::FoldExpression::Builder builder{fbb_}; + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_left_expression(leftExpression); + builder.add_left_expression_type( + static_cast(leftExpressionType)); builder.add_op_loc(ast->opLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_fold_op_loc(ast->foldOpLoc.index()); + builder.add_right_expression(rightExpression); + builder.add_right_expression_type( + static_cast(rightExpressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); builder.add_op(static_cast(ast->op)); + builder.add_fold_op(static_cast(ast->foldOp)); offset_ = builder.Finish().Union(); - type_ = io::Expression_UnaryExpression; + type_ = io::Expression_FoldExpression; } -void ASTEncoder::visit(AwaitExpressionAST* ast) { +void ASTEncoder::visit(RightFoldExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::AwaitExpression::Builder builder{fbb_}; - builder.add_await_loc(ast->awaitLoc.index()); + io::RightFoldExpression::Builder builder{fbb_}; + builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); + builder.add_op_loc(ast->opLoc.index()); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_op(static_cast(ast->op)); offset_ = builder.Finish().Union(); - type_ = io::Expression_AwaitExpression; + type_ = io::Expression_RightFoldExpression; } -void ASTEncoder::visit(SizeofExpressionAST* ast) { +void ASTEncoder::visit(LeftFoldExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::SizeofExpression::Builder builder{fbb_}; - builder.add_sizeof_loc(ast->sizeofLoc.index()); + io::LeftFoldExpression::Builder builder{fbb_}; + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_op_loc(ast->opLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_op(static_cast(ast->op)); offset_ = builder.Finish().Union(); - type_ = io::Expression_SizeofExpression; + type_ = io::Expression_LeftFoldExpression; } -void ASTEncoder::visit(SizeofTypeExpressionAST* ast) { - const auto typeId = accept(ast->typeId); - - io::SizeofTypeExpression::Builder builder{fbb_}; - builder.add_sizeof_loc(ast->sizeofLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); - builder.add_rparen_loc(ast->rparenLoc.index()); +void ASTEncoder::visit(RequiresExpressionAST* ast) { + const auto parameterDeclarationClause = + accept(ast->parameterDeclarationClause); - offset_ = builder.Finish().Union(); - type_ = io::Expression_SizeofTypeExpression; -} + std::vector> requirementListOffsets; + std::vector> requirementListTypes; -void ASTEncoder::visit(SizeofPackExpressionAST* ast) { - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } + for (auto node : ListView{ast->requirementList}) { + if (!node) continue; + const auto [offset, type] = acceptRequirement(node); + requirementListOffsets.push_back(offset); + requirementListTypes.push_back(type); } - io::SizeofPackExpression::Builder builder{fbb_}; - builder.add_sizeof_loc(ast->sizeofLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + auto requirementListOffsetsVector = fbb_.CreateVector(requirementListOffsets); + auto requirementListTypesVector = fbb_.CreateVector(requirementListTypes); + + io::RequiresExpression::Builder builder{fbb_}; + builder.add_requires_loc(ast->requiresLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_parameter_declaration_clause(parameterDeclarationClause.o); builder.add_rparen_loc(ast->rparenLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); - } + builder.add_lbrace_loc(ast->lbraceLoc.index()); + builder.add_requirement_list(requirementListOffsetsVector); + builder.add_requirement_list_type(requirementListTypesVector); + builder.add_rbrace_loc(ast->rbraceLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_SizeofPackExpression; + type_ = io::Expression_RequiresExpression; } -void ASTEncoder::visit(AlignofTypeExpressionAST* ast) { +void ASTEncoder::visit(VaArgExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); + const auto typeId = accept(ast->typeId); - io::AlignofTypeExpression::Builder builder{fbb_}; - builder.add_alignof_loc(ast->alignofLoc.index()); + io::VaArgExpression::Builder builder{fbb_}; + builder.add_va_arg_loc(ast->vaArgLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_comma_loc(ast->commaLoc.index()); builder.add_type_id(typeId.o); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_AlignofTypeExpression; + type_ = io::Expression_VaArgExpression; } -void ASTEncoder::visit(AlignofExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(SubscriptExpressionAST* ast) { + const auto [baseExpression, baseExpressionType] = + acceptExpression(ast->baseExpression); - io::AlignofExpression::Builder builder{fbb_}; - builder.add_alignof_loc(ast->alignofLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + const auto [indexExpression, indexExpressionType] = + acceptExpression(ast->indexExpression); + + io::SubscriptExpression::Builder builder{fbb_}; + builder.add_base_expression(baseExpression); + builder.add_base_expression_type( + static_cast(baseExpressionType)); + builder.add_lbracket_loc(ast->lbracketLoc.index()); + builder.add_index_expression(indexExpression); + builder.add_index_expression_type( + static_cast(indexExpressionType)); + builder.add_rbracket_loc(ast->rbracketLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_AlignofExpression; + type_ = io::Expression_SubscriptExpression; } -void ASTEncoder::visit(NoexceptExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(CallExpressionAST* ast) { + const auto [baseExpression, baseExpressionType] = + acceptExpression(ast->baseExpression); - io::NoexceptExpression::Builder builder{fbb_}; - builder.add_noexcept_loc(ast->noexceptLoc.index()); + std::vector> expressionListOffsets; + std::vector> expressionListTypes; + + for (auto node : ListView{ast->expressionList}) { + if (!node) continue; + const auto [offset, type] = acceptExpression(node); + expressionListOffsets.push_back(offset); + expressionListTypes.push_back(type); + } + + auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); + auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); + + io::CallExpression::Builder builder{fbb_}; + builder.add_base_expression(baseExpression); + builder.add_base_expression_type( + static_cast(baseExpressionType)); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + builder.add_expression_list(expressionListOffsetsVector); + builder.add_expression_list_type(expressionListTypesVector); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_NoexceptExpression; + type_ = io::Expression_CallExpression; } -void ASTEncoder::visit(NewExpressionAST* ast) { - const auto newPlacement = accept(ast->newPlacement); +void ASTEncoder::visit(TypeConstructionAST* ast) { + const auto [typeSpecifier, typeSpecifierType] = + acceptSpecifier(ast->typeSpecifier); - std::vector> typeSpecifierListOffsets; - std::vector> typeSpecifierListTypes; + std::vector> expressionListOffsets; + std::vector> expressionListTypes; - for (auto node : ListView{ast->typeSpecifierList}) { + for (auto node : ListView{ast->expressionList}) { if (!node) continue; - const auto [offset, type] = acceptSpecifier(node); - typeSpecifierListOffsets.push_back(offset); - typeSpecifierListTypes.push_back(type); + const auto [offset, type] = acceptExpression(node); + expressionListOffsets.push_back(offset); + expressionListTypes.push_back(type); } - auto typeSpecifierListOffsetsVector = - fbb_.CreateVector(typeSpecifierListOffsets); - auto typeSpecifierListTypesVector = fbb_.CreateVector(typeSpecifierListTypes); - - const auto declarator = accept(ast->declarator); - - const auto [newInitalizer, newInitalizerType] = - acceptNewInitializer(ast->newInitalizer); + auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); + auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); - io::NewExpression::Builder builder{fbb_}; - builder.add_scope_loc(ast->scopeLoc.index()); - builder.add_new_loc(ast->newLoc.index()); - builder.add_new_placement(newPlacement.o); + io::TypeConstruction::Builder builder{fbb_}; + builder.add_type_specifier(typeSpecifier); + builder.add_type_specifier_type( + static_cast(typeSpecifierType)); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_specifier_list(typeSpecifierListOffsetsVector); - builder.add_type_specifier_list_type(typeSpecifierListTypesVector); - builder.add_declarator(declarator.o); + builder.add_expression_list(expressionListOffsetsVector); + builder.add_expression_list_type(expressionListTypesVector); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_new_initalizer(newInitalizer); - builder.add_new_initalizer_type( - static_cast(newInitalizerType)); - - offset_ = builder.Finish().Union(); - type_ = io::Expression_NewExpression; -} - -void ASTEncoder::visit(DeleteExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); - - io::DeleteExpression::Builder builder{fbb_}; - builder.add_scope_loc(ast->scopeLoc.index()); - builder.add_delete_loc(ast->deleteLoc.index()); - builder.add_lbracket_loc(ast->lbracketLoc.index()); - builder.add_rbracket_loc(ast->rbracketLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_DeleteExpression; + type_ = io::Expression_TypeConstruction; } -void ASTEncoder::visit(CastExpressionAST* ast) { - const auto typeId = accept(ast->typeId); +void ASTEncoder::visit(BracedTypeConstructionAST* ast) { + const auto [typeSpecifier, typeSpecifierType] = + acceptSpecifier(ast->typeSpecifier); - const auto [expression, expressionType] = acceptExpression(ast->expression); + const auto bracedInitList = accept(ast->bracedInitList); - io::CastExpression::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id(typeId.o); - builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + io::BracedTypeConstruction::Builder builder{fbb_}; + builder.add_type_specifier(typeSpecifier); + builder.add_type_specifier_type( + static_cast(typeSpecifierType)); + builder.add_braced_init_list(bracedInitList.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_CastExpression; + type_ = io::Expression_BracedTypeConstruction; } -void ASTEncoder::visit(ImplicitCastExpressionAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(SpliceMemberExpressionAST* ast) { + const auto [baseExpression, baseExpressionType] = + acceptExpression(ast->baseExpression); - io::ImplicitCastExpression::Builder builder{fbb_}; - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + const auto splicer = accept(ast->splicer); + + io::SpliceMemberExpression::Builder builder{fbb_}; + builder.add_base_expression(baseExpression); + builder.add_base_expression_type( + static_cast(baseExpressionType)); + builder.add_access_loc(ast->accessLoc.index()); + builder.add_template_loc(ast->templateLoc.index()); + builder.add_splicer(splicer.o); + builder.add_access_op(static_cast(ast->accessOp)); offset_ = builder.Finish().Union(); - type_ = io::Expression_ImplicitCastExpression; + type_ = io::Expression_SpliceMemberExpression; } -void ASTEncoder::visit(BinaryExpressionAST* ast) { - const auto [leftExpression, leftExpressionType] = - acceptExpression(ast->leftExpression); +void ASTEncoder::visit(MemberExpressionAST* ast) { + const auto [baseExpression, baseExpressionType] = + acceptExpression(ast->baseExpression); - const auto [rightExpression, rightExpressionType] = - acceptExpression(ast->rightExpression); + const auto [nestedNameSpecifier, nestedNameSpecifierType] = + acceptNestedNameSpecifier(ast->nestedNameSpecifier); - io::BinaryExpression::Builder builder{fbb_}; - builder.add_left_expression(leftExpression); - builder.add_left_expression_type( - static_cast(leftExpressionType)); - builder.add_op_loc(ast->opLoc.index()); - builder.add_right_expression(rightExpression); - builder.add_right_expression_type( - static_cast(rightExpressionType)); - builder.add_op(static_cast(ast->op)); + const auto [unqualifiedId, unqualifiedIdType] = + acceptUnqualifiedId(ast->unqualifiedId); + + io::MemberExpression::Builder builder{fbb_}; + builder.add_base_expression(baseExpression); + builder.add_base_expression_type( + static_cast(baseExpressionType)); + builder.add_access_loc(ast->accessLoc.index()); + builder.add_nested_name_specifier(nestedNameSpecifier); + builder.add_nested_name_specifier_type( + static_cast(nestedNameSpecifierType)); + builder.add_template_loc(ast->templateLoc.index()); + builder.add_unqualified_id(unqualifiedId); + builder.add_unqualified_id_type( + static_cast(unqualifiedIdType)); + builder.add_access_op(static_cast(ast->accessOp)); offset_ = builder.Finish().Union(); - type_ = io::Expression_BinaryExpression; + type_ = io::Expression_MemberExpression; } -void ASTEncoder::visit(ConditionalExpressionAST* ast) { - const auto [condition, conditionType] = acceptExpression(ast->condition); - - const auto [iftrueExpression, iftrueExpressionType] = - acceptExpression(ast->iftrueExpression); - - const auto [iffalseExpression, iffalseExpressionType] = - acceptExpression(ast->iffalseExpression); +void ASTEncoder::visit(PostIncrExpressionAST* ast) { + const auto [baseExpression, baseExpressionType] = + acceptExpression(ast->baseExpression); - io::ConditionalExpression::Builder builder{fbb_}; - builder.add_condition(condition); - builder.add_condition_type(static_cast(conditionType)); - builder.add_question_loc(ast->questionLoc.index()); - builder.add_iftrue_expression(iftrueExpression); - builder.add_iftrue_expression_type( - static_cast(iftrueExpressionType)); - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_iffalse_expression(iffalseExpression); - builder.add_iffalse_expression_type( - static_cast(iffalseExpressionType)); + io::PostIncrExpression::Builder builder{fbb_}; + builder.add_base_expression(baseExpression); + builder.add_base_expression_type( + static_cast(baseExpressionType)); + builder.add_op_loc(ast->opLoc.index()); + builder.add_op(static_cast(ast->op)); offset_ = builder.Finish().Union(); - type_ = io::Expression_ConditionalExpression; + type_ = io::Expression_PostIncrExpression; } -void ASTEncoder::visit(YieldExpressionAST* ast) { +void ASTEncoder::visit(CppCastExpressionAST* ast) { + const auto typeId = accept(ast->typeId); + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::YieldExpression::Builder builder{fbb_}; - builder.add_yield_loc(ast->yieldLoc.index()); + io::CppCastExpression::Builder builder{fbb_}; + builder.add_cast_loc(ast->castLoc.index()); + builder.add_less_loc(ast->lessLoc.index()); + builder.add_type_id(typeId.o); + builder.add_greater_loc(ast->greaterLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_YieldExpression; + type_ = io::Expression_CppCastExpression; } -void ASTEncoder::visit(ThrowExpressionAST* ast) { +void ASTEncoder::visit(BuiltinBitCastExpressionAST* ast) { + const auto typeId = accept(ast->typeId); + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::ThrowExpression::Builder builder{fbb_}; - builder.add_throw_loc(ast->throwLoc.index()); + io::BuiltinBitCastExpression::Builder builder{fbb_}; + builder.add_cast_loc(ast->castLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_id(typeId.o); + builder.add_comma_loc(ast->commaLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_ThrowExpression; + type_ = io::Expression_BuiltinBitCastExpression; } -void ASTEncoder::visit(AssignmentExpressionAST* ast) { - const auto [leftExpression, leftExpressionType] = - acceptExpression(ast->leftExpression); +void ASTEncoder::visit(BuiltinOffsetofExpressionAST* ast) { + const auto typeId = accept(ast->typeId); - const auto [rightExpression, rightExpressionType] = - acceptExpression(ast->rightExpression); + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::AssignmentExpression::Builder builder{fbb_}; - builder.add_left_expression(leftExpression); - builder.add_left_expression_type( - static_cast(leftExpressionType)); - builder.add_op_loc(ast->opLoc.index()); - builder.add_right_expression(rightExpression); - builder.add_right_expression_type( - static_cast(rightExpressionType)); - builder.add_op(static_cast(ast->op)); + io::BuiltinOffsetofExpression::Builder builder{fbb_}; + builder.add_offsetof_loc(ast->offsetofLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_id(typeId.o); + builder.add_comma_loc(ast->commaLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_AssignmentExpression; + type_ = io::Expression_BuiltinOffsetofExpression; } -void ASTEncoder::visit(PackExpansionExpressionAST* ast) { +void ASTEncoder::visit(TypeidExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::PackExpansionExpression::Builder builder{fbb_}; + io::TypeidExpression::Builder builder{fbb_}; + builder.add_typeid_loc(ast->typeidLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_PackExpansionExpression; + type_ = io::Expression_TypeidExpression; } -void ASTEncoder::visit(DesignatedInitializerClauseAST* ast) { - std::vector> designatorListOffsets; - std::vector> designatorListTypes; +void ASTEncoder::visit(TypeidOfTypeExpressionAST* ast) { + const auto typeId = accept(ast->typeId); - for (auto node : ListView{ast->designatorList}) { - if (!node) continue; - const auto [offset, type] = acceptDesignator(node); - designatorListOffsets.push_back(offset); - designatorListTypes.push_back(type); - } + io::TypeidOfTypeExpression::Builder builder{fbb_}; + builder.add_typeid_loc(ast->typeidLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_id(typeId.o); + builder.add_rparen_loc(ast->rparenLoc.index()); - auto designatorListOffsetsVector = fbb_.CreateVector(designatorListOffsets); - auto designatorListTypesVector = fbb_.CreateVector(designatorListTypes); + offset_ = builder.Finish().Union(); + type_ = io::Expression_TypeidOfTypeExpression; +} - const auto [initializer, initializerType] = - acceptExpression(ast->initializer); +void ASTEncoder::visit(SpliceExpressionAST* ast) { + const auto splicer = accept(ast->splicer); - io::DesignatedInitializerClause::Builder builder{fbb_}; - builder.add_designator_list(designatorListOffsetsVector); - builder.add_designator_list_type(designatorListTypesVector); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); + io::SpliceExpression::Builder builder{fbb_}; + builder.add_splicer(splicer.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_DesignatedInitializerClause; + type_ = io::Expression_SpliceExpression; } -void ASTEncoder::visit(TypeTraitExpressionAST* ast) { - std::vector> typeIdListOffsets; - for (auto node : ListView{ast->typeIdList}) { - if (!node) continue; - typeIdListOffsets.emplace_back(accept(node).o); - } - - auto typeIdListOffsetsVector = fbb_.CreateVector(typeIdListOffsets); - - io::TypeTraitExpression::Builder builder{fbb_}; - builder.add_type_trait_loc(ast->typeTraitLoc.index()); - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_type_id_list(typeIdListOffsetsVector); - builder.add_rparen_loc(ast->rparenLoc.index()); +void ASTEncoder::visit(GlobalScopeReflectExpressionAST* ast) { + io::GlobalScopeReflectExpression::Builder builder{fbb_}; + builder.add_caret_loc(ast->caretLoc.index()); + builder.add_scope_loc(ast->scopeLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Expression_TypeTraitExpression; + type_ = io::Expression_GlobalScopeReflectExpression; } -void ASTEncoder::visit(ConditionExpressionAST* ast) { - std::vector> attributeListOffsets; - std::vector> - attributeListTypes; - - for (auto node : ListView{ast->attributeList}) { - if (!node) continue; - const auto [offset, type] = acceptAttributeSpecifier(node); - attributeListOffsets.push_back(offset); - attributeListTypes.push_back(type); +void ASTEncoder::visit(NamespaceReflectExpressionAST* ast) { + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } } - auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); - auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); - - std::vector> declSpecifierListOffsets; - std::vector> declSpecifierListTypes; - - for (auto node : ListView{ast->declSpecifierList}) { - if (!node) continue; - const auto [offset, type] = acceptSpecifier(node); - declSpecifierListOffsets.push_back(offset); - declSpecifierListTypes.push_back(type); + io::NamespaceReflectExpression::Builder builder{fbb_}; + builder.add_caret_loc(ast->caretLoc.index()); + builder.add_identifier_loc(ast->identifierLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); } - auto declSpecifierListOffsetsVector = - fbb_.CreateVector(declSpecifierListOffsets); - auto declSpecifierListTypesVector = fbb_.CreateVector(declSpecifierListTypes); - - const auto declarator = accept(ast->declarator); + offset_ = builder.Finish().Union(); + type_ = io::Expression_NamespaceReflectExpression; +} - const auto [initializer, initializerType] = - acceptExpression(ast->initializer); +void ASTEncoder::visit(TypeIdReflectExpressionAST* ast) { + const auto typeId = accept(ast->typeId); - io::ConditionExpression::Builder builder{fbb_}; - builder.add_attribute_list(attributeListOffsetsVector); - builder.add_attribute_list_type(attributeListTypesVector); - builder.add_decl_specifier_list(declSpecifierListOffsetsVector); - builder.add_decl_specifier_list_type(declSpecifierListTypesVector); - builder.add_declarator(declarator.o); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); + io::TypeIdReflectExpression::Builder builder{fbb_}; + builder.add_caret_loc(ast->caretLoc.index()); + builder.add_type_id(typeId.o); offset_ = builder.Finish().Union(); - type_ = io::Expression_ConditionExpression; + type_ = io::Expression_TypeIdReflectExpression; } -void ASTEncoder::visit(EqualInitializerAST* ast) { +void ASTEncoder::visit(ReflectExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::EqualInitializer::Builder builder{fbb_}; - builder.add_equal_loc(ast->equalLoc.index()); + io::ReflectExpression::Builder builder{fbb_}; + builder.add_caret_loc(ast->caretLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_EqualInitializer; + type_ = io::Expression_ReflectExpression; } -void ASTEncoder::visit(BracedInitListAST* ast) { - std::vector> expressionListOffsets; - std::vector> expressionListTypes; - - for (auto node : ListView{ast->expressionList}) { - if (!node) continue; - const auto [offset, type] = acceptExpression(node); - expressionListOffsets.push_back(offset); - expressionListTypes.push_back(type); +void ASTEncoder::visit(LabelAddressExpressionAST* ast) { + flatbuffers::Offset identifier; + if (ast->identifier) { + if (identifiers_.contains(ast->identifier)) { + identifier = identifiers_.at(ast->identifier); + } else { + identifier = fbb_.CreateString(ast->identifier->value()); + identifiers_.emplace(ast->identifier, identifier); + } } - auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); - auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); - - io::BracedInitList::Builder builder{fbb_}; - builder.add_lbrace_loc(ast->lbraceLoc.index()); - builder.add_expression_list(expressionListOffsetsVector); - builder.add_expression_list_type(expressionListTypesVector); - builder.add_comma_loc(ast->commaLoc.index()); - builder.add_rbrace_loc(ast->rbraceLoc.index()); + io::LabelAddressExpression::Builder builder{fbb_}; + builder.add_amp_amp_loc(ast->ampAmpLoc.index()); + builder.add_identifier_loc(ast->identifierLoc.index()); + if (ast->identifier) { + builder.add_identifier(identifier); + } offset_ = builder.Finish().Union(); - type_ = io::Expression_BracedInitList; + type_ = io::Expression_LabelAddressExpression; } -void ASTEncoder::visit(ParenInitializerAST* ast) { - std::vector> expressionListOffsets; - std::vector> expressionListTypes; +void ASTEncoder::visit(UnaryExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - for (auto node : ListView{ast->expressionList}) { - if (!node) continue; - const auto [offset, type] = acceptExpression(node); - expressionListOffsets.push_back(offset); - expressionListTypes.push_back(type); - } + io::UnaryExpression::Builder builder{fbb_}; + builder.add_op_loc(ast->opLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_op(static_cast(ast->op)); - auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); - auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); + offset_ = builder.Finish().Union(); + type_ = io::Expression_UnaryExpression; +} - io::ParenInitializer::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression_list(expressionListOffsetsVector); - builder.add_expression_list_type(expressionListTypesVector); - builder.add_rparen_loc(ast->rparenLoc.index()); +void ASTEncoder::visit(AwaitExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); + + io::AwaitExpression::Builder builder{fbb_}; + builder.add_await_loc(ast->awaitLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); - type_ = io::Expression_ParenInitializer; + type_ = io::Expression_AwaitExpression; } -void ASTEncoder::visit(DefaultGenericAssociationAST* ast) { +void ASTEncoder::visit(SizeofExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::DefaultGenericAssociation::Builder builder{fbb_}; - builder.add_default_loc(ast->defaultLoc.index()); - builder.add_colon_loc(ast->colonLoc.index()); + io::SizeofExpression::Builder builder{fbb_}; + builder.add_sizeof_loc(ast->sizeofLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); - type_ = io::GenericAssociation_DefaultGenericAssociation; + type_ = io::Expression_SizeofExpression; } -void ASTEncoder::visit(TypeGenericAssociationAST* ast) { +void ASTEncoder::visit(SizeofTypeExpressionAST* ast) { const auto typeId = accept(ast->typeId); - const auto [expression, expressionType] = acceptExpression(ast->expression); - - io::TypeGenericAssociation::Builder builder{fbb_}; + io::SizeofTypeExpression::Builder builder{fbb_}; + builder.add_sizeof_loc(ast->sizeofLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_type_id(typeId.o); - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::GenericAssociation_TypeGenericAssociation; + type_ = io::Expression_SizeofTypeExpression; } -void ASTEncoder::visit(DotDesignatorAST* ast) { +void ASTEncoder::visit(SizeofPackExpressionAST* ast) { flatbuffers::Offset identifier; if (ast->identifier) { if (identifiers_.contains(ast->identifier)) { @@ -3036,361 +3144,290 @@ void ASTEncoder::visit(DotDesignatorAST* ast) { } } - io::DotDesignator::Builder builder{fbb_}; - builder.add_dot_loc(ast->dotLoc.index()); + io::SizeofPackExpression::Builder builder{fbb_}; + builder.add_sizeof_loc(ast->sizeofLoc.index()); + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); builder.add_identifier_loc(ast->identifierLoc.index()); + builder.add_rparen_loc(ast->rparenLoc.index()); if (ast->identifier) { builder.add_identifier(identifier); } offset_ = builder.Finish().Union(); - type_ = io::Designator_DotDesignator; + type_ = io::Expression_SizeofPackExpression; } -void ASTEncoder::visit(SubscriptDesignatorAST* ast) { - const auto [expression, expressionType] = acceptExpression(ast->expression); +void ASTEncoder::visit(AlignofTypeExpressionAST* ast) { + const auto typeId = accept(ast->typeId); - io::SubscriptDesignator::Builder builder{fbb_}; - builder.add_lbracket_loc(ast->lbracketLoc.index()); - builder.add_expression(expression); - builder.add_expression_type(static_cast(expressionType)); - builder.add_rbracket_loc(ast->rbracketLoc.index()); + io::AlignofTypeExpression::Builder builder{fbb_}; + builder.add_alignof_loc(ast->alignofLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_id(typeId.o); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); - type_ = io::Designator_SubscriptDesignator; + type_ = io::Expression_AlignofTypeExpression; } -void ASTEncoder::visit(SplicerAST* ast) { +void ASTEncoder::visit(AlignofExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::Splicer::Builder builder{fbb_}; - builder.add_lbracket_loc(ast->lbracketLoc.index()); - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + io::AlignofExpression::Builder builder{fbb_}; + builder.add_alignof_loc(ast->alignofLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - builder.add_second_colon_loc(ast->secondColonLoc.index()); - builder.add_rbracket_loc(ast->rbracketLoc.index()); offset_ = builder.Finish().Union(); + type_ = io::Expression_AlignofExpression; } -void ASTEncoder::visit(GlobalModuleFragmentAST* ast) { - std::vector> declarationListOffsets; - std::vector> declarationListTypes; - - for (auto node : ListView{ast->declarationList}) { - if (!node) continue; - const auto [offset, type] = acceptDeclaration(node); - declarationListOffsets.push_back(offset); - declarationListTypes.push_back(type); - } - - auto declarationListOffsetsVector = fbb_.CreateVector(declarationListOffsets); - auto declarationListTypesVector = fbb_.CreateVector(declarationListTypes); +void ASTEncoder::visit(NoexceptExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::GlobalModuleFragment::Builder builder{fbb_}; - builder.add_module_loc(ast->moduleLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); - builder.add_declaration_list(declarationListOffsetsVector); - builder.add_declaration_list_type(declarationListTypesVector); + io::NoexceptExpression::Builder builder{fbb_}; + builder.add_noexcept_loc(ast->noexceptLoc.index()); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); + type_ = io::Expression_NoexceptExpression; } -void ASTEncoder::visit(PrivateModuleFragmentAST* ast) { - std::vector> declarationListOffsets; - std::vector> declarationListTypes; +void ASTEncoder::visit(NewExpressionAST* ast) { + const auto newPlacement = accept(ast->newPlacement); - for (auto node : ListView{ast->declarationList}) { + std::vector> typeSpecifierListOffsets; + std::vector> typeSpecifierListTypes; + + for (auto node : ListView{ast->typeSpecifierList}) { if (!node) continue; - const auto [offset, type] = acceptDeclaration(node); - declarationListOffsets.push_back(offset); - declarationListTypes.push_back(type); + const auto [offset, type] = acceptSpecifier(node); + typeSpecifierListOffsets.push_back(offset); + typeSpecifierListTypes.push_back(type); } - auto declarationListOffsetsVector = fbb_.CreateVector(declarationListOffsets); - auto declarationListTypesVector = fbb_.CreateVector(declarationListTypes); - - io::PrivateModuleFragment::Builder builder{fbb_}; - builder.add_module_loc(ast->moduleLoc.index()); - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_private_loc(ast->privateLoc.index()); - builder.add_semicolon_loc(ast->semicolonLoc.index()); - builder.add_declaration_list(declarationListOffsetsVector); - builder.add_declaration_list_type(declarationListTypesVector); - - offset_ = builder.Finish().Union(); -} - -void ASTEncoder::visit(ModuleDeclarationAST* ast) { - const auto moduleName = accept(ast->moduleName); - - const auto modulePartition = accept(ast->modulePartition); - - std::vector> attributeListOffsets; - std::vector> - attributeListTypes; + auto typeSpecifierListOffsetsVector = + fbb_.CreateVector(typeSpecifierListOffsets); + auto typeSpecifierListTypesVector = fbb_.CreateVector(typeSpecifierListTypes); - for (auto node : ListView{ast->attributeList}) { - if (!node) continue; - const auto [offset, type] = acceptAttributeSpecifier(node); - attributeListOffsets.push_back(offset); - attributeListTypes.push_back(type); - } + const auto declarator = accept(ast->declarator); - auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); - auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); + const auto [newInitalizer, newInitalizerType] = + acceptNewInitializer(ast->newInitalizer); - io::ModuleDeclaration::Builder builder{fbb_}; - builder.add_export_loc(ast->exportLoc.index()); - builder.add_module_loc(ast->moduleLoc.index()); - builder.add_module_name(moduleName.o); - builder.add_module_partition(modulePartition.o); - builder.add_attribute_list(attributeListOffsetsVector); - builder.add_attribute_list_type(attributeListTypesVector); - builder.add_semicolon_loc(ast->semicolonLoc.index()); + io::NewExpression::Builder builder{fbb_}; + builder.add_scope_loc(ast->scopeLoc.index()); + builder.add_new_loc(ast->newLoc.index()); + builder.add_new_placement(newPlacement.o); + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_specifier_list(typeSpecifierListOffsetsVector); + builder.add_type_specifier_list_type(typeSpecifierListTypesVector); + builder.add_declarator(declarator.o); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_new_initalizer(newInitalizer); + builder.add_new_initalizer_type( + static_cast(newInitalizerType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_NewExpression; } -void ASTEncoder::visit(ModuleNameAST* ast) { - const auto moduleQualifier = accept(ast->moduleQualifier); - - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } +void ASTEncoder::visit(DeleteExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::ModuleName::Builder builder{fbb_}; - builder.add_module_qualifier(moduleQualifier.o); - builder.add_identifier_loc(ast->identifierLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); - } + io::DeleteExpression::Builder builder{fbb_}; + builder.add_scope_loc(ast->scopeLoc.index()); + builder.add_delete_loc(ast->deleteLoc.index()); + builder.add_lbracket_loc(ast->lbracketLoc.index()); + builder.add_rbracket_loc(ast->rbracketLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_DeleteExpression; } -void ASTEncoder::visit(ModuleQualifierAST* ast) { - const auto moduleQualifier = accept(ast->moduleQualifier); +void ASTEncoder::visit(CastExpressionAST* ast) { + const auto typeId = accept(ast->typeId); - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::ModuleQualifier::Builder builder{fbb_}; - builder.add_module_qualifier(moduleQualifier.o); - builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_dot_loc(ast->dotLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); - } + io::CastExpression::Builder builder{fbb_}; + builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_type_id(typeId.o); + builder.add_rparen_loc(ast->rparenLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_CastExpression; } -void ASTEncoder::visit(ModulePartitionAST* ast) { - const auto moduleName = accept(ast->moduleName); +void ASTEncoder::visit(ImplicitCastExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::ModulePartition::Builder builder{fbb_}; - builder.add_colon_loc(ast->colonLoc.index()); - builder.add_module_name(moduleName.o); + io::ImplicitCastExpression::Builder builder{fbb_}; + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_ImplicitCastExpression; } -void ASTEncoder::visit(ImportNameAST* ast) { - const auto modulePartition = accept(ast->modulePartition); +void ASTEncoder::visit(BinaryExpressionAST* ast) { + const auto [leftExpression, leftExpressionType] = + acceptExpression(ast->leftExpression); - const auto moduleName = accept(ast->moduleName); + const auto [rightExpression, rightExpressionType] = + acceptExpression(ast->rightExpression); - io::ImportName::Builder builder{fbb_}; - builder.add_header_loc(ast->headerLoc.index()); - builder.add_module_partition(modulePartition.o); - builder.add_module_name(moduleName.o); + io::BinaryExpression::Builder builder{fbb_}; + builder.add_left_expression(leftExpression); + builder.add_left_expression_type( + static_cast(leftExpressionType)); + builder.add_op_loc(ast->opLoc.index()); + builder.add_right_expression(rightExpression); + builder.add_right_expression_type( + static_cast(rightExpressionType)); + builder.add_op(static_cast(ast->op)); offset_ = builder.Finish().Union(); + type_ = io::Expression_BinaryExpression; } -void ASTEncoder::visit(InitDeclaratorAST* ast) { - const auto declarator = accept(ast->declarator); +void ASTEncoder::visit(ConditionalExpressionAST* ast) { + const auto [condition, conditionType] = acceptExpression(ast->condition); - const auto requiresClause = accept(ast->requiresClause); + const auto [iftrueExpression, iftrueExpressionType] = + acceptExpression(ast->iftrueExpression); - const auto [initializer, initializerType] = - acceptExpression(ast->initializer); + const auto [iffalseExpression, iffalseExpressionType] = + acceptExpression(ast->iffalseExpression); - io::InitDeclarator::Builder builder{fbb_}; - builder.add_declarator(declarator.o); - builder.add_requires_clause(requiresClause.o); - builder.add_initializer(initializer); - builder.add_initializer_type(static_cast(initializerType)); + io::ConditionalExpression::Builder builder{fbb_}; + builder.add_condition(condition); + builder.add_condition_type(static_cast(conditionType)); + builder.add_question_loc(ast->questionLoc.index()); + builder.add_iftrue_expression(iftrueExpression); + builder.add_iftrue_expression_type( + static_cast(iftrueExpressionType)); + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_iffalse_expression(iffalseExpression); + builder.add_iffalse_expression_type( + static_cast(iffalseExpressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_ConditionalExpression; } -void ASTEncoder::visit(DeclaratorAST* ast) { - std::vector> ptrOpListOffsets; - std::vector> ptrOpListTypes; - - for (auto node : ListView{ast->ptrOpList}) { - if (!node) continue; - const auto [offset, type] = acceptPtrOperator(node); - ptrOpListOffsets.push_back(offset); - ptrOpListTypes.push_back(type); - } - - auto ptrOpListOffsetsVector = fbb_.CreateVector(ptrOpListOffsets); - auto ptrOpListTypesVector = fbb_.CreateVector(ptrOpListTypes); - - const auto [coreDeclarator, coreDeclaratorType] = - acceptCoreDeclarator(ast->coreDeclarator); +void ASTEncoder::visit(YieldExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - std::vector> declaratorChunkListOffsets; - std::vector> - declaratorChunkListTypes; + io::YieldExpression::Builder builder{fbb_}; + builder.add_yield_loc(ast->yieldLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); - for (auto node : ListView{ast->declaratorChunkList}) { - if (!node) continue; - const auto [offset, type] = acceptDeclaratorChunk(node); - declaratorChunkListOffsets.push_back(offset); - declaratorChunkListTypes.push_back(type); - } + offset_ = builder.Finish().Union(); + type_ = io::Expression_YieldExpression; +} - auto declaratorChunkListOffsetsVector = - fbb_.CreateVector(declaratorChunkListOffsets); - auto declaratorChunkListTypesVector = - fbb_.CreateVector(declaratorChunkListTypes); +void ASTEncoder::visit(ThrowExpressionAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::Declarator::Builder builder{fbb_}; - builder.add_ptr_op_list(ptrOpListOffsetsVector); - builder.add_ptr_op_list_type(ptrOpListTypesVector); - builder.add_core_declarator(coreDeclarator); - builder.add_core_declarator_type( - static_cast(coreDeclaratorType)); - builder.add_declarator_chunk_list(declaratorChunkListOffsetsVector); - builder.add_declarator_chunk_list_type(declaratorChunkListTypesVector); + io::ThrowExpression::Builder builder{fbb_}; + builder.add_throw_loc(ast->throwLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_ThrowExpression; } -void ASTEncoder::visit(UsingDeclaratorAST* ast) { - const auto [nestedNameSpecifier, nestedNameSpecifierType] = - acceptNestedNameSpecifier(ast->nestedNameSpecifier); +void ASTEncoder::visit(AssignmentExpressionAST* ast) { + const auto [leftExpression, leftExpressionType] = + acceptExpression(ast->leftExpression); - const auto [unqualifiedId, unqualifiedIdType] = - acceptUnqualifiedId(ast->unqualifiedId); + const auto [rightExpression, rightExpressionType] = + acceptExpression(ast->rightExpression); - io::UsingDeclarator::Builder builder{fbb_}; - builder.add_typename_loc(ast->typenameLoc.index()); - builder.add_nested_name_specifier(nestedNameSpecifier); - builder.add_nested_name_specifier_type( - static_cast(nestedNameSpecifierType)); - builder.add_unqualified_id(unqualifiedId); - builder.add_unqualified_id_type( - static_cast(unqualifiedIdType)); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); + io::AssignmentExpression::Builder builder{fbb_}; + builder.add_left_expression(leftExpression); + builder.add_left_expression_type( + static_cast(leftExpressionType)); + builder.add_op_loc(ast->opLoc.index()); + builder.add_right_expression(rightExpression); + builder.add_right_expression_type( + static_cast(rightExpressionType)); + builder.add_op(static_cast(ast->op)); offset_ = builder.Finish().Union(); + type_ = io::Expression_AssignmentExpression; } -void ASTEncoder::visit(EnumeratorAST* ast) { - std::vector> attributeListOffsets; - std::vector> - attributeListTypes; - - for (auto node : ListView{ast->attributeList}) { - if (!node) continue; - const auto [offset, type] = acceptAttributeSpecifier(node); - attributeListOffsets.push_back(offset); - attributeListTypes.push_back(type); - } - - auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); - auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); - +void ASTEncoder::visit(PackExpansionExpressionAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } - - io::Enumerator::Builder builder{fbb_}; - builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_attribute_list(attributeListOffsetsVector); - builder.add_attribute_list_type(attributeListTypesVector); - builder.add_equal_loc(ast->equalLoc.index()); + io::PackExpansionExpression::Builder builder{fbb_}; builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); - if (ast->identifier) { - builder.add_identifier(identifier); - } + builder.add_ellipsis_loc(ast->ellipsisLoc.index()); offset_ = builder.Finish().Union(); + type_ = io::Expression_PackExpansionExpression; } -void ASTEncoder::visit(TypeIdAST* ast) { - std::vector> typeSpecifierListOffsets; - std::vector> typeSpecifierListTypes; +void ASTEncoder::visit(DesignatedInitializerClauseAST* ast) { + std::vector> designatorListOffsets; + std::vector> designatorListTypes; - for (auto node : ListView{ast->typeSpecifierList}) { + for (auto node : ListView{ast->designatorList}) { if (!node) continue; - const auto [offset, type] = acceptSpecifier(node); - typeSpecifierListOffsets.push_back(offset); - typeSpecifierListTypes.push_back(type); + const auto [offset, type] = acceptDesignator(node); + designatorListOffsets.push_back(offset); + designatorListTypes.push_back(type); } - auto typeSpecifierListOffsetsVector = - fbb_.CreateVector(typeSpecifierListOffsets); - auto typeSpecifierListTypesVector = fbb_.CreateVector(typeSpecifierListTypes); + auto designatorListOffsetsVector = fbb_.CreateVector(designatorListOffsets); + auto designatorListTypesVector = fbb_.CreateVector(designatorListTypes); - const auto declarator = accept(ast->declarator); + const auto [initializer, initializerType] = + acceptExpression(ast->initializer); - io::TypeId::Builder builder{fbb_}; - builder.add_type_specifier_list(typeSpecifierListOffsetsVector); - builder.add_type_specifier_list_type(typeSpecifierListTypesVector); - builder.add_declarator(declarator.o); + io::DesignatedInitializerClause::Builder builder{fbb_}; + builder.add_designator_list(designatorListOffsetsVector); + builder.add_designator_list_type(designatorListTypesVector); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_DesignatedInitializerClause; } -void ASTEncoder::visit(HandlerAST* ast) { - const auto [exceptionDeclaration, exceptionDeclarationType] = - acceptExceptionDeclaration(ast->exceptionDeclaration); +void ASTEncoder::visit(TypeTraitExpressionAST* ast) { + std::vector> typeIdListOffsets; + for (auto node : ListView{ast->typeIdList}) { + if (!node) continue; + typeIdListOffsets.emplace_back(accept(node).o); + } - const auto statement = accept(ast->statement); + auto typeIdListOffsetsVector = fbb_.CreateVector(typeIdListOffsets); - io::Handler::Builder builder{fbb_}; - builder.add_catch_loc(ast->catchLoc.index()); + io::TypeTraitExpression::Builder builder{fbb_}; + builder.add_type_trait_loc(ast->typeTraitLoc.index()); builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_exception_declaration(exceptionDeclaration); - builder.add_exception_declaration_type( - static_cast(exceptionDeclarationType)); + builder.add_type_id_list(typeIdListOffsetsVector); builder.add_rparen_loc(ast->rparenLoc.index()); - builder.add_statement(statement.o); offset_ = builder.Finish().Union(); + type_ = io::Expression_TypeTraitExpression; } -void ASTEncoder::visit(BaseSpecifierAST* ast) { +void ASTEncoder::visit(ConditionExpressionAST* ast) { std::vector> attributeListOffsets; std::vector> attributeListTypes; @@ -3405,182 +3442,128 @@ void ASTEncoder::visit(BaseSpecifierAST* ast) { auto attributeListOffsetsVector = fbb_.CreateVector(attributeListOffsets); auto attributeListTypesVector = fbb_.CreateVector(attributeListTypes); - const auto [nestedNameSpecifier, nestedNameSpecifierType] = - acceptNestedNameSpecifier(ast->nestedNameSpecifier); + std::vector> declSpecifierListOffsets; + std::vector> declSpecifierListTypes; - const auto [unqualifiedId, unqualifiedIdType] = - acceptUnqualifiedId(ast->unqualifiedId); + for (auto node : ListView{ast->declSpecifierList}) { + if (!node) continue; + const auto [offset, type] = acceptSpecifier(node); + declSpecifierListOffsets.push_back(offset); + declSpecifierListTypes.push_back(type); + } - io::BaseSpecifier::Builder builder{fbb_}; + auto declSpecifierListOffsetsVector = + fbb_.CreateVector(declSpecifierListOffsets); + auto declSpecifierListTypesVector = fbb_.CreateVector(declSpecifierListTypes); + + const auto declarator = accept(ast->declarator); + + const auto [initializer, initializerType] = + acceptExpression(ast->initializer); + + io::ConditionExpression::Builder builder{fbb_}; builder.add_attribute_list(attributeListOffsetsVector); builder.add_attribute_list_type(attributeListTypesVector); - builder.add_virtual_or_access_loc(ast->virtualOrAccessLoc.index()); - builder.add_other_virtual_or_access_loc(ast->otherVirtualOrAccessLoc.index()); - builder.add_nested_name_specifier(nestedNameSpecifier); - builder.add_nested_name_specifier_type( - static_cast(nestedNameSpecifierType)); - builder.add_template_loc(ast->templateLoc.index()); - builder.add_unqualified_id(unqualifiedId); - builder.add_unqualified_id_type( - static_cast(unqualifiedIdType)); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); - builder.add_access_specifier( - static_cast(ast->accessSpecifier)); + builder.add_decl_specifier_list(declSpecifierListOffsetsVector); + builder.add_decl_specifier_list_type(declSpecifierListTypesVector); + builder.add_declarator(declarator.o); + builder.add_initializer(initializer); + builder.add_initializer_type(static_cast(initializerType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_ConditionExpression; } -void ASTEncoder::visit(RequiresClauseAST* ast) { +void ASTEncoder::visit(EqualInitializerAST* ast) { const auto [expression, expressionType] = acceptExpression(ast->expression); - io::RequiresClause::Builder builder{fbb_}; - builder.add_requires_loc(ast->requiresLoc.index()); + io::EqualInitializer::Builder builder{fbb_}; + builder.add_equal_loc(ast->equalLoc.index()); builder.add_expression(expression); builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::Expression_EqualInitializer; } -void ASTEncoder::visit(ParameterDeclarationClauseAST* ast) { - std::vector> - parameterDeclarationListOffsets; - for (auto node : ListView{ast->parameterDeclarationList}) { +void ASTEncoder::visit(BracedInitListAST* ast) { + std::vector> expressionListOffsets; + std::vector> expressionListTypes; + + for (auto node : ListView{ast->expressionList}) { if (!node) continue; - parameterDeclarationListOffsets.emplace_back(accept(node).o); + const auto [offset, type] = acceptExpression(node); + expressionListOffsets.push_back(offset); + expressionListTypes.push_back(type); } - auto parameterDeclarationListOffsetsVector = - fbb_.CreateVector(parameterDeclarationListOffsets); + auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); + auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); - io::ParameterDeclarationClause::Builder builder{fbb_}; - builder.add_parameter_declaration_list(parameterDeclarationListOffsetsVector); + io::BracedInitList::Builder builder{fbb_}; + builder.add_lbrace_loc(ast->lbraceLoc.index()); + builder.add_expression_list(expressionListOffsetsVector); + builder.add_expression_list_type(expressionListTypesVector); builder.add_comma_loc(ast->commaLoc.index()); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); - - offset_ = builder.Finish().Union(); -} - -void ASTEncoder::visit(TrailingReturnTypeAST* ast) { - const auto typeId = accept(ast->typeId); - - io::TrailingReturnType::Builder builder{fbb_}; - builder.add_minus_greater_loc(ast->minusGreaterLoc.index()); - builder.add_type_id(typeId.o); - - offset_ = builder.Finish().Union(); -} - -void ASTEncoder::visit(LambdaSpecifierAST* ast) { - io::LambdaSpecifier::Builder builder{fbb_}; - builder.add_specifier_loc(ast->specifierLoc.index()); - builder.add_specifier(static_cast(ast->specifier)); + builder.add_rbrace_loc(ast->rbraceLoc.index()); offset_ = builder.Finish().Union(); + type_ = io::Expression_BracedInitList; } -void ASTEncoder::visit(TypeConstraintAST* ast) { - const auto [nestedNameSpecifier, nestedNameSpecifierType] = - acceptNestedNameSpecifier(ast->nestedNameSpecifier); - - std::vector> templateArgumentListOffsets; - std::vector> - templateArgumentListTypes; +void ASTEncoder::visit(ParenInitializerAST* ast) { + std::vector> expressionListOffsets; + std::vector> expressionListTypes; - for (auto node : ListView{ast->templateArgumentList}) { + for (auto node : ListView{ast->expressionList}) { if (!node) continue; - const auto [offset, type] = acceptTemplateArgument(node); - templateArgumentListOffsets.push_back(offset); - templateArgumentListTypes.push_back(type); - } - - auto templateArgumentListOffsetsVector = - fbb_.CreateVector(templateArgumentListOffsets); - auto templateArgumentListTypesVector = - fbb_.CreateVector(templateArgumentListTypes); - - flatbuffers::Offset identifier; - if (ast->identifier) { - if (identifiers_.contains(ast->identifier)) { - identifier = identifiers_.at(ast->identifier); - } else { - identifier = fbb_.CreateString(ast->identifier->value()); - identifiers_.emplace(ast->identifier, identifier); - } - } - - io::TypeConstraint::Builder builder{fbb_}; - builder.add_nested_name_specifier(nestedNameSpecifier); - builder.add_nested_name_specifier_type( - static_cast(nestedNameSpecifierType)); - builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_less_loc(ast->lessLoc.index()); - builder.add_template_argument_list(templateArgumentListOffsetsVector); - builder.add_template_argument_list_type(templateArgumentListTypesVector); - builder.add_greater_loc(ast->greaterLoc.index()); - if (ast->identifier) { - builder.add_identifier(identifier); + const auto [offset, type] = acceptExpression(node); + expressionListOffsets.push_back(offset); + expressionListTypes.push_back(type); } - offset_ = builder.Finish().Union(); -} + auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); + auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); -void ASTEncoder::visit(AttributeArgumentClauseAST* ast) { - io::AttributeArgumentClause::Builder builder{fbb_}; + io::ParenInitializer::Builder builder{fbb_}; builder.add_lparen_loc(ast->lparenLoc.index()); + builder.add_expression_list(expressionListOffsetsVector); + builder.add_expression_list_type(expressionListTypesVector); builder.add_rparen_loc(ast->rparenLoc.index()); offset_ = builder.Finish().Union(); + type_ = io::Expression_ParenInitializer; } -void ASTEncoder::visit(AttributeAST* ast) { - const auto [attributeToken, attributeTokenType] = - acceptAttributeToken(ast->attributeToken); - - const auto attributeArgumentClause = accept(ast->attributeArgumentClause); - - io::Attribute::Builder builder{fbb_}; - builder.add_attribute_token(attributeToken); - builder.add_attribute_token_type( - static_cast(attributeTokenType)); - builder.add_attribute_argument_clause(attributeArgumentClause.o); - builder.add_ellipsis_loc(ast->ellipsisLoc.index()); - - offset_ = builder.Finish().Union(); -} +void ASTEncoder::visit(DefaultGenericAssociationAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); -void ASTEncoder::visit(AttributeUsingPrefixAST* ast) { - io::AttributeUsingPrefix::Builder builder{fbb_}; - builder.add_using_loc(ast->usingLoc.index()); - builder.add_attribute_namespace_loc(ast->attributeNamespaceLoc.index()); + io::DefaultGenericAssociation::Builder builder{fbb_}; + builder.add_default_loc(ast->defaultLoc.index()); builder.add_colon_loc(ast->colonLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::GenericAssociation_DefaultGenericAssociation; } -void ASTEncoder::visit(NewPlacementAST* ast) { - std::vector> expressionListOffsets; - std::vector> expressionListTypes; - - for (auto node : ListView{ast->expressionList}) { - if (!node) continue; - const auto [offset, type] = acceptExpression(node); - expressionListOffsets.push_back(offset); - expressionListTypes.push_back(type); - } +void ASTEncoder::visit(TypeGenericAssociationAST* ast) { + const auto typeId = accept(ast->typeId); - auto expressionListOffsetsVector = fbb_.CreateVector(expressionListOffsets); - auto expressionListTypesVector = fbb_.CreateVector(expressionListTypes); + const auto [expression, expressionType] = acceptExpression(ast->expression); - io::NewPlacement::Builder builder{fbb_}; - builder.add_lparen_loc(ast->lparenLoc.index()); - builder.add_expression_list(expressionListOffsetsVector); - builder.add_expression_list_type(expressionListTypesVector); - builder.add_rparen_loc(ast->rparenLoc.index()); + io::TypeGenericAssociation::Builder builder{fbb_}; + builder.add_type_id(typeId.o); + builder.add_colon_loc(ast->colonLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); offset_ = builder.Finish().Union(); + type_ = io::GenericAssociation_TypeGenericAssociation; } -void ASTEncoder::visit(NestedNamespaceSpecifierAST* ast) { +void ASTEncoder::visit(DotDesignatorAST* ast) { flatbuffers::Offset identifier; if (ast->identifier) { if (identifiers_.contains(ast->identifier)) { @@ -3591,15 +3574,28 @@ void ASTEncoder::visit(NestedNamespaceSpecifierAST* ast) { } } - io::NestedNamespaceSpecifier::Builder builder{fbb_}; - builder.add_inline_loc(ast->inlineLoc.index()); + io::DotDesignator::Builder builder{fbb_}; + builder.add_dot_loc(ast->dotLoc.index()); builder.add_identifier_loc(ast->identifierLoc.index()); - builder.add_scope_loc(ast->scopeLoc.index()); if (ast->identifier) { builder.add_identifier(identifier); } offset_ = builder.Finish().Union(); + type_ = io::Designator_DotDesignator; +} + +void ASTEncoder::visit(SubscriptDesignatorAST* ast) { + const auto [expression, expressionType] = acceptExpression(ast->expression); + + io::SubscriptDesignator::Builder builder{fbb_}; + builder.add_lbracket_loc(ast->lbracketLoc.index()); + builder.add_expression(expression); + builder.add_expression_type(static_cast(expressionType)); + builder.add_rbracket_loc(ast->rbracketLoc.index()); + + offset_ = builder.Finish().Union(); + type_ = io::Designator_SubscriptDesignator; } void ASTEncoder::visit(TemplateTypeParameterAST* ast) { diff --git a/src/parser/cxx/private/ast_decoder.h b/src/parser/cxx/private/ast_decoder.h index 20b7a5a1..2302f910 100644 --- a/src/parser/cxx/private/ast_decoder.h +++ b/src/parser/cxx/private/ast_decoder.h @@ -138,10 +138,52 @@ class ASTDecoder { auto decodeStructuredBindingDeclaration( const io::StructuredBindingDeclaration* node) -> StructuredBindingDeclarationAST*; + auto decodeAsmOperand(const io::AsmOperand* node) -> AsmOperandAST*; auto decodeAsmQualifier(const io::AsmQualifier* node) -> AsmQualifierAST*; auto decodeAsmClobber(const io::AsmClobber* node) -> AsmClobberAST*; auto decodeAsmGotoLabel(const io::AsmGotoLabel* node) -> AsmGotoLabelAST*; + auto decodeSplicer(const io::Splicer* node) -> SplicerAST*; + auto decodeGlobalModuleFragment(const io::GlobalModuleFragment* node) + -> GlobalModuleFragmentAST*; + auto decodePrivateModuleFragment(const io::PrivateModuleFragment* node) + -> PrivateModuleFragmentAST*; + auto decodeModuleDeclaration(const io::ModuleDeclaration* node) + -> ModuleDeclarationAST*; + auto decodeModuleName(const io::ModuleName* node) -> ModuleNameAST*; + auto decodeModuleQualifier(const io::ModuleQualifier* node) + -> ModuleQualifierAST*; + auto decodeModulePartition(const io::ModulePartition* node) + -> ModulePartitionAST*; + auto decodeImportName(const io::ImportName* node) -> ImportNameAST*; + auto decodeInitDeclarator(const io::InitDeclarator* node) + -> InitDeclaratorAST*; + auto decodeDeclarator(const io::Declarator* node) -> DeclaratorAST*; + auto decodeUsingDeclarator(const io::UsingDeclarator* node) + -> UsingDeclaratorAST*; + auto decodeEnumerator(const io::Enumerator* node) -> EnumeratorAST*; + auto decodeTypeId(const io::TypeId* node) -> TypeIdAST*; + auto decodeHandler(const io::Handler* node) -> HandlerAST*; + auto decodeBaseSpecifier(const io::BaseSpecifier* node) -> BaseSpecifierAST*; + auto decodeRequiresClause(const io::RequiresClause* node) + -> RequiresClauseAST*; + auto decodeParameterDeclarationClause( + const io::ParameterDeclarationClause* node) + -> ParameterDeclarationClauseAST*; + auto decodeTrailingReturnType(const io::TrailingReturnType* node) + -> TrailingReturnTypeAST*; + auto decodeLambdaSpecifier(const io::LambdaSpecifier* node) + -> LambdaSpecifierAST*; + auto decodeTypeConstraint(const io::TypeConstraint* node) + -> TypeConstraintAST*; + auto decodeAttributeArgumentClause(const io::AttributeArgumentClause* node) + -> AttributeArgumentClauseAST*; + auto decodeAttribute(const io::Attribute* node) -> AttributeAST*; + auto decodeAttributeUsingPrefix(const io::AttributeUsingPrefix* node) + -> AttributeUsingPrefixAST*; + auto decodeNewPlacement(const io::NewPlacement* node) -> NewPlacementAST*; + auto decodeNestedNamespaceSpecifier(const io::NestedNamespaceSpecifier* node) + -> NestedNamespaceSpecifierAST*; auto decodeLabeledStatement(const io::LabeledStatement* node) -> LabeledStatementAST*; @@ -318,48 +360,6 @@ class ASTDecoder { auto decodeSubscriptDesignator(const io::SubscriptDesignator* node) -> SubscriptDesignatorAST*; - auto decodeSplicer(const io::Splicer* node) -> SplicerAST*; - auto decodeGlobalModuleFragment(const io::GlobalModuleFragment* node) - -> GlobalModuleFragmentAST*; - auto decodePrivateModuleFragment(const io::PrivateModuleFragment* node) - -> PrivateModuleFragmentAST*; - auto decodeModuleDeclaration(const io::ModuleDeclaration* node) - -> ModuleDeclarationAST*; - auto decodeModuleName(const io::ModuleName* node) -> ModuleNameAST*; - auto decodeModuleQualifier(const io::ModuleQualifier* node) - -> ModuleQualifierAST*; - auto decodeModulePartition(const io::ModulePartition* node) - -> ModulePartitionAST*; - auto decodeImportName(const io::ImportName* node) -> ImportNameAST*; - auto decodeInitDeclarator(const io::InitDeclarator* node) - -> InitDeclaratorAST*; - auto decodeDeclarator(const io::Declarator* node) -> DeclaratorAST*; - auto decodeUsingDeclarator(const io::UsingDeclarator* node) - -> UsingDeclaratorAST*; - auto decodeEnumerator(const io::Enumerator* node) -> EnumeratorAST*; - auto decodeTypeId(const io::TypeId* node) -> TypeIdAST*; - auto decodeHandler(const io::Handler* node) -> HandlerAST*; - auto decodeBaseSpecifier(const io::BaseSpecifier* node) -> BaseSpecifierAST*; - auto decodeRequiresClause(const io::RequiresClause* node) - -> RequiresClauseAST*; - auto decodeParameterDeclarationClause( - const io::ParameterDeclarationClause* node) - -> ParameterDeclarationClauseAST*; - auto decodeTrailingReturnType(const io::TrailingReturnType* node) - -> TrailingReturnTypeAST*; - auto decodeLambdaSpecifier(const io::LambdaSpecifier* node) - -> LambdaSpecifierAST*; - auto decodeTypeConstraint(const io::TypeConstraint* node) - -> TypeConstraintAST*; - auto decodeAttributeArgumentClause(const io::AttributeArgumentClause* node) - -> AttributeArgumentClauseAST*; - auto decodeAttribute(const io::Attribute* node) -> AttributeAST*; - auto decodeAttributeUsingPrefix(const io::AttributeUsingPrefix* node) - -> AttributeUsingPrefixAST*; - auto decodeNewPlacement(const io::NewPlacement* node) -> NewPlacementAST*; - auto decodeNestedNamespaceSpecifier(const io::NestedNamespaceSpecifier* node) - -> NestedNamespaceSpecifierAST*; - auto decodeTemplateTypeParameter(const io::TemplateTypeParameter* node) -> TemplateTypeParameterAST*; auto decodeNonTypeTemplateParameter(const io::NonTypeTemplateParameter* node) diff --git a/src/parser/cxx/private/ast_encoder.h b/src/parser/cxx/private/ast_encoder.h index 0f95c6cf..08d9b0c9 100644 --- a/src/parser/cxx/private/ast_encoder.h +++ b/src/parser/cxx/private/ast_encoder.h @@ -156,10 +156,36 @@ class ASTEncoder : ASTVisitor { void visit(AccessDeclarationAST* ast) override; void visit(ForRangeDeclarationAST* ast) override; void visit(StructuredBindingDeclarationAST* ast) override; + void visit(AsmOperandAST* ast) override; void visit(AsmQualifierAST* ast) override; void visit(AsmClobberAST* ast) override; void visit(AsmGotoLabelAST* ast) override; + void visit(SplicerAST* ast) override; + void visit(GlobalModuleFragmentAST* ast) override; + void visit(PrivateModuleFragmentAST* ast) override; + void visit(ModuleDeclarationAST* ast) override; + void visit(ModuleNameAST* ast) override; + void visit(ModuleQualifierAST* ast) override; + void visit(ModulePartitionAST* ast) override; + void visit(ImportNameAST* ast) override; + void visit(InitDeclaratorAST* ast) override; + void visit(DeclaratorAST* ast) override; + void visit(UsingDeclaratorAST* ast) override; + void visit(EnumeratorAST* ast) override; + void visit(TypeIdAST* ast) override; + void visit(HandlerAST* ast) override; + void visit(BaseSpecifierAST* ast) override; + void visit(RequiresClauseAST* ast) override; + void visit(ParameterDeclarationClauseAST* ast) override; + void visit(TrailingReturnTypeAST* ast) override; + void visit(LambdaSpecifierAST* ast) override; + void visit(TypeConstraintAST* ast) override; + void visit(AttributeArgumentClauseAST* ast) override; + void visit(AttributeAST* ast) override; + void visit(AttributeUsingPrefixAST* ast) override; + void visit(NewPlacementAST* ast) override; + void visit(NestedNamespaceSpecifierAST* ast) override; void visit(LabeledStatementAST* ast) override; void visit(CaseStatementAST* ast) override; @@ -250,32 +276,6 @@ class ASTEncoder : ASTVisitor { void visit(DotDesignatorAST* ast) override; void visit(SubscriptDesignatorAST* ast) override; - void visit(SplicerAST* ast) override; - void visit(GlobalModuleFragmentAST* ast) override; - void visit(PrivateModuleFragmentAST* ast) override; - void visit(ModuleDeclarationAST* ast) override; - void visit(ModuleNameAST* ast) override; - void visit(ModuleQualifierAST* ast) override; - void visit(ModulePartitionAST* ast) override; - void visit(ImportNameAST* ast) override; - void visit(InitDeclaratorAST* ast) override; - void visit(DeclaratorAST* ast) override; - void visit(UsingDeclaratorAST* ast) override; - void visit(EnumeratorAST* ast) override; - void visit(TypeIdAST* ast) override; - void visit(HandlerAST* ast) override; - void visit(BaseSpecifierAST* ast) override; - void visit(RequiresClauseAST* ast) override; - void visit(ParameterDeclarationClauseAST* ast) override; - void visit(TrailingReturnTypeAST* ast) override; - void visit(LambdaSpecifierAST* ast) override; - void visit(TypeConstraintAST* ast) override; - void visit(AttributeArgumentClauseAST* ast) override; - void visit(AttributeAST* ast) override; - void visit(AttributeUsingPrefixAST* ast) override; - void visit(NewPlacementAST* ast) override; - void visit(NestedNamespaceSpecifierAST* ast) override; - void visit(TemplateTypeParameterAST* ast) override; void visit(NonTypeTemplateParameterAST* ast) override; void visit(TypenameTypeParameterAST* ast) override;