1 /** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ES2PANDA_IR_AST_NODE_MAPPING_H 17 #define ES2PANDA_IR_AST_NODE_MAPPING_H 18 19 #define AST_NODE_MAPPING(_) \ 20 _(ARROW_FUNCTION_EXPRESSION, ArrowFunctionExpression) \ 21 _(AWAIT_EXPRESSION, AwaitExpression) \ 22 _(BIGINT_LITERAL, BigIntLiteral) \ 23 _(BINARY_EXPRESSION, BinaryExpression) \ 24 _(BLOCK_STATEMENT, BlockStatement) \ 25 _(BOOLEAN_LITERAL, BooleanLiteral) \ 26 _(BREAK_STATEMENT, BreakStatement) \ 27 _(CALL_EXPRESSION, CallExpression) \ 28 _(CATCH_CLAUSE, CatchClause) \ 29 _(CHAIN_EXPRESSION, ChainExpression) \ 30 _(CLASS_DEFINITION, ClassDefinition) \ 31 _(CLASS_DECLARATION, ClassDeclaration) \ 32 _(CLASS_EXPRESSION, ClassExpression) \ 33 _(CLASS_PROPERTY, ClassProperty) \ 34 _(CONDITIONAL_EXPRESSION, ConditionalExpression) \ 35 _(CONTINUE_STATEMENT, ContinueStatement) \ 36 _(DEBUGGER_STATEMENT, DebuggerStatement) \ 37 _(DECORATOR, Decorator) \ 38 _(DO_WHILE_STATEMENT, DoWhileStatement) \ 39 _(EMPTY_STATEMENT, EmptyStatement) \ 40 _(EXPORT_ALL_DECLARATION, ExportAllDeclaration) \ 41 _(EXPORT_DEFAULT_DECLARATION, ExportDefaultDeclaration) \ 42 _(EXPORT_NAMED_DECLARATION, ExportNamedDeclaration) \ 43 _(EXPORT_SPECIFIER, ExportSpecifier) \ 44 _(EXPRESSION_STATEMENT, ExpressionStatement) \ 45 _(FOR_IN_STATEMENT, ForInStatement) \ 46 _(FOR_OF_STATEMENT, ForOfStatement) \ 47 _(FOR_UPDATE_STATEMENT, ForUpdateStatement) \ 48 _(FUNCTION_DECLARATION, FunctionDeclaration) \ 49 _(FUNCTION_EXPRESSION, FunctionExpression) \ 50 _(IDENTIFIER, Identifier) \ 51 _(IF_STATEMENT, IfStatement) \ 52 _(IMPORT_DECLARATION, ImportDeclaration) \ 53 _(IMPORT_EXPRESSION, ImportExpression) \ 54 _(IMPORT_DEFAULT_SPECIFIER, ImportDefaultSpecifier) \ 55 _(IMPORT_NAMESPACE_SPECIFIER, ImportNamespaceSpecifier) \ 56 _(IMPORT_SPECIFIER, ImportSpecifier) \ 57 _(LABELLED_STATEMENT, LabelledStatement) \ 58 _(MEMBER_EXPRESSION, MemberExpression) \ 59 _(META_PROPERTY_EXPRESSION, MetaProperty) \ 60 _(METHOD_DEFINITION, MethodDefinition) \ 61 _(NEW_EXPRESSION, NewExpression) \ 62 _(NULL_LITERAL, NullLiteral) \ 63 _(NUMBER_LITERAL, NumberLiteral) \ 64 _(OMITTED_EXPRESSION, OmittedExpression) \ 65 _(PROPERTY, Property) \ 66 _(REGEXP_LITERAL, RegExpLiteral) \ 67 _(RETURN_STATEMENT, ReturnStatement) \ 68 _(SCRIPT_FUNCTION, ScriptFunction) \ 69 _(SEQUENCE_EXPRESSION, SequenceExpression) \ 70 _(STRING_LITERAL, StringLiteral) \ 71 _(SUPER_EXPRESSION, SuperExpression) \ 72 _(SWITCH_CASE_STATEMENT, SwitchCaseStatement) \ 73 _(SWITCH_STATEMENT, SwitchStatement) \ 74 _(TS_ENUM_DECLARATION, TSEnumDeclaration) \ 75 _(TS_ENUM_MEMBER, TSEnumMember) \ 76 _(TS_EXTERNAL_MODULE_REFERENCE, TSExternalModuleReference) \ 77 _(TS_PRIVATE_IDENTIFIER, TSPrivateIdentifier) \ 78 _(TS_NUMBER_KEYWORD, TSNumberKeyword) \ 79 _(TS_ANY_KEYWORD, TSAnyKeyword) \ 80 _(TS_STRING_KEYWORD, TSStringKeyword) \ 81 _(TS_SYMBOL_KEYWORD, TSSymbolKeyword) \ 82 _(TS_BOOLEAN_KEYWORD, TSBooleanKeyword) \ 83 _(TS_VOID_KEYWORD, TSVoidKeyword) \ 84 _(TS_UNDEFINED_KEYWORD, TSUndefinedKeyword) \ 85 _(TS_UNKNOWN_KEYWORD, TSUnknownKeyword) \ 86 _(TS_OBJECT_KEYWORD, TSObjectKeyword) \ 87 _(TS_BIGINT_KEYWORD, TSBigintKeyword) \ 88 _(TS_NEVER_KEYWORD, TSNeverKeyword) \ 89 _(TS_NON_NULL_EXPRESSION, TSNonNullExpression) \ 90 _(TS_NULL_KEYWORD, TSNullKeyword) \ 91 _(TS_OPTIONAL_TYPE, TSOptionalType) \ 92 _(TS_REST_TYPE, TSRestType) \ 93 _(TS_ARRAY_TYPE, TSArrayType) \ 94 _(TS_UNION_TYPE, TSUnionType) \ 95 _(TS_TYPE_LITERAL, TSTypeLiteral) \ 96 _(TS_PROPERTY_SIGNATURE, TSPropertySignature) \ 97 _(TS_METHOD_SIGNATURE, TSMethodSignature) \ 98 _(TS_SIGNATURE_DECLARATION, TSSignatureDeclaration) \ 99 _(TS_PARENT_TYPE, TSParenthesizedType) \ 100 _(TS_LITERAL_TYPE, TSLiteralType) \ 101 _(TS_TEMPLATE_LITERAL_TYPE, TSTemplateLiteralType) \ 102 _(TS_INFER_TYPE, TSInferType) \ 103 _(TS_CONDITIONAL_TYPE, TSConditionalType) \ 104 _(TS_IMPORT_TYPE, TSImportType) \ 105 _(TS_INTERSECTION_TYPE, TSIntersectionType) \ 106 _(TS_MAPPED_TYPE, TSMappedType) \ 107 _(TS_MODULE_BLOCK, TSModuleBlock) \ 108 _(TS_THIS_TYPE, TSThisType) \ 109 _(TS_TYPE_OPERATOR, TSTypeOperator) \ 110 _(TS_TYPE_PARAMETER, TSTypeParameter) \ 111 _(TS_TYPE_PARAMETER_DECLARATION, TSTypeParameterDeclaration) \ 112 _(TS_TYPE_PARAMETER_INSTANTIATION, TSTypeParameterInstantiation) \ 113 _(TS_TYPE_PREDICATE, TSTypePredicate) \ 114 _(TS_PARAMETER_PROPERTY, TSParameterProperty) \ 115 _(TS_MODULE_DECLARATION, TSModuleDeclaration) \ 116 _(TS_IMPORT_EQUALS_DECLARATION, TSImportEqualsDeclaration) \ 117 _(TS_NAMESPACE_EXPORT_DECLARATION, TSNamespaceExportDeclaration) \ 118 _(TS_FUNCTION_TYPE, TSFunctionType) \ 119 _(TS_CONSTRUCTOR_TYPE, TSConstructorType) \ 120 _(TS_TYPE_ALIAS_DECLARATION, TSTypeAliasDeclaration) \ 121 _(TS_TYPE_REFERENCE, TSTypeReference) \ 122 _(TS_QUALIFIED_NAME, TSQualifiedName) \ 123 _(TS_INDEXED_ACCESS_TYPE, TSIndexedAccessType) \ 124 _(TS_INTERFACE_DECLARATION, TSInterfaceDeclaration) \ 125 _(TS_INTERFACE_BODY, TSInterfaceBody) \ 126 _(TS_INTERFACE_HERITAGE, TSInterfaceHeritage) \ 127 _(TS_TUPLE_TYPE, TSTupleType) \ 128 _(TS_NAMED_TUPLE_MEMBER, TSNamedTupleMember) \ 129 _(TS_INDEX_SIGNATURE, TSIndexSignature) \ 130 _(TS_TYPE_QUERY, TSTypeQuery) \ 131 _(TS_AS_EXPRESSION, TSAsExpression) \ 132 _(TS_CLASS_IMPLEMENTS, TSClassImplements) \ 133 _(TS_TYPE_ASSERTION, TSTypeAssertion) \ 134 _(TAGGED_TEMPLATE_EXPRESSION, TaggedTemplateExpression) \ 135 _(TAGGED_LITERAL, TaggedLiteral) \ 136 _(TEMPLATE_ELEMENT, TemplateElement) \ 137 _(TEMPLATE_LITERAL, TemplateLiteral) \ 138 _(THIS_EXPRESSION, ThisExpression) \ 139 _(THROW_STATEMENT, ThrowStatement) \ 140 _(TRY_STATEMENT, TryStatement) \ 141 _(UNARY_EXPRESSION, UnaryExpression) \ 142 _(UPDATE_EXPRESSION, UpdateExpression) \ 143 _(VARIABLE_DECLARATION, VariableDeclaration) \ 144 _(VARIABLE_DECLARATOR, VariableDeclarator) \ 145 _(WHILE_STATEMENT, WhileStatement) \ 146 _(WITH_STATEMENT, WithStatement) \ 147 _(YIELD_EXPRESSION, YieldExpression) 148 149 #define AST_NODE_REINTERPRET_MAPPING(_) \ 150 _(ARRAY_EXPRESSION, ARRAY_PATTERN, ArrayExpression, ArrayPattern) \ 151 _(ASSIGNMENT_EXPRESSION, ASSIGNMENT_PATTERN, AssignmentExpression, AssignmentPattern) \ 152 _(OBJECT_EXPRESSION, OBJECT_PATTERN, ObjectExpression, ObjectPattern) \ 153 _(SPREAD_ELEMENT, REST_ELEMENT, SpreadElement, RestElement) 154 155 #endif 156