@idlizer/arktscgen 2.1.10-arktscgen-4 → 2.1.10-arktscgen-5
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/native/meson.build +1 -1
- package/build/libarkts-copy/native/src/bridges.cc +72 -115
- package/build/libarkts-copy/native/src/common.cc +225 -84
- package/build/libarkts-copy/native/src/common.h +22 -22
- package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
- package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
- package/build/libarkts-copy/package.json +21 -17
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
- package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +38 -29
- package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
- 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 -49
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
- package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
- 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 +98 -30
- 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 +39 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
- package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
- 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/plugin-utils.ts +52 -40
- package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
- package/build/libarkts-copy/src/tracer.ts +75 -69
- 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 +115 -112
- 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 +97 -70
- package/build/libarkts-copy/tsconfig.json +3 -2
- package/lib/index.js +172 -77
- package/package.json +51 -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/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,135 +137,133 @@ 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 oldTypeParams = node.typeParams
|
|
316
|
-
const newTypeParams = nodeVisitor(oldTypeParams, visitor)
|
|
317
|
-
const newParams: readonly Expression[] = nodesVisitor(node.params, visitor)
|
|
318
|
-
const newReturnTypeAnnotation = nodeVisitor(node.returnTypeAnnotation, visitor)
|
|
319
|
-
const newId = nodeVisitor(node.id, visitor)
|
|
320
|
-
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor)
|
|
258
|
+
function visitScriptFunction(node: ScriptFunction, visitor: Visitor): ScriptFunction {
|
|
259
|
+
global.updateTracker.push();
|
|
260
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
261
|
+
const oldTypeParams = node.typeParams;
|
|
262
|
+
const newTypeParams = nodeVisitor(oldTypeParams, visitor);
|
|
263
|
+
const newParams: readonly Expression[] = nodesVisitor(node.params, visitor);
|
|
264
|
+
const newReturnTypeAnnotation = nodeVisitor(node.returnTypeAnnotation, visitor);
|
|
265
|
+
const newId = nodeVisitor(node.id, visitor);
|
|
266
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
321
267
|
if (global.updateTracker.check()) {
|
|
322
268
|
if (!isSameNativeObject(newTypeParams, oldTypeParams)) {
|
|
323
269
|
const result = factory.createScriptFunction(
|
|
@@ -331,27 +277,27 @@ function visitScriptFunction(node: ScriptFunction, visitor: Visitor) {
|
|
|
331
277
|
newId,
|
|
332
278
|
newAnnotations,
|
|
333
279
|
node.getSignaturePointer(),
|
|
334
|
-
node.getPreferredReturnTypePointer()
|
|
335
|
-
)
|
|
336
|
-
result.onUpdate(node)
|
|
337
|
-
return result
|
|
280
|
+
node.getPreferredReturnTypePointer()
|
|
281
|
+
);
|
|
282
|
+
result.onUpdate(node);
|
|
283
|
+
return result;
|
|
338
284
|
}
|
|
339
|
-
node.setBody(newBody)
|
|
340
|
-
node.setParams(newParams)
|
|
341
|
-
node.setReturnTypeAnnotation(newReturnTypeAnnotation)
|
|
342
|
-
if (newId) node.setIdent(newId)
|
|
343
|
-
node.setAnnotations(newAnnotations)
|
|
285
|
+
node.setBody(newBody);
|
|
286
|
+
node.setParams(newParams);
|
|
287
|
+
node.setReturnTypeAnnotation(newReturnTypeAnnotation);
|
|
288
|
+
if (newId) node.setIdent(newId);
|
|
289
|
+
node.setAnnotations(newAnnotations);
|
|
344
290
|
}
|
|
345
|
-
return node
|
|
291
|
+
return node;
|
|
346
292
|
}
|
|
347
293
|
|
|
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)
|
|
294
|
+
function visitMethodDefinition(node: MethodDefinition, visitor: Visitor): MethodDefinition {
|
|
295
|
+
global.updateTracker.push();
|
|
296
|
+
const oldId = node.id;
|
|
297
|
+
const newId = nodeVisitor(oldId, visitor);
|
|
298
|
+
const oldValue = node.value;
|
|
299
|
+
const newValue = nodeVisitor(oldValue, visitor);
|
|
300
|
+
const newOverloads: readonly MethodDefinition[] = nodesVisitor(node.overloads, visitor);
|
|
355
301
|
if (global.updateTracker.check()) {
|
|
356
302
|
if (!isSameNativeObject(newValue, node.value) || !isSameNativeObject(newId, oldId)) {
|
|
357
303
|
const result = factory.createMethodDefinition(
|
|
@@ -360,223 +306,208 @@ function visitMethodDefinition(node: MethodDefinition, visitor: Visitor) {
|
|
|
360
306
|
newValue,
|
|
361
307
|
node.modifierFlags,
|
|
362
308
|
node.isComputed,
|
|
363
|
-
newOverloads
|
|
364
|
-
)
|
|
365
|
-
result.onUpdate(node)
|
|
366
|
-
return result
|
|
309
|
+
newOverloads
|
|
310
|
+
);
|
|
311
|
+
result.onUpdate(node);
|
|
312
|
+
return result;
|
|
367
313
|
}
|
|
368
|
-
node.setOverloads(newOverloads)
|
|
369
|
-
newOverloads.forEach(it => {
|
|
370
|
-
it.setBaseOverloadMethod(node)
|
|
371
|
-
it.parent = node
|
|
372
|
-
})
|
|
314
|
+
node.setOverloads(newOverloads);
|
|
315
|
+
newOverloads.forEach((it): void => {
|
|
316
|
+
it.setBaseOverloadMethod(node);
|
|
317
|
+
it.parent = node;
|
|
318
|
+
});
|
|
373
319
|
}
|
|
374
|
-
return node
|
|
320
|
+
return node;
|
|
375
321
|
}
|
|
376
322
|
|
|
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)
|
|
323
|
+
function visitArrowFunctionExpression(node: ArrowFunctionExpression, visitor: Visitor): ArrowFunctionExpression {
|
|
324
|
+
global.updateTracker.push();
|
|
325
|
+
const oldFunction = node.function;
|
|
326
|
+
const newFunction = nodeVisitor(oldFunction, visitor);
|
|
327
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
382
328
|
if (global.updateTracker.check()) {
|
|
383
329
|
if (!isSameNativeObject(newFunction, oldFunction)) {
|
|
384
|
-
const result = factory.createArrowFunctionExpression(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
)
|
|
388
|
-
result.onUpdate(node)
|
|
389
|
-
return result
|
|
330
|
+
const result = factory.createArrowFunctionExpression(newFunction, newAnnotations);
|
|
331
|
+
result.onUpdate(node);
|
|
332
|
+
return result;
|
|
390
333
|
}
|
|
391
|
-
node.setAnnotations(newAnnotations)
|
|
334
|
+
node.setAnnotations(newAnnotations);
|
|
392
335
|
}
|
|
393
|
-
return node
|
|
336
|
+
return node;
|
|
394
337
|
}
|
|
395
338
|
|
|
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)
|
|
339
|
+
function visitFunctionDeclaration(node: FunctionDeclaration, visitor: Visitor): FunctionDeclaration {
|
|
340
|
+
global.updateTracker.push();
|
|
341
|
+
const oldFunction = node.function;
|
|
342
|
+
const newFunction = nodeVisitor(oldFunction, visitor);
|
|
343
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
401
344
|
if (global.updateTracker.check()) {
|
|
402
345
|
if (!isSameNativeObject(newFunction, oldFunction)) {
|
|
403
|
-
const result = factory.createFunctionDeclaration(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
node.isAnonymous,
|
|
407
|
-
)
|
|
408
|
-
result.onUpdate(node)
|
|
409
|
-
return result
|
|
346
|
+
const result = factory.createFunctionDeclaration(newFunction, newAnnotations, node.isAnonymous);
|
|
347
|
+
result.onUpdate(node);
|
|
348
|
+
return result;
|
|
410
349
|
}
|
|
411
|
-
node.setAnnotations(newAnnotations)
|
|
350
|
+
node.setAnnotations(newAnnotations);
|
|
412
351
|
}
|
|
413
|
-
return node
|
|
352
|
+
return node;
|
|
414
353
|
}
|
|
415
354
|
|
|
416
|
-
function visitBlockExpression(node: BlockExpression, visitor: Visitor) {
|
|
417
|
-
global.updateTracker.push()
|
|
418
|
-
const newStatements: readonly Statement[] = nodesVisitor(node.statements, visitor)
|
|
355
|
+
function visitBlockExpression(node: BlockExpression, visitor: Visitor): BlockExpression {
|
|
356
|
+
global.updateTracker.push();
|
|
357
|
+
const newStatements: readonly Statement[] = nodesVisitor(node.statements, visitor);
|
|
419
358
|
if (global.updateTracker.check()) {
|
|
420
|
-
const result = factory.createBlockExpression(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
result.onUpdate(node)
|
|
424
|
-
return result
|
|
359
|
+
const result = factory.createBlockExpression(newStatements);
|
|
360
|
+
result.onUpdate(node);
|
|
361
|
+
return result;
|
|
425
362
|
}
|
|
426
|
-
return node
|
|
363
|
+
return node;
|
|
427
364
|
}
|
|
428
365
|
|
|
429
|
-
function visitChainExpression(node: ChainExpression, visitor: Visitor) {
|
|
430
|
-
global.updateTracker.push()
|
|
431
|
-
const newExpression = nodeVisitor(node.expression, visitor)
|
|
366
|
+
function visitChainExpression(node: ChainExpression, visitor: Visitor): ChainExpression {
|
|
367
|
+
global.updateTracker.push();
|
|
368
|
+
const newExpression = nodeVisitor(node.expression, visitor);
|
|
432
369
|
if (global.updateTracker.check()) {
|
|
433
|
-
const result = factory.createChainExpression(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
result.onUpdate(node)
|
|
437
|
-
return result
|
|
370
|
+
const result = factory.createChainExpression(newExpression);
|
|
371
|
+
result.onUpdate(node);
|
|
372
|
+
return result;
|
|
438
373
|
}
|
|
439
|
-
return node
|
|
374
|
+
return node;
|
|
440
375
|
}
|
|
441
376
|
|
|
442
|
-
function visitExpressionStatement(node: ExpressionStatement, visitor: Visitor) {
|
|
443
|
-
global.updateTracker.push()
|
|
444
|
-
const newExpression = nodeVisitor(node.expression, visitor)
|
|
377
|
+
function visitExpressionStatement(node: ExpressionStatement, visitor: Visitor): ExpressionStatement {
|
|
378
|
+
global.updateTracker.push();
|
|
379
|
+
const newExpression = nodeVisitor(node.expression, visitor);
|
|
445
380
|
if (global.updateTracker.check()) {
|
|
446
|
-
node.setExpression(newExpression)
|
|
381
|
+
node.setExpression(newExpression);
|
|
447
382
|
}
|
|
448
|
-
return node
|
|
383
|
+
return node;
|
|
449
384
|
}
|
|
450
385
|
|
|
451
|
-
function visitETSStructDeclaration(node: ETSStructDeclaration, visitor: Visitor) {
|
|
452
|
-
global.updateTracker.push()
|
|
453
|
-
const newDefinition = nodeVisitor(node.definition, visitor)
|
|
386
|
+
function visitETSStructDeclaration(node: ETSStructDeclaration, visitor: Visitor): ETSStructDeclaration {
|
|
387
|
+
global.updateTracker.push();
|
|
388
|
+
const newDefinition = nodeVisitor(node.definition, visitor);
|
|
454
389
|
if (global.updateTracker.check()) {
|
|
455
|
-
node.setDefinition(newDefinition)
|
|
390
|
+
node.setDefinition(newDefinition);
|
|
456
391
|
}
|
|
457
|
-
return node
|
|
392
|
+
return node;
|
|
458
393
|
}
|
|
459
394
|
|
|
460
|
-
function visitClassDeclaration(node: ClassDeclaration, visitor: Visitor) {
|
|
461
|
-
global.updateTracker.push()
|
|
462
|
-
const newDefinition = nodeVisitor(node.definition, visitor)
|
|
395
|
+
function visitClassDeclaration(node: ClassDeclaration, visitor: Visitor): ClassDeclaration {
|
|
396
|
+
global.updateTracker.push();
|
|
397
|
+
const newDefinition = nodeVisitor(node.definition, visitor);
|
|
463
398
|
if (global.updateTracker.check()) {
|
|
464
|
-
node.setDefinition(newDefinition)
|
|
399
|
+
node.setDefinition(newDefinition);
|
|
465
400
|
}
|
|
466
|
-
return node
|
|
401
|
+
return node;
|
|
467
402
|
}
|
|
468
403
|
|
|
469
|
-
function visitTSInterfaceBody(node: TSInterfaceBody, visitor: Visitor) {
|
|
470
|
-
global.updateTracker.push()
|
|
471
|
-
const newBody = nodesVisitor(node.body, visitor)
|
|
404
|
+
function visitTSInterfaceBody(node: TSInterfaceBody, visitor: Visitor): TSInterfaceBody {
|
|
405
|
+
global.updateTracker.push();
|
|
406
|
+
const newBody = nodesVisitor(node.body, visitor);
|
|
472
407
|
if (global.updateTracker.check()) {
|
|
473
|
-
const result = factory.createTSInterfaceBody(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
result.onUpdate(node)
|
|
477
|
-
return result
|
|
408
|
+
const result = factory.createTSInterfaceBody(newBody);
|
|
409
|
+
result.onUpdate(node);
|
|
410
|
+
return result;
|
|
478
411
|
}
|
|
479
|
-
return node
|
|
412
|
+
return node;
|
|
480
413
|
}
|
|
481
414
|
|
|
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)
|
|
415
|
+
function visitClassDefinition(node: ClassDefinition, visitor: Visitor): ClassDefinition {
|
|
416
|
+
global.updateTracker.push();
|
|
417
|
+
const newIdent = nodeVisitor(node.ident, visitor);
|
|
418
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor);
|
|
419
|
+
const oldSuperTypeParams = node.superTypeParams;
|
|
420
|
+
const newSuperTypeParams = nodeVisitor(oldSuperTypeParams, visitor);
|
|
421
|
+
const oldImplements = node.implements;
|
|
422
|
+
const newImplements: readonly TSClassImplements[] = nodesVisitor(oldImplements, visitor);
|
|
423
|
+
const newSuper = nodeVisitor(node.super, visitor);
|
|
424
|
+
const newBody = nodesVisitor(node.body, visitor);
|
|
425
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
493
426
|
if (global.updateTracker.check()) {
|
|
494
|
-
if (
|
|
427
|
+
if (
|
|
428
|
+
!isSameNativeObject(oldSuperTypeParams, newSuperTypeParams) ||
|
|
429
|
+
!isSameNativeObject(newImplements, oldImplements)
|
|
430
|
+
) {
|
|
495
431
|
const result = factory.createClassDefinition(
|
|
496
432
|
newIdent,
|
|
497
433
|
newTypeParams,
|
|
498
434
|
newSuperTypeParams,
|
|
499
435
|
newImplements,
|
|
500
|
-
undefined
|
|
436
|
+
undefined /* can not pass node.ctor here because of mismatching types */,
|
|
501
437
|
newSuper,
|
|
502
438
|
newBody,
|
|
503
439
|
node.modifiers,
|
|
504
440
|
node.modifierFlags,
|
|
505
|
-
newAnnotations
|
|
506
|
-
)
|
|
507
|
-
result.onUpdate(node)
|
|
508
|
-
return result
|
|
441
|
+
newAnnotations
|
|
442
|
+
);
|
|
443
|
+
result.onUpdate(node);
|
|
444
|
+
return result;
|
|
509
445
|
}
|
|
510
|
-
node.setIdent(newIdent)
|
|
511
|
-
node.setTypeParams(newTypeParams)
|
|
512
|
-
node.setSuper(newSuper)
|
|
513
|
-
node.setBody(newBody)
|
|
514
|
-
node.setAnnotations(newAnnotations)
|
|
446
|
+
node.setIdent(newIdent);
|
|
447
|
+
node.setTypeParams(newTypeParams);
|
|
448
|
+
node.setSuper(newSuper);
|
|
449
|
+
node.setBody(newBody);
|
|
450
|
+
node.setAnnotations(newAnnotations);
|
|
515
451
|
}
|
|
516
|
-
return node
|
|
452
|
+
return node;
|
|
517
453
|
}
|
|
518
454
|
|
|
519
|
-
function visitETSParameterExpression(node: ETSParameterExpression, visitor: Visitor) {
|
|
455
|
+
function visitETSParameterExpression(node: ETSParameterExpression, visitor: Visitor): ETSParameterExpression {
|
|
520
456
|
if (node.isRestParameter) {
|
|
521
457
|
/** there is no RestParameter node at .idl */
|
|
522
|
-
return node
|
|
458
|
+
return node;
|
|
523
459
|
}
|
|
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)
|
|
460
|
+
global.updateTracker.push();
|
|
461
|
+
const newIdent = nodeVisitor(node.ident, visitor);
|
|
462
|
+
const newInit = nodeVisitor(node.initializer, visitor);
|
|
463
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
528
464
|
if (global.updateTracker.check()) {
|
|
529
|
-
node.setIdent(newIdent)
|
|
530
|
-
node.setInitializer(newInit)
|
|
531
|
-
node.setAnnotations(newAnnotations)
|
|
465
|
+
node.setIdent(newIdent);
|
|
466
|
+
node.setInitializer(newInit);
|
|
467
|
+
node.setAnnotations(newAnnotations);
|
|
532
468
|
}
|
|
533
|
-
return node
|
|
469
|
+
return node;
|
|
534
470
|
}
|
|
535
471
|
|
|
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)
|
|
472
|
+
function visitSwitchStatement(node: SwitchStatement, visitor: Visitor): SwitchStatement {
|
|
473
|
+
global.updateTracker.push();
|
|
474
|
+
const newDiscriminant = nodeVisitor(node.discriminant, visitor);
|
|
475
|
+
const oldCases = node.cases;
|
|
476
|
+
const newCases: readonly SwitchCaseStatement[] = nodesVisitor(oldCases, visitor);
|
|
541
477
|
if (global.updateTracker.check()) {
|
|
542
478
|
if (!isSameNativeObject(newCases, oldCases)) {
|
|
543
|
-
const result = factory.createSwitchStatement(
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
)
|
|
547
|
-
result.onUpdate(node)
|
|
548
|
-
return result
|
|
479
|
+
const result = factory.createSwitchStatement(newDiscriminant, newCases);
|
|
480
|
+
result.onUpdate(node);
|
|
481
|
+
return result;
|
|
549
482
|
}
|
|
550
|
-
node.setDiscriminant(newDiscriminant)
|
|
483
|
+
node.setDiscriminant(newDiscriminant);
|
|
551
484
|
}
|
|
552
|
-
return node
|
|
485
|
+
return node;
|
|
553
486
|
}
|
|
554
487
|
|
|
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)
|
|
488
|
+
function visitSwitchCaseStatement(node: SwitchCaseStatement, visitor: Visitor): SwitchCaseStatement {
|
|
489
|
+
global.updateTracker.push();
|
|
490
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
491
|
+
const oldConsequent = node.consequent;
|
|
492
|
+
const newConsequent: readonly Statement[] = nodesVisitor(oldConsequent, visitor);
|
|
560
493
|
if (global.updateTracker.check()) {
|
|
561
494
|
if (!isSameNativeObject(newConsequent, oldConsequent)) {
|
|
562
|
-
const result = factory.createSwitchCaseStatement(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
)
|
|
566
|
-
result.onUpdate(node)
|
|
567
|
-
return result
|
|
495
|
+
const result = factory.createSwitchCaseStatement(newTest, newConsequent);
|
|
496
|
+
result.onUpdate(node);
|
|
497
|
+
return result;
|
|
568
498
|
}
|
|
569
|
-
node.setTest(newTest)
|
|
499
|
+
node.setTest(newTest);
|
|
570
500
|
}
|
|
571
|
-
return node
|
|
501
|
+
return node;
|
|
572
502
|
}
|
|
573
503
|
|
|
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)
|
|
504
|
+
function visitTSInterfaceDeclaration(node: TSInterfaceDeclaration, visitor: Visitor): TSInterfaceDeclaration {
|
|
505
|
+
global.updateTracker.push();
|
|
506
|
+
const newExtends: readonly TSInterfaceHeritage[] = nodesVisitor(node.extends, visitor);
|
|
507
|
+
const newIdent = nodeVisitor(node.id, visitor);
|
|
508
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor);
|
|
509
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
510
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
580
511
|
if (global.updateTracker.check()) {
|
|
581
512
|
const result = factory.createInterfaceDeclaration(
|
|
582
513
|
newExtends,
|
|
@@ -585,269 +516,236 @@ function visitTSInterfaceDeclaration(node: TSInterfaceDeclaration, visitor: Visi
|
|
|
585
516
|
newBody,
|
|
586
517
|
node.isStatic,
|
|
587
518
|
node.isFromExternal,
|
|
588
|
-
node.modifierFlags
|
|
589
|
-
)
|
|
590
|
-
result.onUpdate(node)
|
|
591
|
-
|
|
519
|
+
node.modifierFlags
|
|
520
|
+
);
|
|
521
|
+
result.onUpdate(node);
|
|
522
|
+
result.setAnnotations(newAnnotations);
|
|
523
|
+
return result;
|
|
592
524
|
}
|
|
593
|
-
return node
|
|
525
|
+
return node;
|
|
594
526
|
}
|
|
595
527
|
|
|
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)
|
|
528
|
+
function visitIfStatement(node: IfStatement, visitor: Visitor): IfStatement {
|
|
529
|
+
global.updateTracker.push();
|
|
530
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
531
|
+
const oldConsequent = node.consequent;
|
|
532
|
+
const newConsequent = nodeVisitor(oldConsequent, visitor);
|
|
533
|
+
const newAlternate = nodeVisitor(node.alternate, visitor);
|
|
602
534
|
if (global.updateTracker.check()) {
|
|
603
535
|
if (!isSameNativeObject(newConsequent, oldConsequent)) {
|
|
604
|
-
const result = factory.createIfStatement(
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
newAlternate,
|
|
608
|
-
)
|
|
609
|
-
result.onUpdate(node)
|
|
610
|
-
return result
|
|
536
|
+
const result = factory.createIfStatement(newTest, newConsequent, newAlternate);
|
|
537
|
+
result.onUpdate(node);
|
|
538
|
+
return result;
|
|
611
539
|
}
|
|
612
|
-
node.setTest(newTest)
|
|
613
|
-
if (newTest) newTest.parent = node
|
|
614
|
-
node.setAlternate(newAlternate)
|
|
540
|
+
node.setTest(newTest);
|
|
541
|
+
if (newTest) newTest.parent = node;
|
|
542
|
+
node.setAlternate(newAlternate);
|
|
615
543
|
}
|
|
616
|
-
return node
|
|
544
|
+
return node;
|
|
617
545
|
}
|
|
618
546
|
|
|
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)
|
|
547
|
+
function visitConditionalExpression(node: ConditionalExpression, visitor: Visitor): ConditionalExpression {
|
|
548
|
+
global.updateTracker.push();
|
|
549
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
550
|
+
const newConsequent = nodeVisitor(node.consequent, visitor);
|
|
551
|
+
const newAlternate = nodeVisitor(node.alternate, visitor);
|
|
624
552
|
if (global.updateTracker.check()) {
|
|
625
|
-
node.setTest(newTest)
|
|
626
|
-
node.setConsequent(newConsequent)
|
|
627
|
-
node.setAlternate(newAlternate)
|
|
553
|
+
node.setTest(newTest);
|
|
554
|
+
node.setConsequent(newConsequent);
|
|
555
|
+
node.setAlternate(newAlternate);
|
|
628
556
|
}
|
|
629
|
-
return node
|
|
557
|
+
return node;
|
|
630
558
|
}
|
|
631
559
|
|
|
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)
|
|
560
|
+
function visitVariableDeclararion(node: VariableDeclaration, visitor: Visitor): VariableDeclaration {
|
|
561
|
+
global.updateTracker.push();
|
|
562
|
+
const oldDeclarators = node.declarators;
|
|
563
|
+
const newDeclarators: readonly VariableDeclarator[] = nodesVisitor(oldDeclarators, visitor);
|
|
564
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
637
565
|
if (global.updateTracker.check()) {
|
|
638
566
|
if (!isSameNativeObject(newDeclarators, oldDeclarators)) {
|
|
639
|
-
const result = factory.createVariableDeclaration(
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
newAnnotations,
|
|
643
|
-
)
|
|
644
|
-
result.onUpdate(node)
|
|
645
|
-
return result
|
|
567
|
+
const result = factory.createVariableDeclaration(node.kind, newDeclarators, newAnnotations);
|
|
568
|
+
result.onUpdate(node);
|
|
569
|
+
return result;
|
|
646
570
|
}
|
|
647
|
-
node.setAnnotations(newAnnotations)
|
|
571
|
+
node.setAnnotations(newAnnotations);
|
|
648
572
|
}
|
|
649
|
-
return node
|
|
573
|
+
return node;
|
|
650
574
|
}
|
|
651
575
|
|
|
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)
|
|
576
|
+
function visitVariableDeclarator(node: VariableDeclarator, visitor: Visitor): VariableDeclarator {
|
|
577
|
+
global.updateTracker.push();
|
|
578
|
+
const oldId = node.id;
|
|
579
|
+
const newId = nodeVisitor(oldId, visitor);
|
|
580
|
+
const newInit = nodeVisitor(node.init, visitor);
|
|
657
581
|
if (global.updateTracker.check()) {
|
|
658
582
|
if (!isSameNativeObject(newId, oldId)) {
|
|
659
|
-
const result = factory.createVariableDeclarator(
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
newInit,
|
|
663
|
-
)
|
|
664
|
-
result.onUpdate(node)
|
|
665
|
-
return result
|
|
583
|
+
const result = factory.createVariableDeclarator(node.flag, newId, newInit);
|
|
584
|
+
result.onUpdate(node);
|
|
585
|
+
return result;
|
|
666
586
|
}
|
|
667
|
-
node.setInit(newInit)
|
|
587
|
+
node.setInit(newInit);
|
|
668
588
|
}
|
|
669
|
-
return node
|
|
589
|
+
return node;
|
|
670
590
|
}
|
|
671
591
|
|
|
672
|
-
function visitReturnStatement(node: ReturnStatement, visitor: Visitor) {
|
|
673
|
-
global.updateTracker.push()
|
|
674
|
-
const newArgument = nodeVisitor(node.argument, visitor)
|
|
592
|
+
function visitReturnStatement(node: ReturnStatement, visitor: Visitor): ReturnStatement {
|
|
593
|
+
global.updateTracker.push();
|
|
594
|
+
const newArgument = nodeVisitor(node.argument, visitor);
|
|
675
595
|
if (global.updateTracker.check()) {
|
|
676
|
-
node.setArgument(newArgument)
|
|
596
|
+
node.setArgument(newArgument);
|
|
677
597
|
}
|
|
678
|
-
return node
|
|
598
|
+
return node;
|
|
679
599
|
}
|
|
680
600
|
|
|
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)
|
|
601
|
+
function visitTSAsExpression(node: TSAsExpression, visitor: Visitor): TSAsExpression {
|
|
602
|
+
global.updateTracker.push();
|
|
603
|
+
const newExpr = nodeVisitor(node.expr, visitor);
|
|
604
|
+
const oldTypeAnnotation = node.typeAnnotation;
|
|
605
|
+
const newTypeAnnotation = nodeVisitor(oldTypeAnnotation, visitor);
|
|
686
606
|
if (global.updateTracker.check()) {
|
|
687
607
|
if (!isSameNativeObject(newTypeAnnotation, oldTypeAnnotation)) {
|
|
688
|
-
const result = factory.createTSAsExpression(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
node.isConst,
|
|
692
|
-
)
|
|
693
|
-
result.onUpdate(node)
|
|
694
|
-
return result
|
|
608
|
+
const result = factory.createTSAsExpression(newExpr, newTypeAnnotation, node.isConst);
|
|
609
|
+
result.onUpdate(node);
|
|
610
|
+
return result;
|
|
695
611
|
}
|
|
696
|
-
node.setExpr(newExpr)
|
|
612
|
+
node.setExpr(newExpr);
|
|
697
613
|
}
|
|
698
|
-
return node
|
|
614
|
+
return node;
|
|
699
615
|
}
|
|
700
616
|
|
|
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)
|
|
617
|
+
function visitTemplateLiteral(node: TemplateLiteral, visitor: Visitor): TemplateLiteral {
|
|
618
|
+
global.updateTracker.push();
|
|
619
|
+
const newQuasis: readonly TemplateElement[] = nodesVisitor(node.quasis, visitor);
|
|
620
|
+
const newExpression: readonly Expression[] = nodesVisitor(node.expressions, visitor);
|
|
705
621
|
if (global.updateTracker.check()) {
|
|
706
|
-
const result = factory.createTemplateLiteral(
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
result.onUpdate(node)
|
|
712
|
-
return result
|
|
713
|
-
}
|
|
714
|
-
return node
|
|
622
|
+
const result = factory.createTemplateLiteral(newQuasis, newExpression, node.multilineString);
|
|
623
|
+
result.onUpdate(node);
|
|
624
|
+
return result;
|
|
625
|
+
}
|
|
626
|
+
return node;
|
|
715
627
|
}
|
|
716
628
|
|
|
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)
|
|
629
|
+
function visitTSTypeAliasDeclaration(node: TSTypeAliasDeclaration, visitor: Visitor): TSTypeAliasDeclaration {
|
|
630
|
+
global.updateTracker.push();
|
|
631
|
+
const oldId = node.id;
|
|
632
|
+
const newId = nodeVisitor(oldId, visitor);
|
|
633
|
+
const newTypeParams = nodeVisitor(node.typeParams, visitor);
|
|
634
|
+
const oldTypeAnnotation = node.typeAnnotation;
|
|
635
|
+
const newTypeAnnotation = nodeVisitor(oldTypeAnnotation, visitor);
|
|
636
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
725
637
|
if (global.updateTracker.check()) {
|
|
726
638
|
if (!isSameNativeObject(newId, oldId) || !isSameNativeObject(newTypeAnnotation, oldTypeAnnotation)) {
|
|
727
639
|
const result = factory.createTSTypeAliasDeclaration(
|
|
728
640
|
newId,
|
|
729
641
|
newTypeParams,
|
|
730
642
|
newTypeAnnotation,
|
|
731
|
-
newAnnotations
|
|
732
|
-
)
|
|
733
|
-
result.onUpdate(node)
|
|
734
|
-
return result
|
|
643
|
+
newAnnotations
|
|
644
|
+
);
|
|
645
|
+
result.onUpdate(node);
|
|
646
|
+
return result;
|
|
735
647
|
}
|
|
736
|
-
node.setAnnotations(newAnnotations)
|
|
737
|
-
node.setTypeParameters(newTypeParams)
|
|
648
|
+
node.setAnnotations(newAnnotations);
|
|
649
|
+
node.setTypeParameters(newTypeParams);
|
|
738
650
|
}
|
|
739
|
-
return node
|
|
651
|
+
return node;
|
|
740
652
|
}
|
|
741
653
|
|
|
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)
|
|
654
|
+
function visitTryStatement(node: TryStatement, visitor: Visitor): TryStatement {
|
|
655
|
+
global.updateTracker.push();
|
|
656
|
+
const newBlock = nodeVisitor(node.block, visitor);
|
|
657
|
+
const newCatchClauses: readonly CatchClause[] = nodesVisitor(node.catchClauses, visitor);
|
|
658
|
+
const newFinallyBlock = nodeVisitor(node.finallyBlock, visitor);
|
|
747
659
|
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
|
|
660
|
+
const result = factory.createTryStatement(newBlock, newCatchClauses, newFinallyBlock, [], []);
|
|
661
|
+
result.onUpdate(node);
|
|
662
|
+
return result;
|
|
663
|
+
}
|
|
664
|
+
return node;
|
|
759
665
|
}
|
|
760
666
|
|
|
761
|
-
function visitObjectExpression(node: ObjectExpression, visitor: Visitor) {
|
|
762
|
-
global.updateTracker.push()
|
|
763
|
-
const newProperties: readonly Expression[] = nodesVisitor(node.properties, visitor)
|
|
667
|
+
function visitObjectExpression(node: ObjectExpression, visitor: Visitor): ObjectExpression {
|
|
668
|
+
global.updateTracker.push();
|
|
669
|
+
const newProperties: readonly Expression[] = nodesVisitor(node.properties, visitor);
|
|
764
670
|
if (global.updateTracker.check()) {
|
|
765
|
-
const result = factory.createObjectExpression(
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
return result
|
|
771
|
-
}
|
|
772
|
-
return node
|
|
671
|
+
const result = factory.createObjectExpression(newProperties, node.getPreferredTypePointer());
|
|
672
|
+
result.onUpdate(node);
|
|
673
|
+
return result;
|
|
674
|
+
}
|
|
675
|
+
return node;
|
|
773
676
|
}
|
|
774
677
|
|
|
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)
|
|
678
|
+
function visitFunctionExpression(node: FunctionExpression, visitor: Visitor): FunctionExpression {
|
|
679
|
+
global.updateTracker.push();
|
|
680
|
+
const newId = nodeVisitor(node.id, visitor);
|
|
681
|
+
const newFunction = nodeVisitor(node.function, visitor);
|
|
779
682
|
if (global.updateTracker.check()) {
|
|
780
|
-
const result = factory.createFunctionExpression(
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
return result
|
|
786
|
-
}
|
|
787
|
-
return node
|
|
683
|
+
const result = factory.createFunctionExpression(newId, newFunction);
|
|
684
|
+
result.onUpdate(node);
|
|
685
|
+
return result;
|
|
686
|
+
}
|
|
687
|
+
return node;
|
|
788
688
|
}
|
|
789
689
|
|
|
790
|
-
function visitArrayExpression(node: ArrayExpression, visitor: Visitor) {
|
|
791
|
-
global.updateTracker.push()
|
|
792
|
-
const newElements: readonly Expression[] = nodesVisitor(node.elements, visitor)
|
|
690
|
+
function visitArrayExpression(node: ArrayExpression, visitor: Visitor): ArrayExpression {
|
|
691
|
+
global.updateTracker.push();
|
|
692
|
+
const newElements: readonly Expression[] = nodesVisitor(node.elements, visitor);
|
|
793
693
|
if (global.updateTracker.check()) {
|
|
794
|
-
node.setElements(newElements)
|
|
694
|
+
node.setElements(newElements);
|
|
795
695
|
}
|
|
796
|
-
return node
|
|
696
|
+
return node;
|
|
797
697
|
}
|
|
798
698
|
|
|
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)
|
|
699
|
+
function visitAssignmentExpression(node: AssignmentExpression, visitor: Visitor): AssignmentExpression {
|
|
700
|
+
global.updateTracker.push();
|
|
701
|
+
const newLeft = nodeVisitor(node.left, visitor);
|
|
702
|
+
const newRight = nodeVisitor(node.right, visitor);
|
|
803
703
|
if (global.updateTracker.check()) {
|
|
804
|
-
node.setLeft(newLeft)
|
|
805
|
-
node.setRight(newRight)
|
|
704
|
+
node.setLeft(newLeft);
|
|
705
|
+
node.setRight(newRight);
|
|
806
706
|
}
|
|
807
|
-
return node
|
|
707
|
+
return node;
|
|
808
708
|
}
|
|
809
709
|
|
|
810
|
-
function visitETSTyple(node: ETSTuple, visitor: Visitor) {
|
|
811
|
-
global.updateTracker.push()
|
|
812
|
-
const newTypeAnnotationList: readonly TypeNode[] = nodesVisitor(node.tupleTypeAnnotationsList, visitor)
|
|
710
|
+
function visitETSTyple(node: ETSTuple, visitor: Visitor): ETSTuple {
|
|
711
|
+
global.updateTracker.push();
|
|
712
|
+
const newTypeAnnotationList: readonly TypeNode[] = nodesVisitor(node.tupleTypeAnnotationsList, visitor);
|
|
813
713
|
if (global.updateTracker.check()) {
|
|
814
|
-
node.setTypeAnnotationsList(newTypeAnnotationList)
|
|
714
|
+
node.setTypeAnnotationsList(newTypeAnnotationList);
|
|
815
715
|
}
|
|
816
|
-
return node
|
|
716
|
+
return node;
|
|
817
717
|
}
|
|
818
718
|
|
|
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)
|
|
719
|
+
function visitETSUnionType(node: ETSUnionType, visitor: Visitor): ETSUnionType {
|
|
720
|
+
global.updateTracker.push();
|
|
721
|
+
const oldTypes = node.types;
|
|
722
|
+
const newTypes: readonly TypeNode[] = nodesVisitor(oldTypes, visitor);
|
|
723
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
824
724
|
if (global.updateTracker.check()) {
|
|
825
725
|
if (!isSameNativeObject(newTypes, oldTypes)) {
|
|
826
|
-
const result = factory.createETSUnionType(
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
)
|
|
830
|
-
result.onUpdate(node)
|
|
831
|
-
return result
|
|
726
|
+
const result = factory.createETSUnionType(newTypes, newAnnotations);
|
|
727
|
+
result.onUpdate(node);
|
|
728
|
+
return result;
|
|
832
729
|
}
|
|
833
|
-
node.setAnnotations(newAnnotations)
|
|
730
|
+
node.setAnnotations(newAnnotations);
|
|
834
731
|
}
|
|
835
|
-
return node
|
|
732
|
+
return node;
|
|
836
733
|
}
|
|
837
734
|
|
|
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)
|
|
735
|
+
function visitETSFunctionType(node: ETSFunctionType, visitor: Visitor): ETSFunctionType {
|
|
736
|
+
global.updateTracker.push();
|
|
737
|
+
const oldTypeParams = node.typeParams;
|
|
738
|
+
const newTypeParams = nodeVisitor(oldTypeParams, visitor);
|
|
739
|
+
const oldParams = node.params;
|
|
740
|
+
const newParams: readonly Expression[] = nodesVisitor(oldParams, visitor);
|
|
741
|
+
const oldReturnTypeAnnotation = node.returnType;
|
|
742
|
+
const newReturnTypeAnnotation = nodeVisitor(oldReturnTypeAnnotation, visitor);
|
|
743
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
847
744
|
if (global.updateTracker.check()) {
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
|
|
745
|
+
if (
|
|
746
|
+
!isSameNativeObject(newTypeParams, oldTypeParams) ||
|
|
747
|
+
!isSameNativeObject(newParams, oldParams) ||
|
|
748
|
+
!isSameNativeObject(newReturnTypeAnnotation, oldReturnTypeAnnotation)
|
|
851
749
|
) {
|
|
852
750
|
const result = factory.createETSFunctionType(
|
|
853
751
|
newTypeParams,
|
|
@@ -855,23 +753,23 @@ function visitETSFunctionType(node: ETSFunctionType, visitor: Visitor) {
|
|
|
855
753
|
newReturnTypeAnnotation,
|
|
856
754
|
node.isExtensionFunction,
|
|
857
755
|
node.flags,
|
|
858
|
-
newAnnotations
|
|
859
|
-
)
|
|
860
|
-
result.onUpdate(node)
|
|
861
|
-
return result
|
|
756
|
+
newAnnotations
|
|
757
|
+
);
|
|
758
|
+
result.onUpdate(node);
|
|
759
|
+
return result;
|
|
862
760
|
}
|
|
863
|
-
node.setAnnotations(newAnnotations)
|
|
761
|
+
node.setAnnotations(newAnnotations);
|
|
864
762
|
}
|
|
865
|
-
return node
|
|
763
|
+
return node;
|
|
866
764
|
}
|
|
867
765
|
|
|
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)
|
|
766
|
+
function visitClassProperty(node: ClassProperty, visitor: Visitor): ClassProperty {
|
|
767
|
+
global.updateTracker.push();
|
|
768
|
+
const oldKey = node.key;
|
|
769
|
+
const newKey = nodeVisitor(oldKey, visitor);
|
|
770
|
+
const newValue = nodeVisitor(node.value, visitor);
|
|
771
|
+
const newTypeAnnotation = nodeVisitor(node.typeAnnotation, visitor);
|
|
772
|
+
const newAnnotations: readonly AnnotationUsage[] = nodesVisitor(node.annotations, visitor);
|
|
875
773
|
if (global.updateTracker.check()) {
|
|
876
774
|
if (!isSameNativeObject(newKey, oldKey)) {
|
|
877
775
|
const result = factory.createClassProperty(
|
|
@@ -880,309 +778,275 @@ function visitClassProperty(node: ClassProperty, visitor: Visitor) {
|
|
|
880
778
|
newTypeAnnotation,
|
|
881
779
|
node.modifierFlags,
|
|
882
780
|
node.isComputed,
|
|
883
|
-
newAnnotations
|
|
884
|
-
)
|
|
885
|
-
result.onUpdate(node)
|
|
886
|
-
return result
|
|
781
|
+
newAnnotations
|
|
782
|
+
);
|
|
783
|
+
result.onUpdate(node);
|
|
784
|
+
return result;
|
|
887
785
|
}
|
|
888
|
-
node.setValue(newValue)
|
|
889
|
-
node.setTypeAnnotation(newTypeAnnotation)
|
|
890
|
-
node.setAnnotations(newAnnotations)
|
|
786
|
+
node.setValue(newValue);
|
|
787
|
+
node.setTypeAnnotation(newTypeAnnotation);
|
|
788
|
+
node.setAnnotations(newAnnotations);
|
|
891
789
|
}
|
|
892
|
-
return node
|
|
790
|
+
return node;
|
|
893
791
|
}
|
|
894
792
|
|
|
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)
|
|
793
|
+
function visitProperty(node: Property, visitor: Visitor): Property {
|
|
794
|
+
global.updateTracker.push();
|
|
795
|
+
const newKey = nodeVisitor(node.key, visitor);
|
|
796
|
+
const newValue = nodeVisitor(node.value, visitor);
|
|
899
797
|
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
|
|
798
|
+
const result = factory.createProperty(node.kind, newKey, newValue, node.isMethod, node.isComputed);
|
|
799
|
+
result.onUpdate(node);
|
|
800
|
+
return result;
|
|
801
|
+
}
|
|
802
|
+
return node;
|
|
911
803
|
}
|
|
912
804
|
|
|
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)
|
|
805
|
+
function visitBinaryExpression(node: BinaryExpression, visitor: Visitor): BinaryExpression {
|
|
806
|
+
global.updateTracker.push();
|
|
807
|
+
const newLeft = nodeVisitor(node.left, visitor);
|
|
808
|
+
const newRight = nodeVisitor(node.right, visitor);
|
|
917
809
|
if (global.updateTracker.check()) {
|
|
918
|
-
node.setLeft(newLeft)
|
|
919
|
-
node.setRight(newRight)
|
|
810
|
+
node.setLeft(newLeft);
|
|
811
|
+
node.setRight(newRight);
|
|
920
812
|
}
|
|
921
|
-
return node
|
|
813
|
+
return node;
|
|
922
814
|
}
|
|
923
815
|
|
|
924
|
-
function visitETSNewClassInstanceExpression(
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
816
|
+
function visitETSNewClassInstanceExpression(
|
|
817
|
+
node: ETSNewClassInstanceExpression,
|
|
818
|
+
visitor: Visitor
|
|
819
|
+
): ETSNewClassInstanceExpression {
|
|
820
|
+
global.updateTracker.push();
|
|
821
|
+
const oldTypeRef = node.typeRef;
|
|
822
|
+
const newTypeRef = nodeVisitor(oldTypeRef, visitor);
|
|
823
|
+
const newArguments: readonly Expression[] = nodesVisitor(node.arguments, visitor);
|
|
929
824
|
if (global.updateTracker.check()) {
|
|
930
825
|
if (!isSameNativeObject(newTypeRef, oldTypeRef)) {
|
|
931
|
-
const result = factory.createETSNewClassInstanceExpression(
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
)
|
|
935
|
-
result.onUpdate(node)
|
|
936
|
-
return result
|
|
826
|
+
const result = factory.createETSNewClassInstanceExpression(newTypeRef, newArguments);
|
|
827
|
+
result.onUpdate(node);
|
|
828
|
+
return result;
|
|
937
829
|
}
|
|
938
|
-
node.setArguments(newArguments)
|
|
939
|
-
newArguments.forEach(it => it.parent = node)
|
|
830
|
+
node.setArguments(newArguments);
|
|
831
|
+
newArguments.forEach((it) => (it.parent = node));
|
|
940
832
|
}
|
|
941
|
-
return node
|
|
833
|
+
return node;
|
|
942
834
|
}
|
|
943
835
|
|
|
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)
|
|
836
|
+
function visitWhileStatement(node: WhileStatement, visitor: Visitor): WhileStatement {
|
|
837
|
+
global.updateTracker.push();
|
|
838
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
839
|
+
const oldBody = node.body;
|
|
840
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
949
841
|
if (global.updateTracker.check()) {
|
|
950
842
|
if (!isSameNativeObject(newBody, oldBody)) {
|
|
951
|
-
const result = factory.createWhileStatement(
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
)
|
|
955
|
-
result.onUpdate(node)
|
|
956
|
-
return result
|
|
843
|
+
const result = factory.createWhileStatement(newTest, newBody);
|
|
844
|
+
result.onUpdate(node);
|
|
845
|
+
return result;
|
|
957
846
|
}
|
|
958
|
-
node.setTest(newTest)
|
|
847
|
+
node.setTest(newTest);
|
|
959
848
|
}
|
|
960
|
-
return node
|
|
849
|
+
return node;
|
|
961
850
|
}
|
|
962
851
|
|
|
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)
|
|
852
|
+
function visitDoWhileStatement(node: DoWhileStatement, visitor: Visitor): DoWhileStatement {
|
|
853
|
+
global.updateTracker.push();
|
|
854
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
855
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
967
856
|
if (global.updateTracker.check()) {
|
|
968
|
-
const result = factory.createDoWhileStatement(
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
)
|
|
972
|
-
result.onUpdate(node)
|
|
973
|
-
return result
|
|
857
|
+
const result = factory.createDoWhileStatement(newBody, newTest);
|
|
858
|
+
result.onUpdate(node);
|
|
859
|
+
return result;
|
|
974
860
|
}
|
|
975
|
-
return node
|
|
861
|
+
return node;
|
|
976
862
|
}
|
|
977
863
|
|
|
978
|
-
function visitForUpdateStatement(node: ForUpdateStatement, visitor: Visitor) {
|
|
979
|
-
global.updateTracker.push()
|
|
980
|
-
const newInit = nodeVisitor(node.init, visitor)
|
|
981
|
-
const newTest = nodeVisitor(node.test, visitor)
|
|
982
|
-
const newUpdate = nodeVisitor(node.update, visitor)
|
|
983
|
-
const newBody = nodeVisitor(node.body, visitor)
|
|
864
|
+
function visitForUpdateStatement(node: ForUpdateStatement, visitor: Visitor): ForUpdateStatement {
|
|
865
|
+
global.updateTracker.push();
|
|
866
|
+
const newInit = nodeVisitor(node.init, visitor);
|
|
867
|
+
const newTest = nodeVisitor(node.test, visitor);
|
|
868
|
+
const newUpdate = nodeVisitor(node.update, visitor);
|
|
869
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
984
870
|
if (global.updateTracker.check()) {
|
|
985
|
-
const result = factory.createForUpdateStatement(
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
newUpdate,
|
|
989
|
-
newBody,
|
|
990
|
-
)
|
|
991
|
-
result.onUpdate(node)
|
|
992
|
-
return result
|
|
871
|
+
const result = factory.createForUpdateStatement(newInit, newTest, newUpdate, newBody);
|
|
872
|
+
result.onUpdate(node);
|
|
873
|
+
return result;
|
|
993
874
|
}
|
|
994
|
-
return node
|
|
875
|
+
return node;
|
|
995
876
|
}
|
|
996
877
|
|
|
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)
|
|
878
|
+
function visitForInStatement(node: ForInStatement, visitor: Visitor): ForInStatement {
|
|
879
|
+
global.updateTracker.push();
|
|
880
|
+
const newLeft = nodeVisitor(node.left, visitor);
|
|
881
|
+
const newRight = nodeVisitor(node.right, visitor);
|
|
882
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
1002
883
|
if (global.updateTracker.check()) {
|
|
1003
|
-
const result = factory.createForInStatement(
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
newBody,
|
|
1007
|
-
)
|
|
1008
|
-
result.onUpdate(node)
|
|
1009
|
-
return result
|
|
884
|
+
const result = factory.createForInStatement(newLeft, newRight, newBody);
|
|
885
|
+
result.onUpdate(node);
|
|
886
|
+
return result;
|
|
1010
887
|
}
|
|
1011
|
-
return node
|
|
888
|
+
return node;
|
|
1012
889
|
}
|
|
1013
890
|
|
|
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)
|
|
891
|
+
function visitForOfStatement(node: ForOfStatement, visitor: Visitor): ForOfStatement {
|
|
892
|
+
global.updateTracker.push();
|
|
893
|
+
const newLeft = nodeVisitor(node.left, visitor);
|
|
894
|
+
const newRight = nodeVisitor(node.right, visitor);
|
|
895
|
+
const newBody = nodeVisitor(node.body, visitor);
|
|
1019
896
|
if (global.updateTracker.check()) {
|
|
1020
|
-
const result = factory.createForOfStatement(
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
newBody,
|
|
1024
|
-
node.isAwait,
|
|
1025
|
-
)
|
|
1026
|
-
result.onUpdate(node)
|
|
1027
|
-
return result
|
|
897
|
+
const result = factory.createForOfStatement(newLeft, newRight, newBody, node.isAwait);
|
|
898
|
+
result.onUpdate(node);
|
|
899
|
+
return result;
|
|
1028
900
|
}
|
|
1029
|
-
return node
|
|
901
|
+
return node;
|
|
1030
902
|
}
|
|
1031
903
|
|
|
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)
|
|
904
|
+
function visitETSImportDeclaration(node: ETSImportDeclaration, visitor: Visitor): ETSImportDeclaration {
|
|
905
|
+
global.updateTracker.push();
|
|
906
|
+
const newSource = nodeVisitor(node.source, visitor);
|
|
907
|
+
const newSpecifiers = nodesVisitor(node.specifiers, visitor);
|
|
1036
908
|
if (global.updateTracker.check()) {
|
|
1037
909
|
const result = factory.createETSImportDeclaration(
|
|
1038
910
|
newSource,
|
|
1039
911
|
newSpecifiers,
|
|
1040
|
-
Es2pandaImportKinds.IMPORT_KINDS_ALL
|
|
1041
|
-
)
|
|
1042
|
-
result.onUpdate(node)
|
|
1043
|
-
return result
|
|
912
|
+
Es2pandaImportKinds.IMPORT_KINDS_ALL
|
|
913
|
+
);
|
|
914
|
+
result.onUpdate(node);
|
|
915
|
+
return result;
|
|
1044
916
|
}
|
|
1045
|
-
return node
|
|
917
|
+
return node;
|
|
1046
918
|
}
|
|
1047
919
|
|
|
1048
|
-
function visitTSNonNullExpression(node: TSNonNullExpression, visitor: Visitor) {
|
|
1049
|
-
global.updateTracker.push()
|
|
1050
|
-
const newExpr = nodeVisitor(node.expr, visitor)
|
|
920
|
+
function visitTSNonNullExpression(node: TSNonNullExpression, visitor: Visitor): TSNonNullExpression {
|
|
921
|
+
global.updateTracker.push();
|
|
922
|
+
const newExpr = nodeVisitor(node.expr, visitor);
|
|
1051
923
|
if (global.updateTracker.check()) {
|
|
1052
|
-
node.setExpr(newExpr)
|
|
1053
|
-
if (newExpr) newExpr.parent = node
|
|
924
|
+
node.setExpr(newExpr);
|
|
925
|
+
if (newExpr) newExpr.parent = node;
|
|
1054
926
|
}
|
|
1055
|
-
return node
|
|
927
|
+
return node;
|
|
1056
928
|
}
|
|
1057
929
|
|
|
1058
|
-
function visitUpdateExpression(node: UpdateExpression, visitor: Visitor) {
|
|
1059
|
-
global.updateTracker.push()
|
|
1060
|
-
const newArgument = nodeVisitor(node.argument, visitor)
|
|
930
|
+
function visitUpdateExpression(node: UpdateExpression, visitor: Visitor): UpdateExpression {
|
|
931
|
+
global.updateTracker.push();
|
|
932
|
+
const newArgument = nodeVisitor(node.argument, visitor);
|
|
1061
933
|
if (global.updateTracker.check()) {
|
|
1062
|
-
const result = factory.createUpdateExpression(
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
result.onUpdate(node)
|
|
1068
|
-
return result
|
|
1069
|
-
}
|
|
1070
|
-
return node
|
|
934
|
+
const result = factory.createUpdateExpression(newArgument, node.operatorType, node.isPrefix);
|
|
935
|
+
result.onUpdate(node);
|
|
936
|
+
return result;
|
|
937
|
+
}
|
|
938
|
+
return node;
|
|
1071
939
|
}
|
|
1072
940
|
|
|
1073
|
-
function visitTSTypeParameterInstantiation(
|
|
1074
|
-
|
|
1075
|
-
|
|
941
|
+
function visitTSTypeParameterInstantiation(
|
|
942
|
+
node: TSTypeParameterInstantiation,
|
|
943
|
+
visitor: Visitor
|
|
944
|
+
): TSTypeParameterInstantiation {
|
|
945
|
+
global.updateTracker.push();
|
|
946
|
+
const newParams: readonly TypeNode[] = nodesVisitor(node.params, visitor);
|
|
1076
947
|
if (global.updateTracker.check()) {
|
|
1077
|
-
const result = factory.createTSTypeParameterInstantiation(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
result.onUpdate(node)
|
|
1081
|
-
return result
|
|
948
|
+
const result = factory.createTSTypeParameterInstantiation(newParams);
|
|
949
|
+
result.onUpdate(node);
|
|
950
|
+
return result;
|
|
1082
951
|
}
|
|
1083
|
-
return node
|
|
952
|
+
return node;
|
|
1084
953
|
}
|
|
1085
954
|
|
|
1086
|
-
function visitTSTypeParameterDeclaration(
|
|
1087
|
-
|
|
1088
|
-
|
|
955
|
+
function visitTSTypeParameterDeclaration(
|
|
956
|
+
node: TSTypeParameterDeclaration,
|
|
957
|
+
visitor: Visitor
|
|
958
|
+
): TSTypeParameterDeclaration {
|
|
959
|
+
global.updateTracker.push();
|
|
960
|
+
const newParams: readonly TSTypeParameter[] = nodesVisitor(node.params, visitor);
|
|
1089
961
|
if (global.updateTracker.check()) {
|
|
1090
|
-
const result = factory.createTSTypeParameterDeclaration(
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
return result
|
|
1096
|
-
}
|
|
1097
|
-
return node
|
|
962
|
+
const result = factory.createTSTypeParameterDeclaration(newParams, node.requiredParams);
|
|
963
|
+
result.onUpdate(node);
|
|
964
|
+
return result;
|
|
965
|
+
}
|
|
966
|
+
return node;
|
|
1098
967
|
}
|
|
1099
968
|
|
|
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)
|
|
969
|
+
function visitClassStaticBlock(node: ClassStaticBlock, visitor: Visitor): ClassStaticBlock {
|
|
970
|
+
global.updateTracker.push();
|
|
971
|
+
const newId = nodeVisitor(node.id, visitor);
|
|
972
|
+
const newFunction = nodeVisitor(node.function, visitor);
|
|
1104
973
|
if (global.updateTracker.check()) {
|
|
1105
|
-
const result = ClassStaticBlock.createClassStaticBlock(
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
newFunction,
|
|
1109
|
-
)
|
|
1110
|
-
)
|
|
1111
|
-
result.onUpdate(node)
|
|
1112
|
-
return result
|
|
974
|
+
const result = ClassStaticBlock.createClassStaticBlock(factory.createFunctionExpression(newId, newFunction));
|
|
975
|
+
result.onUpdate(node);
|
|
976
|
+
return result;
|
|
1113
977
|
}
|
|
1114
|
-
return node
|
|
978
|
+
return node;
|
|
1115
979
|
}
|
|
1116
980
|
|
|
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.
|
|
981
|
+
const visitsTable: (((node: any, visitor: Visitor) => any) | undefined)[] = [];
|
|
982
|
+
|
|
983
|
+
export function initVisitsTable(): void {
|
|
984
|
+
const length = Object.values(Es2pandaAstNodeType).length / 2;
|
|
985
|
+
visitsTable.push(...new Array(length));
|
|
986
|
+
|
|
987
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER] = visitIdentifier;
|
|
988
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_MEMBER_EXPRESSION] = visitMemberExpression;
|
|
989
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE] = visitETSTypeReference;
|
|
990
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE_PART] = visitETSTypeReferencePart;
|
|
991
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE] = visitETSModule;
|
|
992
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION] = visitCallExpression;
|
|
993
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION] = visitFunctionDeclaration;
|
|
994
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT] = visitBlockStatement;
|
|
995
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_EXPRESSION] = visitBlockExpression;
|
|
996
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CHAIN_EXPRESSION] = visitChainExpression;
|
|
997
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT] = visitExpressionStatement;
|
|
998
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION] = visitETSStructDeclaration;
|
|
999
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION] = visitClassDeclaration;
|
|
1000
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DEFINITION] = visitClassDefinition;
|
|
1001
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION] = visitMethodDefinition;
|
|
1002
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SCRIPT_FUNCTION] = visitScriptFunction;
|
|
1003
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION] = visitETSParameterExpression;
|
|
1004
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SWITCH_STATEMENT] = visitSwitchStatement;
|
|
1005
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_SWITCH_CASE_STATEMENT] = visitSwitchCaseStatement;
|
|
1006
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_INTERFACE_DECLARATION] = visitTSInterfaceDeclaration;
|
|
1007
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_INTERFACE_BODY] = visitTSInterfaceBody;
|
|
1008
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT] = visitIfStatement;
|
|
1009
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CONDITIONAL_EXPRESSION] = visitConditionalExpression;
|
|
1010
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION] = visitVariableDeclararion;
|
|
1011
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR] = visitVariableDeclarator;
|
|
1012
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION] = visitArrowFunctionExpression;
|
|
1013
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_RETURN_STATEMENT] = visitReturnStatement;
|
|
1014
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_AS_EXPRESSION] = visitTSAsExpression;
|
|
1015
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TEMPLATE_LITERAL] = visitTemplateLiteral;
|
|
1016
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_ALIAS_DECLARATION] = visitTSTypeAliasDeclaration;
|
|
1017
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TRY_STATEMENT] = visitTryStatement;
|
|
1018
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_OBJECT_EXPRESSION] = visitObjectExpression;
|
|
1019
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_EXPRESSION] = visitFunctionExpression;
|
|
1020
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ARRAY_EXPRESSION] = visitArrayExpression;
|
|
1021
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ASSIGNMENT_EXPRESSION] = visitAssignmentExpression;
|
|
1022
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TUPLE] = visitETSTyple;
|
|
1023
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_UNION_TYPE] = visitETSUnionType;
|
|
1024
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_FUNCTION_TYPE] = visitETSFunctionType;
|
|
1025
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_PROPERTY] = visitClassProperty;
|
|
1026
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_PROPERTY] = visitProperty;
|
|
1027
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_BINARY_EXPRESSION] = visitBinaryExpression;
|
|
1028
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_NEW_CLASS_INSTANCE_EXPRESSION] =
|
|
1029
|
+
visitETSNewClassInstanceExpression;
|
|
1030
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_WHILE_STATEMENT] = visitWhileStatement;
|
|
1031
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_DO_WHILE_STATEMENT] = visitDoWhileStatement;
|
|
1032
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_UPDATE_STATEMENT] = visitForUpdateStatement;
|
|
1033
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_IN_STATEMENT] = visitForInStatement;
|
|
1034
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_FOR_OF_STATEMENT] = visitForOfStatement;
|
|
1035
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION] = visitETSImportDeclaration;
|
|
1036
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_NON_NULL_EXPRESSION] = visitTSNonNullExpression;
|
|
1037
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_UPDATE_EXPRESSION] = visitUpdateExpression;
|
|
1038
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_DECLARATION] = visitTSTypeParameterDeclaration;
|
|
1039
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_INSTANTIATION] = visitTSTypeParameterInstantiation;
|
|
1040
|
+
visitsTable[Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_STATIC_BLOCK] = visitClassStaticBlock;
|
|
1176
1041
|
}
|
|
1177
1042
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
)
|
|
1182
|
-
|
|
1183
|
-
const visit = visitsTable[node.astNodeType]
|
|
1043
|
+
initVisitsTable();
|
|
1044
|
+
|
|
1045
|
+
export function visitEachChild(node: AstNode, visitor: Visitor): AstNode {
|
|
1046
|
+
global.profiler.nodeVisited();
|
|
1047
|
+
const visit = visitsTable[node.astNodeType];
|
|
1184
1048
|
if (visit) {
|
|
1185
|
-
return visit(node, visitor)
|
|
1049
|
+
return visit(node, visitor);
|
|
1186
1050
|
}
|
|
1187
|
-
return node
|
|
1051
|
+
return node;
|
|
1188
1052
|
}
|