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