@idlizer/arktscgen 2.1.9-arktscgen-9 → 2.1.10-arktscgen-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/libarkts-copy/generator/options.json5 +199 -4
- package/build/libarkts-copy/native/meson.build +1 -0
- package/build/libarkts-copy/native/mingw.cross +13 -0
- package/build/libarkts-copy/native/src/bridges.cc +66 -229
- package/build/libarkts-copy/native/src/common.cc +37 -8
- package/build/libarkts-copy/native/src/generated/bridges.cc +2047 -766
- package/build/libarkts-copy/native/src/memoryTracker.cc +178 -0
- package/build/libarkts-copy/native/src/memoryTracker.h +52 -0
- package/build/libarkts-copy/package.json +11 -14
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +41 -52
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +7 -6
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +5 -2
- package/build/libarkts-copy/src/arkts-api/index.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +9 -9
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +7 -6
- package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +3 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +25 -6
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api/peers/ImportPathManager.ts → arkts-api/node-utilities/OpaqueTypeNode.ts} +8 -17
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +11 -10
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +12 -7
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +6 -0
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +3 -15
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api/peers/AstNode.ts → arkts-api/peers/DiagnosticKind.ts} +6 -8
- package/build/libarkts-copy/src/arkts-api/static/global.ts +28 -1
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +64 -7
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api → arkts-api}/utilities/performance.ts +122 -3
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +8 -22
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +95 -93
- package/build/libarkts-copy/src/arkts-api/visitor.ts +971 -364
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +6 -0
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +686 -185
- package/build/libarkts-copy/src/generated/factory.ts +2 -3
- package/build/libarkts-copy/src/generated/index.ts +3 -2
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +17 -20
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +4 -1
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +6 -12
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +18 -21
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +3 -1
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +11 -8
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +6 -30
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +35 -28
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +5 -32
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +25 -20
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +14 -9
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +17 -20
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +20 -23
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +4 -6
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +9 -11
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +9 -11
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +11 -13
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/Expression.ts +7 -3
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +4 -6
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +16 -23
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +8 -10
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +5 -2
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +7 -18
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/Literal.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +5 -11
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +10 -12
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +10 -10
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +5 -11
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/Program.ts +9 -2
- package/build/libarkts-copy/src/generated/peers/Property.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +27 -23
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +8 -1
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +5 -11
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +3 -1
- package/build/libarkts-copy/src/generated/peers/Statement.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +8 -32
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +19 -44
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +32 -47
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +17 -20
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +7 -9
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +13 -14
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +3 -3
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +3 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +16 -26
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +6 -8
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +5 -7
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +5 -7
- package/build/libarkts-copy/src/index.ts +4 -1
- package/build/libarkts-copy/src/plugin-utils.ts +8 -11
- package/build/libarkts-copy/src/reexport-for-generated.ts +1 -12
- package/build/libarkts-copy/src/tracer.ts +172 -0
- package/build/libarkts-copy/src/utils.ts +3 -0
- package/lib/index.js +1403 -544
- package/package.json +4 -3
- package/templates/factory.ts +0 -1
- package/templates/peer.ts +0 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +0 -79
- package/build/libarkts-copy/src/arkts-api/peers/SourcePosition.ts +0 -38
- package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +0 -45
- package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +0 -45
- package/build/libarkts-copy/src/wrapper-compat/README.md +0 -20
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/class-by-peer.ts +0 -46
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeFactory.ts +0 -454
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeTests.ts +0 -99
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +0 -88
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +0 -35
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +0 -27
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +0 -45
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +0 -27
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +0 -73
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +0 -51
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +0 -42
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +0 -39
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +0 -43
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +0 -28
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +0 -37
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +0 -28
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +0 -37
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +0 -42
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +0 -46
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +0 -30
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +0 -37
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +0 -27
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +0 -46
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +0 -28
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +0 -47
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +0 -40
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +0 -36
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +0 -41
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +0 -42
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +0 -39
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +0 -34
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +0 -33
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +0 -105
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +0 -38
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +0 -34
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/global.ts +0 -16
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +0 -108
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +0 -889
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +0 -69
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +0 -198
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +0 -327
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +0 -421
- package/build/libarkts-copy/src/wrapper-compat/index.ts +0 -20
- package/templates/node-map.ts +0 -35
|
@@ -13,7 +13,43 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import { isSameNativeObject } from "../arkts-api/peers/ArktsObject"
|
|
16
17
|
import {
|
|
18
|
+
AnnotationUsage,
|
|
19
|
+
ArrayExpression,
|
|
20
|
+
ArrowFunctionExpression,
|
|
21
|
+
AssignmentExpression,
|
|
22
|
+
BinaryExpression,
|
|
23
|
+
BlockExpression,
|
|
24
|
+
BlockStatement,
|
|
25
|
+
CallExpression,
|
|
26
|
+
CatchClause,
|
|
27
|
+
ChainExpression,
|
|
28
|
+
ClassDeclaration,
|
|
29
|
+
ClassDefinition,
|
|
30
|
+
ClassProperty,
|
|
31
|
+
ClassStaticBlock,
|
|
32
|
+
ConditionalExpression,
|
|
33
|
+
DoWhileStatement,
|
|
34
|
+
ETSFunctionType,
|
|
35
|
+
ETSImportDeclaration,
|
|
36
|
+
ETSModule,
|
|
37
|
+
ETSNewClassInstanceExpression,
|
|
38
|
+
ETSParameterExpression,
|
|
39
|
+
ETSStructDeclaration,
|
|
40
|
+
ETSTuple,
|
|
41
|
+
ETSTypeReference,
|
|
42
|
+
ETSTypeReferencePart,
|
|
43
|
+
ETSUnionType,
|
|
44
|
+
Expression,
|
|
45
|
+
ExpressionStatement,
|
|
46
|
+
ForInStatement,
|
|
47
|
+
ForOfStatement,
|
|
48
|
+
ForUpdateStatement,
|
|
49
|
+
FunctionDeclaration,
|
|
50
|
+
FunctionExpression,
|
|
51
|
+
Identifier,
|
|
52
|
+
IfStatement,
|
|
17
53
|
isArrayExpression,
|
|
18
54
|
isArrowFunctionExpression,
|
|
19
55
|
isAssignmentExpression,
|
|
@@ -66,9 +102,35 @@ import {
|
|
|
66
102
|
isVariableDeclaration,
|
|
67
103
|
isVariableDeclarator,
|
|
68
104
|
isWhileStatement,
|
|
69
|
-
|
|
105
|
+
MemberExpression,
|
|
106
|
+
MethodDefinition,
|
|
107
|
+
ObjectExpression,
|
|
108
|
+
Property,
|
|
109
|
+
ReturnStatement,
|
|
110
|
+
ScriptFunction,
|
|
111
|
+
Statement,
|
|
112
|
+
SwitchCaseStatement,
|
|
113
|
+
SwitchStatement,
|
|
114
|
+
TemplateElement,
|
|
115
|
+
TemplateLiteral,
|
|
116
|
+
TryStatement,
|
|
117
|
+
TSAsExpression,
|
|
118
|
+
TSClassImplements,
|
|
119
|
+
TSInterfaceBody,
|
|
120
|
+
TSInterfaceDeclaration,
|
|
121
|
+
TSInterfaceHeritage,
|
|
122
|
+
TSNonNullExpression,
|
|
123
|
+
TSTypeAliasDeclaration,
|
|
124
|
+
TSTypeParameter,
|
|
125
|
+
TSTypeParameterDeclaration,
|
|
126
|
+
TSTypeParameterInstantiation,
|
|
127
|
+
TypeNode,
|
|
128
|
+
UpdateExpression,
|
|
129
|
+
VariableDeclaration,
|
|
130
|
+
VariableDeclarator,
|
|
131
|
+
WhileStatement
|
|
70
132
|
} from "../generated"
|
|
71
|
-
import { Es2pandaImportKinds } from "../generated/Es2pandaEnums"
|
|
133
|
+
import { Es2pandaAstNodeType, Es2pandaImportKinds } from "../generated/Es2pandaEnums"
|
|
72
134
|
import { factory } from "./factory/nodeFactory"
|
|
73
135
|
import { AstNode } from "./peers/AstNode"
|
|
74
136
|
import { global } from "./static/global"
|
|
@@ -129,7 +191,11 @@ function nodeVisitor<T extends AstNode | undefined>(node: T, visitor: Visitor):
|
|
|
129
191
|
if (node === undefined) {
|
|
130
192
|
return node
|
|
131
193
|
}
|
|
132
|
-
|
|
194
|
+
const result = visitor(node) as T
|
|
195
|
+
if (node != result) {
|
|
196
|
+
global.updateTracker.update()
|
|
197
|
+
}
|
|
198
|
+
return result
|
|
133
199
|
}
|
|
134
200
|
|
|
135
201
|
// Improve: rethink (remove as)
|
|
@@ -137,445 +203,986 @@ function nodesVisitor<T extends AstNode, TIn extends readonly T[] | undefined>(n
|
|
|
137
203
|
if (nodes === undefined) {
|
|
138
204
|
return nodes
|
|
139
205
|
}
|
|
140
|
-
return nodes.map(node =>
|
|
206
|
+
return nodes.map(node => {
|
|
207
|
+
const result = visitor(node) as T
|
|
208
|
+
if (node != result) {
|
|
209
|
+
global.updateTracker.update()
|
|
210
|
+
}
|
|
211
|
+
return result
|
|
212
|
+
})
|
|
141
213
|
}
|
|
142
214
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
if (isETSModule(node)) {
|
|
149
|
-
return factory.updateETSModule(
|
|
150
|
-
node,
|
|
151
|
-
nodesVisitor(node.statements, visitor),
|
|
152
|
-
nodeVisitor(node.ident, visitor),
|
|
153
|
-
node.getNamespaceFlag(),
|
|
154
|
-
node.program,
|
|
155
|
-
)
|
|
215
|
+
function visitBlockStatement(node: BlockStatement, visitor: Visitor) {
|
|
216
|
+
global.updateTracker.push()
|
|
217
|
+
const newStatements: readonly Statement[] = nodesVisitor(node.statements, visitor)
|
|
218
|
+
if (global.updateTracker.check()) {
|
|
219
|
+
node.setStatements(newStatements)
|
|
156
220
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
221
|
+
return node
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function visitETSModule(node: ETSModule, visitor: Visitor) {
|
|
225
|
+
global.updateTracker.push()
|
|
226
|
+
const newStatements: readonly Statement[] = nodesVisitor(node.statements, visitor)
|
|
227
|
+
const oldIdent = node.ident
|
|
228
|
+
const newIdent = nodeVisitor(oldIdent, visitor)
|
|
229
|
+
if (global.updateTracker.check()) {
|
|
230
|
+
if (!isSameNativeObject(newIdent, oldIdent)) {
|
|
231
|
+
const result = factory.createETSModule(
|
|
232
|
+
newStatements,
|
|
233
|
+
newIdent,
|
|
234
|
+
node.getNamespaceFlag(),
|
|
235
|
+
node.program,
|
|
236
|
+
)
|
|
237
|
+
result.onUpdate(node)
|
|
238
|
+
return result
|
|
239
|
+
}
|
|
240
|
+
node.setStatements(newStatements)
|
|
167
241
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
242
|
+
return node
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function visitCallExpression(node: CallExpression, visitor: Visitor) {
|
|
246
|
+
global.updateTracker.push()
|
|
247
|
+
const newCallee = nodeVisitor(node.callee, visitor)
|
|
248
|
+
const newArguments: readonly Expression[] = nodesVisitor(node.arguments, visitor)
|
|
249
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor)
|
|
250
|
+
const newTrailingBlock = nodeVisitor(node.trailingBlock, visitor)
|
|
251
|
+
if (global.updateTracker.check()) {
|
|
252
|
+
node.setCallee(newCallee)
|
|
253
|
+
node.setArguments(newArguments)
|
|
254
|
+
node.setTypeParams(newTypeParams)
|
|
255
|
+
node.setTrailingBlock(newTrailingBlock)
|
|
175
256
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
257
|
+
return node
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function visitIdentifier(node: Identifier, visitor: Visitor) {
|
|
261
|
+
global.updateTracker.push()
|
|
262
|
+
const newTypeAnnotation = nodeVisitor(node.typeAnnotation, visitor)
|
|
263
|
+
if (global.updateTracker.check()) {
|
|
264
|
+
const result = factory.createIdentifier(node.name, newTypeAnnotation)
|
|
265
|
+
result.onUpdate(node)
|
|
266
|
+
return result
|
|
181
267
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
268
|
+
return node
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function visitMemberExpression(node: MemberExpression, visitor: Visitor) {
|
|
272
|
+
global.updateTracker.push()
|
|
273
|
+
const newObject = nodeVisitor(node.object, visitor)
|
|
274
|
+
const newProperty = nodeVisitor(node.property, visitor)
|
|
275
|
+
if (global.updateTracker.check()) {
|
|
276
|
+
node.setObject(newObject)
|
|
277
|
+
node.setProperty(newProperty)
|
|
187
278
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
279
|
+
return node
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function visitETSTypeReference(node: ETSTypeReference, visitor: Visitor) {
|
|
283
|
+
global.updateTracker.push()
|
|
284
|
+
const newPart = nodeVisitor(node.part, visitor)
|
|
285
|
+
if (global.updateTracker.check()) {
|
|
286
|
+
const result = factory.createETSTypeReference(
|
|
287
|
+
newPart,
|
|
192
288
|
)
|
|
289
|
+
result.onUpdate(node)
|
|
290
|
+
return result
|
|
193
291
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
292
|
+
return node
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function visitETSTypeReferencePart(node: ETSTypeReferencePart, visitor: Visitor) {
|
|
296
|
+
global.updateTracker.push()
|
|
297
|
+
const newName = nodeVisitor(node.name, visitor)
|
|
298
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor)
|
|
299
|
+
const newPrev = nodeVisitor(node.previous, visitor)
|
|
300
|
+
if (global.updateTracker.check()) {
|
|
301
|
+
const result = factory.createETSTypeReferencePart(
|
|
302
|
+
newName,
|
|
303
|
+
newTypeParams,
|
|
304
|
+
newPrev,
|
|
198
305
|
)
|
|
306
|
+
result.onUpdate(node)
|
|
307
|
+
return result
|
|
199
308
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
309
|
+
return node
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function visitScriptFunction(node: ScriptFunction, visitor: Visitor) {
|
|
313
|
+
global.updateTracker.push()
|
|
314
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
315
|
+
const oldTypeParams = node.typeParams
|
|
316
|
+
const newTypeParams = nodeVisitor(oldTypeParams, visitor)
|
|
317
|
+
const newParams: readonly Expression[] = nodesVisitor(node.params, visitor)
|
|
318
|
+
const newReturnTypeAnnotation = nodeVisitor(node.returnTypeAnnotation, visitor)
|
|
319
|
+
const newId = nodeVisitor(node.id, visitor)
|
|
320
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
321
|
+
if (global.updateTracker.check()) {
|
|
322
|
+
if (!isSameNativeObject(newTypeParams, oldTypeParams)) {
|
|
323
|
+
const result = factory.createScriptFunction(
|
|
324
|
+
newBody,
|
|
325
|
+
newTypeParams,
|
|
326
|
+
newParams,
|
|
327
|
+
newReturnTypeAnnotation,
|
|
328
|
+
node.hasReceiver,
|
|
329
|
+
node.flags,
|
|
330
|
+
node.modifierFlags,
|
|
331
|
+
newId,
|
|
332
|
+
newAnnotations,
|
|
333
|
+
node.getSignaturePointer(),
|
|
334
|
+
node.getPreferredReturnTypePointer(),
|
|
335
|
+
)
|
|
336
|
+
result.onUpdate(node)
|
|
337
|
+
return result
|
|
338
|
+
}
|
|
339
|
+
node.setBody(newBody)
|
|
340
|
+
node.setParams(newParams)
|
|
341
|
+
node.setReturnTypeAnnotation(newReturnTypeAnnotation)
|
|
342
|
+
if (newId) node.setIdent(newId)
|
|
343
|
+
node.setAnnotations(newAnnotations)
|
|
205
344
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
345
|
+
return node
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function visitMethodDefinition(node: MethodDefinition, visitor: Visitor) {
|
|
349
|
+
global.updateTracker.push()
|
|
350
|
+
const oldId = node.id
|
|
351
|
+
const newId = nodeVisitor(oldId, visitor)
|
|
352
|
+
const oldValue = node.value
|
|
353
|
+
const newValue = nodeVisitor(oldValue, visitor)
|
|
354
|
+
const newOverloads: readonly MethodDefinition[] = nodesVisitor(node.overloads, visitor)
|
|
355
|
+
if (global.updateTracker.check()) {
|
|
356
|
+
if (!isSameNativeObject(newValue, node.value) || !isSameNativeObject(newId, oldId)) {
|
|
357
|
+
const result = factory.createMethodDefinition(
|
|
358
|
+
node.kind,
|
|
359
|
+
newId,
|
|
360
|
+
newValue,
|
|
361
|
+
node.modifierFlags,
|
|
362
|
+
node.isComputed,
|
|
363
|
+
newOverloads,
|
|
364
|
+
)
|
|
365
|
+
result.onUpdate(node)
|
|
366
|
+
return result
|
|
367
|
+
}
|
|
368
|
+
node.setOverloads(newOverloads)
|
|
369
|
+
newOverloads.forEach(it => {
|
|
370
|
+
it.setBaseOverloadMethod(node)
|
|
371
|
+
it.parent = node
|
|
372
|
+
})
|
|
212
373
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
374
|
+
return node
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function visitArrowFunctionExpression(node: ArrowFunctionExpression, visitor: Visitor) {
|
|
378
|
+
global.updateTracker.push()
|
|
379
|
+
const oldFunction = node.function
|
|
380
|
+
const newFunction = nodeVisitor(oldFunction, visitor)
|
|
381
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
382
|
+
if (global.updateTracker.check()) {
|
|
383
|
+
if (!isSameNativeObject(newFunction, oldFunction)) {
|
|
384
|
+
const result = factory.createArrowFunctionExpression(
|
|
385
|
+
newFunction,
|
|
386
|
+
newAnnotations,
|
|
387
|
+
)
|
|
388
|
+
result.onUpdate(node)
|
|
389
|
+
return result
|
|
390
|
+
}
|
|
391
|
+
node.setAnnotations(newAnnotations)
|
|
392
|
+
}
|
|
393
|
+
return node
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function visitFunctionDeclaration(node: FunctionDeclaration, visitor: Visitor) {
|
|
397
|
+
global.updateTracker.push()
|
|
398
|
+
const oldFunction = node.function
|
|
399
|
+
const newFunction = nodeVisitor(oldFunction, visitor)
|
|
400
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
401
|
+
if (global.updateTracker.check()) {
|
|
402
|
+
if (!isSameNativeObject(newFunction, oldFunction)) {
|
|
403
|
+
const result = factory.createFunctionDeclaration(
|
|
404
|
+
newFunction,
|
|
405
|
+
newAnnotations,
|
|
406
|
+
node.isAnonymous,
|
|
407
|
+
)
|
|
408
|
+
result.onUpdate(node)
|
|
409
|
+
return result
|
|
410
|
+
}
|
|
411
|
+
node.setAnnotations(newAnnotations)
|
|
412
|
+
}
|
|
413
|
+
return node
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function visitBlockExpression(node: BlockExpression, visitor: Visitor) {
|
|
417
|
+
global.updateTracker.push()
|
|
418
|
+
const newStatements: readonly Statement[] = nodesVisitor(node.statements, visitor)
|
|
419
|
+
if (global.updateTracker.check()) {
|
|
420
|
+
const result = factory.createBlockExpression(
|
|
421
|
+
newStatements,
|
|
226
422
|
)
|
|
423
|
+
result.onUpdate(node)
|
|
424
|
+
return result
|
|
227
425
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
426
|
+
return node
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function visitChainExpression(node: ChainExpression, visitor: Visitor) {
|
|
430
|
+
global.updateTracker.push()
|
|
431
|
+
const newExpression = nodeVisitor(node.expression, visitor)
|
|
432
|
+
if (global.updateTracker.check()) {
|
|
433
|
+
const result = factory.createChainExpression(
|
|
434
|
+
newExpression,
|
|
237
435
|
)
|
|
436
|
+
result.onUpdate(node)
|
|
437
|
+
return result
|
|
238
438
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
439
|
+
return node
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function visitExpressionStatement(node: ExpressionStatement, visitor: Visitor) {
|
|
443
|
+
global.updateTracker.push()
|
|
444
|
+
const newExpression = nodeVisitor(node.expression, visitor)
|
|
445
|
+
if (global.updateTracker.check()) {
|
|
446
|
+
node.setExpression(newExpression)
|
|
447
|
+
}
|
|
448
|
+
return node
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function visitETSStructDeclaration(node: ETSStructDeclaration, visitor: Visitor) {
|
|
452
|
+
global.updateTracker.push()
|
|
453
|
+
const newDefinition = nodeVisitor(node.definition, visitor)
|
|
454
|
+
if (global.updateTracker.check()) {
|
|
455
|
+
node.setDefinition(newDefinition)
|
|
456
|
+
}
|
|
457
|
+
return node
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function visitClassDeclaration(node: ClassDeclaration, visitor: Visitor) {
|
|
461
|
+
global.updateTracker.push()
|
|
462
|
+
const newDefinition = nodeVisitor(node.definition, visitor)
|
|
463
|
+
if (global.updateTracker.check()) {
|
|
464
|
+
node.setDefinition(newDefinition)
|
|
465
|
+
}
|
|
466
|
+
return node
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function visitTSInterfaceBody(node: TSInterfaceBody, visitor: Visitor) {
|
|
470
|
+
global.updateTracker.push()
|
|
471
|
+
const newBody = nodesVisitor(node.body, visitor)
|
|
472
|
+
if (global.updateTracker.check()) {
|
|
473
|
+
const result = factory.createTSInterfaceBody(
|
|
474
|
+
newBody,
|
|
253
475
|
)
|
|
476
|
+
result.onUpdate(node)
|
|
477
|
+
return result
|
|
254
478
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
479
|
+
return node
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function visitClassDefinition(node: ClassDefinition, visitor: Visitor) {
|
|
483
|
+
global.updateTracker.push()
|
|
484
|
+
const newIdent = nodeVisitor(node.ident, visitor)
|
|
485
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor)
|
|
486
|
+
const oldSuperTypeParams = node.superTypeParams
|
|
487
|
+
const newSuperTypeParams = nodeVisitor(oldSuperTypeParams, visitor)
|
|
488
|
+
const oldImplements = node.implements
|
|
489
|
+
const newImplements: readonly TSClassImplements[] = nodesVisitor(oldImplements, visitor)
|
|
490
|
+
const newSuper = nodeVisitor(node.super, visitor)
|
|
491
|
+
const newBody = nodesVisitor(node.body, visitor)
|
|
492
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
493
|
+
if (global.updateTracker.check()) {
|
|
494
|
+
if (!isSameNativeObject(oldSuperTypeParams, newSuperTypeParams) || !isSameNativeObject(newImplements, oldImplements)) {
|
|
495
|
+
const result = factory.createClassDefinition(
|
|
496
|
+
newIdent,
|
|
497
|
+
newTypeParams,
|
|
498
|
+
newSuperTypeParams,
|
|
499
|
+
newImplements,
|
|
500
|
+
undefined, /* can not pass node.ctor here because of mismatching types */
|
|
501
|
+
newSuper,
|
|
502
|
+
newBody,
|
|
503
|
+
node.modifiers,
|
|
504
|
+
node.modifierFlags,
|
|
505
|
+
newAnnotations,
|
|
506
|
+
)
|
|
507
|
+
result.onUpdate(node)
|
|
508
|
+
return result
|
|
259
509
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
nodesVisitor(node.annotations, visitor),
|
|
266
|
-
)
|
|
510
|
+
node.setIdent(newIdent)
|
|
511
|
+
node.setTypeParams(newTypeParams)
|
|
512
|
+
node.setSuper(newSuper)
|
|
513
|
+
node.setBody(newBody)
|
|
514
|
+
node.setAnnotations(newAnnotations)
|
|
267
515
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
node.isOptional
|
|
276
|
-
)
|
|
516
|
+
return node
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function visitETSParameterExpression(node: ETSParameterExpression, visitor: Visitor) {
|
|
520
|
+
if (node.isRestParameter) {
|
|
521
|
+
/** there is no RestParameter node at .idl */
|
|
522
|
+
return node
|
|
277
523
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
)
|
|
524
|
+
global.updateTracker.push()
|
|
525
|
+
const newIdent = nodeVisitor(node.ident, visitor)
|
|
526
|
+
const newInit = nodeVisitor(node.initializer, visitor)
|
|
527
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
528
|
+
if (global.updateTracker.check()) {
|
|
529
|
+
node.setIdent(newIdent)
|
|
530
|
+
node.setInitializer(newInit)
|
|
531
|
+
node.setAnnotations(newAnnotations)
|
|
284
532
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
533
|
+
return node
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function visitSwitchStatement(node: SwitchStatement, visitor: Visitor) {
|
|
537
|
+
global.updateTracker.push()
|
|
538
|
+
const newDiscriminant = nodeVisitor(node.discriminant, visitor)
|
|
539
|
+
const oldCases = node.cases
|
|
540
|
+
const newCases: readonly SwitchCaseStatement[] = nodesVisitor(oldCases, visitor)
|
|
541
|
+
if (global.updateTracker.check()) {
|
|
542
|
+
if (!isSameNativeObject(newCases, oldCases)) {
|
|
543
|
+
const result = factory.createSwitchStatement(
|
|
544
|
+
newDiscriminant,
|
|
545
|
+
newCases,
|
|
546
|
+
)
|
|
547
|
+
result.onUpdate(node)
|
|
548
|
+
return result
|
|
549
|
+
}
|
|
550
|
+
node.setDiscriminant(newDiscriminant)
|
|
291
551
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
552
|
+
return node
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function visitSwitchCaseStatement(node: SwitchCaseStatement, visitor: Visitor) {
|
|
556
|
+
global.updateTracker.push()
|
|
557
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
558
|
+
const oldConsequent = node.consequent
|
|
559
|
+
const newConsequent: readonly Statement[] = nodesVisitor(oldConsequent, visitor)
|
|
560
|
+
if (global.updateTracker.check()) {
|
|
561
|
+
if (!isSameNativeObject(newConsequent, oldConsequent)) {
|
|
562
|
+
const result = factory.createSwitchCaseStatement(
|
|
563
|
+
newTest,
|
|
564
|
+
newConsequent,
|
|
565
|
+
)
|
|
566
|
+
result.onUpdate(node)
|
|
567
|
+
return result
|
|
568
|
+
}
|
|
569
|
+
node.setTest(newTest)
|
|
570
|
+
}
|
|
571
|
+
return node
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function visitTSInterfaceDeclaration(node: TSInterfaceDeclaration, visitor: Visitor) {
|
|
575
|
+
global.updateTracker.push()
|
|
576
|
+
const newExtends: readonly TSInterfaceHeritage[] = nodesVisitor(node.extends, visitor)
|
|
577
|
+
const newIdent = nodeVisitor(node.id, visitor)
|
|
578
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor)
|
|
579
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
580
|
+
if (global.updateTracker.check()) {
|
|
581
|
+
const result = factory.createInterfaceDeclaration(
|
|
582
|
+
newExtends,
|
|
583
|
+
newIdent,
|
|
584
|
+
newTypeParams,
|
|
585
|
+
newBody,
|
|
299
586
|
node.isStatic,
|
|
300
587
|
node.isFromExternal,
|
|
301
588
|
node.modifierFlags,
|
|
302
589
|
)
|
|
590
|
+
result.onUpdate(node)
|
|
591
|
+
return result
|
|
303
592
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
node
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
)
|
|
593
|
+
return node
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function visitIfStatement(node: IfStatement, visitor: Visitor) {
|
|
597
|
+
global.updateTracker.push()
|
|
598
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
599
|
+
const oldConsequent = node.consequent
|
|
600
|
+
const newConsequent = nodeVisitor(oldConsequent, visitor)
|
|
601
|
+
const newAlternate = nodeVisitor(node.alternate, visitor)
|
|
602
|
+
if (global.updateTracker.check()) {
|
|
603
|
+
if (!isSameNativeObject(newConsequent, oldConsequent)) {
|
|
604
|
+
const result = factory.createIfStatement(
|
|
605
|
+
newTest,
|
|
606
|
+
newConsequent,
|
|
607
|
+
newAlternate,
|
|
608
|
+
)
|
|
609
|
+
result.onUpdate(node)
|
|
610
|
+
return result
|
|
611
|
+
}
|
|
612
|
+
node.setTest(newTest)
|
|
613
|
+
if (newTest) newTest.parent = node
|
|
614
|
+
node.setAlternate(newAlternate)
|
|
325
615
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
616
|
+
return node
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function visitConditionalExpression(node: ConditionalExpression, visitor: Visitor) {
|
|
620
|
+
global.updateTracker.push()
|
|
621
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
622
|
+
const newConsequent = nodeVisitor(node.consequent, visitor)
|
|
623
|
+
const newAlternate = nodeVisitor(node.alternate, visitor)
|
|
624
|
+
if (global.updateTracker.check()) {
|
|
625
|
+
node.setTest(newTest)
|
|
626
|
+
node.setConsequent(newConsequent)
|
|
627
|
+
node.setAlternate(newAlternate)
|
|
333
628
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
629
|
+
return node
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function visitVariableDeclararion(node: VariableDeclaration, visitor: Visitor) {
|
|
633
|
+
global.updateTracker.push()
|
|
634
|
+
const oldDeclarators = node.declarators
|
|
635
|
+
const newDeclarators: readonly VariableDeclarator[] = nodesVisitor(oldDeclarators, visitor)
|
|
636
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
637
|
+
if (global.updateTracker.check()) {
|
|
638
|
+
if (!isSameNativeObject(newDeclarators, oldDeclarators)) {
|
|
639
|
+
const result = factory.createVariableDeclaration(
|
|
640
|
+
node.kind,
|
|
641
|
+
newDeclarators,
|
|
642
|
+
newAnnotations,
|
|
643
|
+
)
|
|
644
|
+
result.onUpdate(node)
|
|
645
|
+
return result
|
|
646
|
+
}
|
|
647
|
+
node.setAnnotations(newAnnotations)
|
|
341
648
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
649
|
+
return node
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function visitVariableDeclarator(node: VariableDeclarator, visitor: Visitor) {
|
|
653
|
+
global.updateTracker.push()
|
|
654
|
+
const oldId = node.id
|
|
655
|
+
const newId = nodeVisitor(oldId, visitor)
|
|
656
|
+
const newInit = nodeVisitor(node.init, visitor)
|
|
657
|
+
if (global.updateTracker.check()) {
|
|
658
|
+
if (!isSameNativeObject(newId, oldId)) {
|
|
659
|
+
const result = factory.createVariableDeclarator(
|
|
660
|
+
node.flag,
|
|
661
|
+
newId,
|
|
662
|
+
newInit,
|
|
663
|
+
)
|
|
664
|
+
result.onUpdate(node)
|
|
665
|
+
return result
|
|
666
|
+
}
|
|
667
|
+
node.setInit(newInit)
|
|
348
668
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
669
|
+
return node
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function visitReturnStatement(node: ReturnStatement, visitor: Visitor) {
|
|
673
|
+
global.updateTracker.push()
|
|
674
|
+
const newArgument = nodeVisitor(node.argument, visitor)
|
|
675
|
+
if (global.updateTracker.check()) {
|
|
676
|
+
node.setArgument(newArgument)
|
|
354
677
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
678
|
+
return node
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function visitTSAsExpression(node: TSAsExpression, visitor: Visitor) {
|
|
682
|
+
global.updateTracker.push()
|
|
683
|
+
const newExpr = nodeVisitor(node.expr, visitor)
|
|
684
|
+
const oldTypeAnnotation = node.typeAnnotation
|
|
685
|
+
const newTypeAnnotation = nodeVisitor(oldTypeAnnotation, visitor)
|
|
686
|
+
if (global.updateTracker.check()) {
|
|
687
|
+
if (!isSameNativeObject(newTypeAnnotation, oldTypeAnnotation)) {
|
|
688
|
+
const result = factory.createTSAsExpression(
|
|
689
|
+
newExpr,
|
|
690
|
+
newTypeAnnotation,
|
|
691
|
+
node.isConst,
|
|
692
|
+
)
|
|
693
|
+
result.onUpdate(node)
|
|
694
|
+
return result
|
|
695
|
+
}
|
|
696
|
+
node.setExpr(newExpr)
|
|
362
697
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
698
|
+
return node
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function visitTemplateLiteral(node: TemplateLiteral, visitor: Visitor) {
|
|
702
|
+
global.updateTracker.push()
|
|
703
|
+
const newQuasis: readonly TemplateElement[] = nodesVisitor(node.quasis, visitor)
|
|
704
|
+
const newExpression: readonly Expression[] = nodesVisitor(node.expressions, visitor)
|
|
705
|
+
if (global.updateTracker.check()) {
|
|
706
|
+
const result = factory.createTemplateLiteral(
|
|
707
|
+
newQuasis,
|
|
708
|
+
newExpression,
|
|
709
|
+
node.multilineString,
|
|
369
710
|
)
|
|
711
|
+
result.onUpdate(node)
|
|
712
|
+
return result
|
|
370
713
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
714
|
+
return node
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function visitTSTypeAliasDeclaration(node: TSTypeAliasDeclaration, visitor: Visitor) {
|
|
718
|
+
global.updateTracker.push()
|
|
719
|
+
const oldId = node.id
|
|
720
|
+
const newId = nodeVisitor(oldId, visitor)
|
|
721
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor)
|
|
722
|
+
const oldTypeAnnotation = node.typeAnnotation
|
|
723
|
+
const newTypeAnnotation = nodeVisitor(oldTypeAnnotation, visitor)
|
|
724
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
725
|
+
if (global.updateTracker.check()) {
|
|
726
|
+
if (!isSameNativeObject(newId, oldId) || !isSameNativeObject(newTypeAnnotation, oldTypeAnnotation)) {
|
|
727
|
+
const result = factory.createTSTypeAliasDeclaration(
|
|
728
|
+
newId,
|
|
729
|
+
newTypeParams,
|
|
730
|
+
newTypeAnnotation,
|
|
731
|
+
newAnnotations,
|
|
732
|
+
)
|
|
733
|
+
result.onUpdate(node)
|
|
734
|
+
return result
|
|
735
|
+
}
|
|
736
|
+
node.setAnnotations(newAnnotations)
|
|
737
|
+
node.setTypeParameters(newTypeParams)
|
|
380
738
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
739
|
+
return node
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function visitTryStatement(node: TryStatement, visitor: Visitor) {
|
|
743
|
+
global.updateTracker.push()
|
|
744
|
+
const newBlock = nodeVisitor(node.block, visitor)
|
|
745
|
+
const newCatchClauses: readonly CatchClause[] = nodesVisitor(node.catchClauses, visitor)
|
|
746
|
+
const newFinallyBlock = nodeVisitor(node.finallyBlock, visitor)
|
|
747
|
+
if (global.updateTracker.check()) {
|
|
748
|
+
const result = factory.createTryStatement(
|
|
749
|
+
newBlock,
|
|
750
|
+
newCatchClauses,
|
|
751
|
+
newFinallyBlock,
|
|
752
|
+
[],
|
|
387
753
|
[],
|
|
388
|
-
[]
|
|
389
754
|
)
|
|
755
|
+
result.onUpdate(node)
|
|
756
|
+
return result
|
|
390
757
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
758
|
+
return node
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function visitObjectExpression(node: ObjectExpression, visitor: Visitor) {
|
|
762
|
+
global.updateTracker.push()
|
|
763
|
+
const newProperties: readonly Expression[] = nodesVisitor(node.properties, visitor)
|
|
764
|
+
if (global.updateTracker.check()) {
|
|
765
|
+
const result = factory.createObjectExpression(
|
|
766
|
+
newProperties,
|
|
767
|
+
node.getPreferredTypePointer(),
|
|
395
768
|
)
|
|
769
|
+
result.onUpdate(node)
|
|
770
|
+
return result
|
|
396
771
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
772
|
+
return node
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function visitFunctionExpression(node: FunctionExpression, visitor: Visitor) {
|
|
776
|
+
global.updateTracker.push()
|
|
777
|
+
const newId = nodeVisitor(node.id, visitor)
|
|
778
|
+
const newFunction = nodeVisitor(node.function, visitor)
|
|
779
|
+
if (global.updateTracker.check()) {
|
|
780
|
+
const result = factory.createFunctionExpression(
|
|
781
|
+
newId,
|
|
782
|
+
newFunction,
|
|
402
783
|
)
|
|
784
|
+
result.onUpdate(node)
|
|
785
|
+
return result
|
|
403
786
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
787
|
+
return node
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
function visitArrayExpression(node: ArrayExpression, visitor: Visitor) {
|
|
791
|
+
global.updateTracker.push()
|
|
792
|
+
const newElements: readonly Expression[] = nodesVisitor(node.elements, visitor)
|
|
793
|
+
if (global.updateTracker.check()) {
|
|
794
|
+
node.setElements(newElements)
|
|
409
795
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
796
|
+
return node
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function visitAssignmentExpression(node: AssignmentExpression, visitor: Visitor) {
|
|
800
|
+
global.updateTracker.push()
|
|
801
|
+
const newLeft = nodeVisitor(node.left, visitor)
|
|
802
|
+
const newRight = nodeVisitor(node.right, visitor)
|
|
803
|
+
if (global.updateTracker.check()) {
|
|
804
|
+
node.setLeft(newLeft)
|
|
805
|
+
node.setRight(newRight)
|
|
417
806
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
807
|
+
return node
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function visitETSTyple(node: ETSTuple, visitor: Visitor) {
|
|
811
|
+
global.updateTracker.push()
|
|
812
|
+
const newTypeAnnotationList: readonly TypeNode[] = nodesVisitor(node.tupleTypeAnnotationsList, visitor)
|
|
813
|
+
if (global.updateTracker.check()) {
|
|
814
|
+
node.setTypeAnnotationsList(newTypeAnnotationList)
|
|
423
815
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
816
|
+
return node
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function visitETSUnionType(node: ETSUnionType, visitor: Visitor) {
|
|
820
|
+
global.updateTracker.push()
|
|
821
|
+
const oldTypes = node.types
|
|
822
|
+
const newTypes: readonly TypeNode[] = nodesVisitor(oldTypes, visitor)
|
|
823
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
824
|
+
if (global.updateTracker.check()) {
|
|
825
|
+
if (!isSameNativeObject(newTypes, oldTypes)) {
|
|
826
|
+
const result = factory.createETSUnionType(
|
|
827
|
+
newTypes,
|
|
828
|
+
newAnnotations,
|
|
829
|
+
)
|
|
830
|
+
result.onUpdate(node)
|
|
831
|
+
return result
|
|
832
|
+
}
|
|
833
|
+
node.setAnnotations(newAnnotations)
|
|
430
834
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
835
|
+
return node
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function visitETSFunctionType(node: ETSFunctionType, visitor: Visitor) {
|
|
839
|
+
global.updateTracker.push()
|
|
840
|
+
const oldTypeParams = node.typeParams
|
|
841
|
+
const newTypeParams = nodeVisitor(oldTypeParams, visitor)
|
|
842
|
+
const oldParams = node.params
|
|
843
|
+
const newParams: readonly Expression[] = nodesVisitor(oldParams, visitor)
|
|
844
|
+
const oldReturnTypeAnnotation = node.returnType
|
|
845
|
+
const newReturnTypeAnnotation = nodeVisitor(oldReturnTypeAnnotation, visitor)
|
|
846
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
847
|
+
if (global.updateTracker.check()) {
|
|
848
|
+
if (!isSameNativeObject(newTypeParams, oldTypeParams)
|
|
849
|
+
|| !isSameNativeObject(newParams, oldParams)
|
|
850
|
+
|| !isSameNativeObject(newReturnTypeAnnotation, oldReturnTypeAnnotation)
|
|
851
|
+
) {
|
|
852
|
+
const result = factory.createETSFunctionType(
|
|
853
|
+
newTypeParams,
|
|
854
|
+
newParams,
|
|
855
|
+
newReturnTypeAnnotation,
|
|
856
|
+
node.isExtensionFunction,
|
|
857
|
+
node.flags,
|
|
858
|
+
newAnnotations,
|
|
859
|
+
)
|
|
860
|
+
result.onUpdate(node)
|
|
861
|
+
return result
|
|
862
|
+
}
|
|
863
|
+
node.setAnnotations(newAnnotations)
|
|
441
864
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
865
|
+
return node
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
function visitClassProperty(node: ClassProperty, visitor: Visitor) {
|
|
869
|
+
global.updateTracker.push()
|
|
870
|
+
const oldKey = node.key
|
|
871
|
+
const newKey = nodeVisitor(oldKey, visitor)
|
|
872
|
+
const newValue = nodeVisitor(node.value, visitor)
|
|
873
|
+
const newTypeAnnotation = nodeVisitor(node.typeAnnotation, visitor)
|
|
874
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
875
|
+
if (global.updateTracker.check()) {
|
|
876
|
+
if (!isSameNativeObject(newKey, oldKey)) {
|
|
877
|
+
const result = factory.createClassProperty(
|
|
878
|
+
newKey,
|
|
879
|
+
newValue,
|
|
880
|
+
newTypeAnnotation,
|
|
881
|
+
node.modifierFlags,
|
|
882
|
+
node.isComputed,
|
|
883
|
+
newAnnotations,
|
|
884
|
+
)
|
|
885
|
+
result.onUpdate(node)
|
|
886
|
+
return result
|
|
887
|
+
}
|
|
888
|
+
node.setValue(newValue)
|
|
889
|
+
node.setTypeAnnotation(newTypeAnnotation)
|
|
890
|
+
node.setAnnotations(newAnnotations)
|
|
452
891
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
892
|
+
return node
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function visitProperty(node: Property, visitor: Visitor) {
|
|
896
|
+
global.updateTracker.push()
|
|
897
|
+
const newKey = nodeVisitor(node.key, visitor)
|
|
898
|
+
const newValue = nodeVisitor(node.value, visitor)
|
|
899
|
+
if (global.updateTracker.check()) {
|
|
900
|
+
const result = factory.createProperty(
|
|
456
901
|
node.kind,
|
|
457
|
-
|
|
458
|
-
|
|
902
|
+
newKey,
|
|
903
|
+
newValue,
|
|
459
904
|
node.isMethod,
|
|
460
|
-
node.isComputed
|
|
905
|
+
node.isComputed,
|
|
461
906
|
)
|
|
907
|
+
result.onUpdate(node)
|
|
908
|
+
return result
|
|
462
909
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
node.name,
|
|
474
|
-
nodeVisitor(node.typeAnnotation, visitor)
|
|
475
|
-
)
|
|
910
|
+
return node
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function visitBinaryExpression(node: BinaryExpression, visitor: Visitor) {
|
|
914
|
+
global.updateTracker.push()
|
|
915
|
+
const newLeft = nodeVisitor(node.left, visitor)
|
|
916
|
+
const newRight = nodeVisitor(node.right, visitor)
|
|
917
|
+
if (global.updateTracker.check()) {
|
|
918
|
+
node.setLeft(newLeft)
|
|
919
|
+
node.setRight(newRight)
|
|
476
920
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
921
|
+
return node
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
function visitETSNewClassInstanceExpression(node: ETSNewClassInstanceExpression, visitor: Visitor) {
|
|
925
|
+
global.updateTracker.push()
|
|
926
|
+
const oldTypeRef = node.typeRef
|
|
927
|
+
const newTypeRef = nodeVisitor(oldTypeRef, visitor)
|
|
928
|
+
const newArguments: readonly Expression[] = nodesVisitor(node.arguments, visitor)
|
|
929
|
+
if (global.updateTracker.check()) {
|
|
930
|
+
if (!isSameNativeObject(newTypeRef, oldTypeRef)) {
|
|
931
|
+
const result = factory.createETSNewClassInstanceExpression(
|
|
932
|
+
newTypeRef,
|
|
933
|
+
newArguments,
|
|
934
|
+
)
|
|
935
|
+
result.onUpdate(node)
|
|
936
|
+
return result
|
|
937
|
+
}
|
|
938
|
+
node.setArguments(newArguments)
|
|
939
|
+
newArguments.forEach(it => it.parent = node)
|
|
483
940
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
941
|
+
return node
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function visitWhileStatement(node: WhileStatement, visitor: Visitor) {
|
|
945
|
+
global.updateTracker.push()
|
|
946
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
947
|
+
const oldBody = node.body
|
|
948
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
949
|
+
if (global.updateTracker.check()) {
|
|
950
|
+
if (!isSameNativeObject(newBody, oldBody)) {
|
|
951
|
+
const result = factory.createWhileStatement(
|
|
952
|
+
newTest,
|
|
953
|
+
newBody,
|
|
954
|
+
)
|
|
955
|
+
result.onUpdate(node)
|
|
956
|
+
return result
|
|
957
|
+
}
|
|
958
|
+
node.setTest(newTest)
|
|
490
959
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
960
|
+
return node
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
function visitDoWhileStatement(node: DoWhileStatement, visitor: Visitor) {
|
|
964
|
+
global.updateTracker.push()
|
|
965
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
966
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
967
|
+
if (global.updateTracker.check()) {
|
|
968
|
+
const result = factory.createDoWhileStatement(
|
|
969
|
+
newBody,
|
|
970
|
+
newTest,
|
|
496
971
|
)
|
|
972
|
+
result.onUpdate(node)
|
|
973
|
+
return result
|
|
497
974
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
975
|
+
return node
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
function visitForUpdateStatement(node: ForUpdateStatement, visitor: Visitor) {
|
|
979
|
+
global.updateTracker.push()
|
|
980
|
+
const newInit = nodeVisitor(node.init, visitor)
|
|
981
|
+
const newTest = nodeVisitor(node.test, visitor)
|
|
982
|
+
const newUpdate = nodeVisitor(node.update, visitor)
|
|
983
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
984
|
+
if (global.updateTracker.check()) {
|
|
985
|
+
const result = factory.createForUpdateStatement(
|
|
986
|
+
newInit,
|
|
987
|
+
newTest,
|
|
988
|
+
newUpdate,
|
|
989
|
+
newBody,
|
|
505
990
|
)
|
|
991
|
+
result.onUpdate(node)
|
|
992
|
+
return result
|
|
506
993
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
994
|
+
return node
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function visitForInStatement(node: ForInStatement, visitor: Visitor) {
|
|
998
|
+
global.updateTracker.push()
|
|
999
|
+
const newLeft = nodeVisitor(node.left, visitor)
|
|
1000
|
+
const newRight = nodeVisitor(node.right, visitor)
|
|
1001
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
1002
|
+
if (global.updateTracker.check()) {
|
|
1003
|
+
const result = factory.createForInStatement(
|
|
1004
|
+
newLeft,
|
|
1005
|
+
newRight,
|
|
1006
|
+
newBody,
|
|
513
1007
|
)
|
|
1008
|
+
result.onUpdate(node)
|
|
1009
|
+
return result
|
|
514
1010
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
1011
|
+
return node
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
function visitForOfStatement(node: ForOfStatement, visitor: Visitor) {
|
|
1015
|
+
global.updateTracker.push()
|
|
1016
|
+
const newLeft = nodeVisitor(node.left, visitor)
|
|
1017
|
+
const newRight = nodeVisitor(node.right, visitor)
|
|
1018
|
+
const newBody = nodeVisitor(node.body, visitor)
|
|
1019
|
+
if (global.updateTracker.check()) {
|
|
1020
|
+
const result = factory.createForOfStatement(
|
|
1021
|
+
newLeft,
|
|
1022
|
+
newRight,
|
|
1023
|
+
newBody,
|
|
1024
|
+
node.isAwait,
|
|
522
1025
|
)
|
|
1026
|
+
result.onUpdate(node)
|
|
1027
|
+
return result
|
|
523
1028
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
1029
|
+
return node
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function visitETSImportDeclaration(node: ETSImportDeclaration, visitor: Visitor) {
|
|
1033
|
+
global.updateTracker.push()
|
|
1034
|
+
const newSource = nodeVisitor(node.source, visitor)
|
|
1035
|
+
const newSpecifiers = nodesVisitor(node.specifiers, visitor)
|
|
1036
|
+
if (global.updateTracker.check()) {
|
|
1037
|
+
const result = factory.createETSImportDeclaration(
|
|
1038
|
+
newSource,
|
|
1039
|
+
newSpecifiers,
|
|
1040
|
+
Es2pandaImportKinds.IMPORT_KINDS_ALL,
|
|
530
1041
|
)
|
|
1042
|
+
result.onUpdate(node)
|
|
1043
|
+
return result
|
|
531
1044
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
1045
|
+
return node
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
function visitTSNonNullExpression(node: TSNonNullExpression, visitor: Visitor) {
|
|
1049
|
+
global.updateTracker.push()
|
|
1050
|
+
const newExpr = nodeVisitor(node.expr, visitor)
|
|
1051
|
+
if (global.updateTracker.check()) {
|
|
1052
|
+
node.setExpr(newExpr)
|
|
1053
|
+
if (newExpr) newExpr.parent = node
|
|
537
1054
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
1055
|
+
return node
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
function visitUpdateExpression(node: UpdateExpression, visitor: Visitor) {
|
|
1059
|
+
global.updateTracker.push()
|
|
1060
|
+
const newArgument = nodeVisitor(node.argument, visitor)
|
|
1061
|
+
if (global.updateTracker.check()) {
|
|
1062
|
+
const result = factory.createUpdateExpression(
|
|
1063
|
+
newArgument,
|
|
542
1064
|
node.operatorType,
|
|
543
|
-
node.isPrefix
|
|
544
|
-
)
|
|
545
|
-
}
|
|
546
|
-
if (isETSTypeReference(node)) {
|
|
547
|
-
return factory.updateETSTypeReference(
|
|
548
|
-
node,
|
|
549
|
-
nodeVisitor(node.part, visitor),
|
|
550
|
-
)
|
|
551
|
-
}
|
|
552
|
-
if (isETSTypeReferencePart(node)) {
|
|
553
|
-
return factory.updateETSTypeReferencePart(
|
|
554
|
-
node,
|
|
555
|
-
nodeVisitor(node.name, visitor),
|
|
556
|
-
nodeVisitor(node.typeParams, visitor),
|
|
557
|
-
nodeVisitor(node.previous, visitor),
|
|
1065
|
+
node.isPrefix,
|
|
558
1066
|
)
|
|
1067
|
+
result.onUpdate(node)
|
|
1068
|
+
return result
|
|
559
1069
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
1070
|
+
return node
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
function visitTSTypeParameterInstantiation(node: TSTypeParameterInstantiation, visitor: Visitor) {
|
|
1074
|
+
global.updateTracker.push()
|
|
1075
|
+
const newParams: readonly TypeNode[] = nodesVisitor(node.params, visitor)
|
|
1076
|
+
if (global.updateTracker.check()) {
|
|
1077
|
+
const result = factory.createTSTypeParameterInstantiation(
|
|
1078
|
+
newParams,
|
|
564
1079
|
)
|
|
1080
|
+
result.onUpdate(node)
|
|
1081
|
+
return result
|
|
565
1082
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
1083
|
+
return node
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
function visitTSTypeParameterDeclaration(node: TSTypeParameterDeclaration, visitor: Visitor) {
|
|
1087
|
+
global.updateTracker.push()
|
|
1088
|
+
const newParams: readonly TSTypeParameter[] = nodesVisitor(node.params, visitor)
|
|
1089
|
+
if (global.updateTracker.check()) {
|
|
1090
|
+
const result = factory.createTSTypeParameterDeclaration(
|
|
1091
|
+
newParams,
|
|
570
1092
|
node.requiredParams,
|
|
571
1093
|
)
|
|
1094
|
+
result.onUpdate(node)
|
|
1095
|
+
return result
|
|
572
1096
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return factory.updateClassStaticBlock(
|
|
1097
|
+
return node
|
|
1098
|
+
}
|
|
576
1099
|
|
|
1100
|
+
function visitClassStaticBlock(node: ClassStaticBlock, visitor: Visitor) {
|
|
1101
|
+
global.updateTracker.push()
|
|
1102
|
+
const newId = nodeVisitor(node.id, visitor)
|
|
1103
|
+
const newFunction = nodeVisitor(node.function, visitor)
|
|
1104
|
+
if (global.updateTracker.check()) {
|
|
1105
|
+
const result = ClassStaticBlock.createClassStaticBlock(
|
|
1106
|
+
factory.createFunctionExpression(
|
|
1107
|
+
newId,
|
|
1108
|
+
newFunction,
|
|
1109
|
+
)
|
|
577
1110
|
)
|
|
578
|
-
|
|
579
|
-
|
|
1111
|
+
result.onUpdate(node)
|
|
1112
|
+
return result
|
|
1113
|
+
}
|
|
1114
|
+
return node
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
const visitsTable: (((node: any, visitor: Visitor) => any) | undefined)[] = []
|
|
1118
|
+
|
|
1119
|
+
export function initVisitsTable() {
|
|
1120
|
+
const length = Object.values(Es2pandaAstNodeType).length / 2
|
|
1121
|
+
visitsTable.push(...new Array(length))
|
|
1122
|
+
|
|
1123
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER] = visitIdentifier
|
|
1124
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_MEMBER_EXPRESSION] = visitMemberExpression
|
|
1125
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE] = visitETSTypeReference
|
|
1126
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE_PART] = visitETSTypeReferencePart
|
|
1127
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE] = visitETSModule
|
|
1128
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION] = visitCallExpression
|
|
1129
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION] = visitFunctionDeclaration
|
|
1130
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT] = visitBlockStatement
|
|
1131
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_EXPRESSION] = visitBlockExpression
|
|
1132
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CHAIN_EXPRESSION] = visitChainExpression
|
|
1133
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT] = visitExpressionStatement
|
|
1134
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION] = visitETSStructDeclaration
|
|
1135
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION] = visitClassDeclaration
|
|
1136
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DEFINITION] = visitClassDefinition
|
|
1137
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION] = visitMethodDefinition
|
|
1138
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SCRIPT_FUNCTION] = visitScriptFunction
|
|
1139
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION] = visitETSParameterExpression
|
|
1140
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SWITCH_STATEMENT] = visitSwitchStatement
|
|
1141
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SWITCH_CASE_STATEMENT] = visitSwitchCaseStatement
|
|
1142
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_INTERFACE_DECLARATION] = visitTSInterfaceDeclaration
|
|
1143
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_INTERFACE_BODY] = visitTSInterfaceBody
|
|
1144
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT] = visitIfStatement
|
|
1145
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CONDITIONAL_EXPRESSION] = visitConditionalExpression
|
|
1146
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION] = visitVariableDeclararion
|
|
1147
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR] = visitVariableDeclarator
|
|
1148
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION] = visitArrowFunctionExpression
|
|
1149
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_RETURN_STATEMENT] = visitReturnStatement
|
|
1150
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_AS_EXPRESSION] = visitTSAsExpression
|
|
1151
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TEMPLATE_LITERAL] = visitTemplateLiteral
|
|
1152
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_ALIAS_DECLARATION] = visitTSTypeAliasDeclaration
|
|
1153
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TRY_STATEMENT] = visitTryStatement
|
|
1154
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_OBJECT_EXPRESSION] = visitObjectExpression
|
|
1155
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_EXPRESSION] = visitFunctionExpression
|
|
1156
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ARRAY_EXPRESSION] = visitArrayExpression
|
|
1157
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ASSIGNMENT_EXPRESSION] = visitAssignmentExpression
|
|
1158
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TUPLE] = visitETSTyple
|
|
1159
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_UNION_TYPE] = visitETSUnionType
|
|
1160
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_FUNCTION_TYPE] = visitETSFunctionType
|
|
1161
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_PROPERTY] = visitClassProperty
|
|
1162
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_PROPERTY] = visitProperty
|
|
1163
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BINARY_EXPRESSION] = visitBinaryExpression
|
|
1164
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_NEW_CLASS_INSTANCE_EXPRESSION] = visitETSNewClassInstanceExpression
|
|
1165
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_WHILE_STATEMENT] = visitWhileStatement
|
|
1166
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_DO_WHILE_STATEMENT] = visitDoWhileStatement
|
|
1167
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_UPDATE_STATEMENT] = visitForUpdateStatement
|
|
1168
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_IN_STATEMENT] = visitForInStatement
|
|
1169
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_OF_STATEMENT] = visitForOfStatement
|
|
1170
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION] = visitETSImportDeclaration
|
|
1171
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_NON_NULL_EXPRESSION] = visitTSNonNullExpression
|
|
1172
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_UPDATE_EXPRESSION] = visitUpdateExpression
|
|
1173
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_DECLARATION] = visitTSTypeParameterDeclaration
|
|
1174
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_INSTANTIATION] = visitTSTypeParameterInstantiation
|
|
1175
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_STATIC_BLOCK] = visitClassStaticBlock
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
export function visitEachChild(
|
|
1179
|
+
node: AstNode,
|
|
1180
|
+
visitor: Visitor
|
|
1181
|
+
): AstNode {
|
|
1182
|
+
global.profiler.nodeVisited()
|
|
1183
|
+
const visit = visitsTable[node.astNodeType]
|
|
1184
|
+
if (visit) {
|
|
1185
|
+
return visit(node, visitor)
|
|
1186
|
+
}
|
|
580
1187
|
return node
|
|
581
1188
|
}
|