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