@idlizer/arktscgen 2.1.9-arktscgen-5 → 2.1.9-arktscgen-8
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 +151 -0
- package/build/libarkts-copy/native/meson.build +11 -12
- package/build/libarkts-copy/native/meson_options.txt +1 -1
- package/build/libarkts-copy/native/mingw.cross +14 -0
- package/build/libarkts-copy/native/src/bridges.cc +77 -1
- package/build/libarkts-copy/native/src/common.cc +5 -5
- package/build/libarkts-copy/native/src/generated/bridges.cc +312 -33
- package/build/libarkts-copy/package.json +24 -20
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +19 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +18 -12
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +15 -26
- package/build/libarkts-copy/src/arkts-api/index.ts +2 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +0 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +7 -8
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +1 -22
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +44 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +1 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +3 -7
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +10 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +11 -7
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +3 -6
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +13 -12
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +35 -4
- package/build/libarkts-copy/src/arkts-api/plugins.ts +12 -3
- package/build/libarkts-copy/src/arkts-api/static/global.ts +2 -2
- package/build/libarkts-copy/src/{wrapper-compat/arkts-api → arkts-api}/static/globalUtils.ts +4 -4
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +0 -8
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +57 -0
- package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +6 -8
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +153 -29
- package/build/libarkts-copy/src/arkts-api/visitor.ts +16 -10
- package/build/libarkts-copy/src/checkSdk.ts +15 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +343 -321
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +93 -12
- package/build/libarkts-copy/src/generated/factory.ts +38 -25
- package/build/libarkts-copy/src/generated/index.ts +2 -0
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +15 -3
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +10 -2
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +11 -2
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +20 -4
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +10 -2
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +12 -9
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +77 -0
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +3 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +29 -5
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +14 -2
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +103 -0
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/Program.ts +8 -0
- package/build/libarkts-copy/src/generated/peers/Property.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +26 -9
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +12 -3
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +29 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +11 -3
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +1 -1
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +1 -1
- package/build/libarkts-copy/src/index.ts +1 -4
- package/build/libarkts-copy/src/plugin-utils.ts +37 -37
- package/build/libarkts-copy/src/reexport-for-generated.ts +7 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +14 -14
- package/build/libarkts-copy/src/ts-api/index.ts +1 -1
- package/build/libarkts-copy/src/ts-api/types.ts +56 -56
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +6 -6
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +3 -3
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +4 -4
- package/build/libarkts-copy/src/utils.ts +13 -159
- package/build/libarkts-copy/src/wrapper-compat/README.md +4 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +3 -4
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +3 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +2 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +10 -11
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +1 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +4 -4
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +6 -6
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +10 -10
- package/lib/index.js +7194 -7097
- package/package.json +2 -2
- package/templates/Es2pandaNativeModule.ts +1 -1
- package/templates/bridges.cc +5 -0
- package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +0 -131
- package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +0 -193
- package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +0 -89
- package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +0 -44
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +0 -29
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrowFunctionExpression.ts +0 -49
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +0 -54
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +0 -68
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +0 -54
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +0 -45
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +0 -53
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +0 -60
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +0 -38
|
@@ -19,7 +19,7 @@ import * as arkts from "../arkts-api"
|
|
|
19
19
|
import { throwError } from "../utils"
|
|
20
20
|
import {
|
|
21
21
|
passModifiers,
|
|
22
|
-
|
|
22
|
+
emptyImplementation,
|
|
23
23
|
unpackModifiers,
|
|
24
24
|
unpackNode,
|
|
25
25
|
unpackNodeArray,
|
|
@@ -27,13 +27,13 @@ import {
|
|
|
27
27
|
} from "./utilities/private"
|
|
28
28
|
import { SyntaxKind } from "./static/enums"
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// Improve: write implementation
|
|
31
31
|
export interface TransformationContext {}
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// Improve: write implementation
|
|
34
34
|
export interface Program {}
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// Improve: remove U type param
|
|
37
37
|
export type NodeArray<T extends Node<U>, U extends arkts.AstNode | undefined = arkts.AstNode | undefined> = ts.NodeArray<T>
|
|
38
38
|
|
|
39
39
|
export abstract class Node<T extends arkts.AstNode | undefined = arkts.AstNode | undefined> implements ts.Node {
|
|
@@ -43,7 +43,7 @@ export abstract class Node<T extends arkts.AstNode | undefined = arkts.AstNode |
|
|
|
43
43
|
|
|
44
44
|
readonly node: T
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Improve: remove any
|
|
47
47
|
get parent(): any {
|
|
48
48
|
if (this.node === undefined) {
|
|
49
49
|
throwError('trying to get parent of undefined _node')
|
|
@@ -74,7 +74,7 @@ export abstract class Node<T extends arkts.AstNode | undefined = arkts.AstNode |
|
|
|
74
74
|
|
|
75
75
|
abstract kind: SyntaxKind
|
|
76
76
|
|
|
77
|
-
//
|
|
77
|
+
// Improve:
|
|
78
78
|
forEachChild<T>(cbNode: (node: ts.Node) => T | undefined, cbNodeArray?: ((nodes: ts.NodeArray<ts.Node>) => T | undefined) | undefined): T | undefined { throw new Error("Method not implemented.") }
|
|
79
79
|
getSourceFile(): ts.SourceFile { throw new Error("Method not implemented.") }
|
|
80
80
|
getChildCount(sourceFile?: ts.SourceFile | undefined): number { throw new Error("Method not implemented.") }
|
|
@@ -92,13 +92,13 @@ export abstract class Node<T extends arkts.AstNode | undefined = arkts.AstNode |
|
|
|
92
92
|
getFirstToken(sourceFile?: ts.SourceFile | undefined): ts.Node | undefined { throw new Error("Method not implemented.") }
|
|
93
93
|
getLastToken(sourceFile?: ts.SourceFile | undefined): ts.Node | undefined { throw new Error("Method not implemented.") }
|
|
94
94
|
|
|
95
|
-
get symbol(): ts.Symbol { return
|
|
96
|
-
get flags(): ts.NodeFlags { return
|
|
97
|
-
get pos(): number { return
|
|
98
|
-
get end(): number { return
|
|
95
|
+
get symbol(): ts.Symbol { return emptyImplementation() }
|
|
96
|
+
get flags(): ts.NodeFlags { return emptyImplementation() }
|
|
97
|
+
get pos(): number { return emptyImplementation() }
|
|
98
|
+
get end(): number { return emptyImplementation() }
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
//
|
|
101
|
+
// Improve: add all tokens
|
|
102
102
|
export type BinaryOperator =
|
|
103
103
|
| ts.SyntaxKind.PlusToken
|
|
104
104
|
| ts.SyntaxKind.MinusToken
|
|
@@ -107,7 +107,7 @@ export type BinaryOperator =
|
|
|
107
107
|
|
|
108
108
|
export type BinaryOperatorToken = Token<BinaryOperator>;
|
|
109
109
|
|
|
110
|
-
//
|
|
110
|
+
// Improve: rethink maybe (temporary solution)
|
|
111
111
|
export class Token<TKind extends ts.TokenSyntaxKind> extends Node<undefined> {
|
|
112
112
|
constructor(kind: TKind) {
|
|
113
113
|
super(undefined)
|
|
@@ -149,7 +149,7 @@ export class Modifier extends Node<undefined> {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export abstract class Expression extends Node<arkts.AstNode> implements ts.Expression {
|
|
152
|
-
//
|
|
152
|
+
// Improve: support minimal interface
|
|
153
153
|
_expressionBrand: any
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -212,8 +212,8 @@ export class Identifier extends Node<arkts.Identifier> implements ts.Identifier,
|
|
|
212
212
|
readonly text: string
|
|
213
213
|
readonly kind: ts.SyntaxKind.Identifier = ts.SyntaxKind.Identifier
|
|
214
214
|
|
|
215
|
-
//
|
|
216
|
-
get escapedText(): ts.__String { return
|
|
215
|
+
// Improve:
|
|
216
|
+
get escapedText(): ts.__String { return emptyImplementation() }
|
|
217
217
|
|
|
218
218
|
// brands
|
|
219
219
|
_primaryExpressionBrand: any
|
|
@@ -237,8 +237,8 @@ export class PrivateIdentifier extends Node<arkts.Identifier> implements ts.Priv
|
|
|
237
237
|
readonly text: string
|
|
238
238
|
readonly kind: ts.SyntaxKind.PrivateIdentifier = ts.SyntaxKind.PrivateIdentifier
|
|
239
239
|
|
|
240
|
-
//
|
|
241
|
-
get escapedText(): ts.__String { return
|
|
240
|
+
// Improve:
|
|
241
|
+
get escapedText(): ts.__String { return emptyImplementation() }
|
|
242
242
|
|
|
243
243
|
// brands
|
|
244
244
|
_primaryExpressionBrand: any
|
|
@@ -278,23 +278,23 @@ export class SourceFile extends Node<arkts.EtsScript> implements ts.SourceFile {
|
|
|
278
278
|
readonly statements: NodeArray<Statement>
|
|
279
279
|
readonly kind: ts.SyntaxKind.SourceFile = ts.SyntaxKind.SourceFile
|
|
280
280
|
|
|
281
|
-
//
|
|
281
|
+
// Improve:
|
|
282
282
|
getLineAndCharacterOfPosition(pos: number): ts.LineAndCharacter { throw new Error("Method not implemented.") }
|
|
283
283
|
getLineEndOfPosition(pos: number): number { throw new Error("Method not implemented.") }
|
|
284
284
|
getLineStarts(): readonly number[] { throw new Error("Method not implemented.") }
|
|
285
285
|
getPositionOfLineAndCharacter(line: number, character: number): number { throw new Error("Method not implemented.") }
|
|
286
286
|
update(newText: string, textChangeRange: ts.TextChangeRange): ts.SourceFile { throw new Error("Method not implemented.") }
|
|
287
|
-
get endOfFileToken(): ts.Token<ts.SyntaxKind.EndOfFileToken> { return
|
|
288
|
-
get fileName(): string { return
|
|
289
|
-
get text() { return
|
|
290
|
-
get amdDependencies(): readonly ts.AmdDependency[] { return
|
|
291
|
-
get referencedFiles(): readonly ts.FileReference[] { return
|
|
292
|
-
get typeReferenceDirectives(): readonly ts.FileReference[] { return
|
|
293
|
-
get libReferenceDirectives(): readonly ts.FileReference[] { return
|
|
294
|
-
get languageVariant(): ts.LanguageVariant { return
|
|
295
|
-
get isDeclarationFile(): boolean { return
|
|
296
|
-
get hasNoDefaultLib(): boolean { return
|
|
297
|
-
get languageVersion(): ts.ScriptTarget { return
|
|
287
|
+
get endOfFileToken(): ts.Token<ts.SyntaxKind.EndOfFileToken> { return emptyImplementation() }
|
|
288
|
+
get fileName(): string { return emptyImplementation() }
|
|
289
|
+
get text() { return emptyImplementation() }
|
|
290
|
+
get amdDependencies(): readonly ts.AmdDependency[] { return emptyImplementation() }
|
|
291
|
+
get referencedFiles(): readonly ts.FileReference[] { return emptyImplementation() }
|
|
292
|
+
get typeReferenceDirectives(): readonly ts.FileReference[] { return emptyImplementation() }
|
|
293
|
+
get libReferenceDirectives(): readonly ts.FileReference[] { return emptyImplementation() }
|
|
294
|
+
get languageVariant(): ts.LanguageVariant { return emptyImplementation() }
|
|
295
|
+
get isDeclarationFile(): boolean { return emptyImplementation() }
|
|
296
|
+
get hasNoDefaultLib(): boolean { return emptyImplementation() }
|
|
297
|
+
get languageVersion(): ts.ScriptTarget { return emptyImplementation() }
|
|
298
298
|
|
|
299
299
|
// brands
|
|
300
300
|
_declarationBrand: any
|
|
@@ -407,11 +407,11 @@ export abstract class ClassElement extends Node<arkts.AstNode> implements ts.Cla
|
|
|
407
407
|
|
|
408
408
|
export type MemberName = Identifier | PrivateIdentifier;
|
|
409
409
|
|
|
410
|
-
//
|
|
410
|
+
// Improve: support
|
|
411
411
|
// export type PropertyName = Identifier | StringLiteral | NumericLiteral | ts.ComputedPropertyName | PrivateIdentifier;
|
|
412
412
|
export type PropertyName = Identifier | StringLiteral | NumericLiteral | PrivateIdentifier;
|
|
413
413
|
|
|
414
|
-
//
|
|
414
|
+
// Improve: support
|
|
415
415
|
export type DeclarationName =
|
|
416
416
|
| PropertyName
|
|
417
417
|
// | JsxAttributeName
|
|
@@ -440,7 +440,7 @@ export interface FunctionLikeDeclarationBase extends SignatureDeclarationBase {
|
|
|
440
440
|
_functionLikeDeclarationBrand: any;
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
//
|
|
443
|
+
// Improve: support
|
|
444
444
|
// export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
|
|
445
445
|
export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
|
|
446
446
|
|
|
@@ -453,7 +453,7 @@ export class MethodSignature extends Node<arkts.AstNode> implements ts.MethodSig
|
|
|
453
453
|
// readonly parameters: NodeArray<ParameterDeclaration>
|
|
454
454
|
readonly kind: ts.SyntaxKind.MethodSignature = ts.SyntaxKind.MethodSignature
|
|
455
455
|
|
|
456
|
-
//
|
|
456
|
+
// Improve:
|
|
457
457
|
name: any
|
|
458
458
|
parameters: any
|
|
459
459
|
|
|
@@ -508,7 +508,7 @@ export class ConstructorDeclaration extends Node<arkts.MethodDefinition> impleme
|
|
|
508
508
|
_declarationBrand: any
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
//
|
|
511
|
+
// Improve: specify arkts.AstNode type
|
|
512
512
|
export class PropertySignature extends Node<arkts.AstNode> implements ts.TypeElement {
|
|
513
513
|
constructor(node: arkts.AstNode) {
|
|
514
514
|
super(node)
|
|
@@ -522,7 +522,7 @@ export class PropertySignature extends Node<arkts.AstNode> implements ts.TypeEle
|
|
|
522
522
|
_declarationBrand: any
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
-
//
|
|
525
|
+
// Improve: specify arkts.AstNode type
|
|
526
526
|
export class PropertyDeclaration extends Node<arkts.AstNode> implements ts.PropertyDeclaration, ClassElement {
|
|
527
527
|
constructor(node: arkts.AstNode) {
|
|
528
528
|
super(node)
|
|
@@ -530,7 +530,7 @@ export class PropertyDeclaration extends Node<arkts.AstNode> implements ts.Prope
|
|
|
530
530
|
|
|
531
531
|
readonly kind: ts.SyntaxKind.PropertyDeclaration = ts.SyntaxKind.PropertyDeclaration
|
|
532
532
|
|
|
533
|
-
//
|
|
533
|
+
// Improve:
|
|
534
534
|
name: any
|
|
535
535
|
|
|
536
536
|
// brands
|
|
@@ -538,7 +538,7 @@ export class PropertyDeclaration extends Node<arkts.AstNode> implements ts.Prope
|
|
|
538
538
|
_declarationBrand: any
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
//
|
|
541
|
+
// Improve: specify arkts.AstNode type
|
|
542
542
|
export class GetAccessorDeclaration extends Node<arkts.AstNode> implements ts.GetAccessorDeclaration, FunctionLikeDeclarationBase, ClassElement {
|
|
543
543
|
constructor(node: arkts.AstNode) {
|
|
544
544
|
super(node)
|
|
@@ -548,7 +548,7 @@ export class GetAccessorDeclaration extends Node<arkts.AstNode> implements ts.Ge
|
|
|
548
548
|
// readonly parameters: NodeArray<ParameterDeclaration>
|
|
549
549
|
readonly kind: ts.SyntaxKind.GetAccessor = ts.SyntaxKind.GetAccessor
|
|
550
550
|
|
|
551
|
-
//
|
|
551
|
+
// Improve:
|
|
552
552
|
name: any
|
|
553
553
|
parameters: any
|
|
554
554
|
|
|
@@ -560,7 +560,7 @@ export class GetAccessorDeclaration extends Node<arkts.AstNode> implements ts.Ge
|
|
|
560
560
|
_objectLiteralBrand: any
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
-
//
|
|
563
|
+
// Improve: specify arkts.AstNode type
|
|
564
564
|
export class SetAccessorDeclaration extends Node<arkts.AstNode> implements ts.SetAccessorDeclaration, FunctionLikeDeclarationBase, ClassElement {
|
|
565
565
|
constructor(node: arkts.AstNode) {
|
|
566
566
|
super(node)
|
|
@@ -570,7 +570,7 @@ export class SetAccessorDeclaration extends Node<arkts.AstNode> implements ts.Se
|
|
|
570
570
|
// readonly parameters: NodeArray<ParameterDeclaration>
|
|
571
571
|
readonly kind: ts.SyntaxKind.SetAccessor = ts.SyntaxKind.SetAccessor
|
|
572
572
|
|
|
573
|
-
//
|
|
573
|
+
// Improve:
|
|
574
574
|
name: any
|
|
575
575
|
parameters: any
|
|
576
576
|
|
|
@@ -589,7 +589,7 @@ export class ParameterDeclaration extends Node<arkts.ETSParameterExpression> imp
|
|
|
589
589
|
|
|
590
590
|
readonly kind: ts.SyntaxKind.Parameter = ts.SyntaxKind.Parameter
|
|
591
591
|
|
|
592
|
-
//
|
|
592
|
+
// Improve:
|
|
593
593
|
name: any
|
|
594
594
|
|
|
595
595
|
// brands
|
|
@@ -671,7 +671,7 @@ export class TypeReferenceNode extends Node<arkts.AstNode> implements ts.TypeRef
|
|
|
671
671
|
|
|
672
672
|
readonly kind: ts.SyntaxKind.TypeReference = ts.SyntaxKind.TypeReference
|
|
673
673
|
|
|
674
|
-
//
|
|
674
|
+
// Improve:
|
|
675
675
|
typeName: any
|
|
676
676
|
|
|
677
677
|
// brands
|
|
@@ -686,7 +686,7 @@ export class FunctionTypeNode extends Node<arkts.AstNode> implements ts.Function
|
|
|
686
686
|
readonly name?: DeclarationName
|
|
687
687
|
readonly kind: ts.SyntaxKind.FunctionType = ts.SyntaxKind.FunctionType
|
|
688
688
|
|
|
689
|
-
//
|
|
689
|
+
// Improve: support minimal interface
|
|
690
690
|
parameters: any
|
|
691
691
|
type: any
|
|
692
692
|
|
|
@@ -728,7 +728,7 @@ export class IfStatement extends Node<arkts.IfStatement> implements ts.IfStateme
|
|
|
728
728
|
|
|
729
729
|
readonly kind: ts.SyntaxKind.IfStatement = ts.SyntaxKind.IfStatement
|
|
730
730
|
|
|
731
|
-
//
|
|
731
|
+
// Improve:
|
|
732
732
|
thenStatement: any
|
|
733
733
|
expression: any
|
|
734
734
|
|
|
@@ -743,7 +743,7 @@ export class BinaryExpression extends Node<arkts.BinaryExpression> implements ts
|
|
|
743
743
|
|
|
744
744
|
readonly kind: ts.SyntaxKind.BinaryExpression = ts.SyntaxKind.BinaryExpression
|
|
745
745
|
|
|
746
|
-
//
|
|
746
|
+
// Improve:
|
|
747
747
|
left: any
|
|
748
748
|
right: any
|
|
749
749
|
operatorToken: any
|
|
@@ -760,7 +760,7 @@ export class AssignmentExpression extends Node<arkts.AssignmentExpression> imple
|
|
|
760
760
|
|
|
761
761
|
readonly kind: ts.SyntaxKind.BinaryExpression = ts.SyntaxKind.BinaryExpression
|
|
762
762
|
|
|
763
|
-
//
|
|
763
|
+
// Improve:
|
|
764
764
|
right: any
|
|
765
765
|
left: any
|
|
766
766
|
operatorToken: any
|
|
@@ -785,7 +785,7 @@ export class ArrowFunction extends Node<arkts.ArrowFunctionExpression> implement
|
|
|
785
785
|
readonly parameters: NodeArray<ParameterDeclaration>
|
|
786
786
|
readonly kind: ts.SyntaxKind.ArrowFunction = ts.SyntaxKind.ArrowFunction
|
|
787
787
|
|
|
788
|
-
//
|
|
788
|
+
// Improve:
|
|
789
789
|
equalsGreaterThanToken: any
|
|
790
790
|
|
|
791
791
|
// brands
|
|
@@ -840,13 +840,13 @@ export class HeritageClause extends Node<arkts.SuperExpression> implements ts.He
|
|
|
840
840
|
// token: ts.SyntaxKind.ExtendsKeyword | ts.SyntaxKind.ImplementsKeyword
|
|
841
841
|
// types: ts.NodeArray<ts.ExpressionWithTypeArguments>
|
|
842
842
|
|
|
843
|
-
//
|
|
843
|
+
// Improve:
|
|
844
844
|
token: any
|
|
845
845
|
types: any
|
|
846
846
|
}
|
|
847
847
|
|
|
848
848
|
|
|
849
|
-
//
|
|
849
|
+
// Improve: there is no ParenthesizedExpression in ArkTS,
|
|
850
850
|
// so for temporary solution we're just gonna ignore this type of nodes
|
|
851
851
|
// and replace it with Expression underneath
|
|
852
852
|
export type ParenthesizedExpression = Expression
|
|
@@ -868,7 +868,7 @@ export type ParenthesizedExpression = Expression
|
|
|
868
868
|
// _expressionBrand: any
|
|
869
869
|
// }
|
|
870
870
|
|
|
871
|
-
//
|
|
871
|
+
// Improve:
|
|
872
872
|
export class ImportDeclaration extends Node<arkts.UnsupportedNode> implements ts.ImportDeclaration {
|
|
873
873
|
constructor(node: arkts.UnsupportedNode) {
|
|
874
874
|
super(node)
|
|
@@ -876,14 +876,14 @@ export class ImportDeclaration extends Node<arkts.UnsupportedNode> implements ts
|
|
|
876
876
|
|
|
877
877
|
readonly kind: ts.SyntaxKind.ImportDeclaration = ts.SyntaxKind.ImportDeclaration
|
|
878
878
|
|
|
879
|
-
//
|
|
879
|
+
// Improve:
|
|
880
880
|
moduleSpecifier: any
|
|
881
881
|
|
|
882
882
|
// brands
|
|
883
883
|
_statementBrand: any
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
-
//
|
|
886
|
+
// Improve:
|
|
887
887
|
export class ImportClause extends Node<arkts.UnsupportedNode> implements ts.ImportClause {
|
|
888
888
|
constructor(node: arkts.UnsupportedNode) {
|
|
889
889
|
super(node)
|
|
@@ -891,14 +891,14 @@ export class ImportClause extends Node<arkts.UnsupportedNode> implements ts.Impo
|
|
|
891
891
|
|
|
892
892
|
readonly kind: ts.SyntaxKind.ImportClause = ts.SyntaxKind.ImportClause
|
|
893
893
|
|
|
894
|
-
//
|
|
894
|
+
// Improve:
|
|
895
895
|
isTypeOnly: any
|
|
896
896
|
|
|
897
897
|
// brands
|
|
898
898
|
_declarationBrand: any
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
-
//
|
|
901
|
+
// Improve:
|
|
902
902
|
export class NamedImports extends Node<arkts.UnsupportedNode> implements ts.NamedImports {
|
|
903
903
|
constructor(node: arkts.UnsupportedNode) {
|
|
904
904
|
super(node)
|
|
@@ -906,7 +906,7 @@ export class NamedImports extends Node<arkts.UnsupportedNode> implements ts.Name
|
|
|
906
906
|
|
|
907
907
|
readonly kind: ts.SyntaxKind.NamedImports = ts.SyntaxKind.NamedImports
|
|
908
908
|
|
|
909
|
-
//
|
|
909
|
+
// Improve:
|
|
910
910
|
elements: any
|
|
911
911
|
}
|
|
912
912
|
|
|
@@ -919,7 +919,7 @@ export class ImportSpecifier extends Node<arkts.Identifier> implements ts.Import
|
|
|
919
919
|
readonly name: Identifier
|
|
920
920
|
readonly kind: ts.SyntaxKind.ImportSpecifier = ts.SyntaxKind.ImportSpecifier
|
|
921
921
|
|
|
922
|
-
//
|
|
922
|
+
// Improve:
|
|
923
923
|
isTypeOnly: any
|
|
924
924
|
|
|
925
925
|
// brands
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
Es2pandaVariableDeclarationKind,
|
|
33
33
|
} from "../../arkts-api"
|
|
34
34
|
|
|
35
|
-
export function
|
|
35
|
+
export function emptyImplementation(): any {
|
|
36
36
|
throwError("Not yet implemented")
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -96,7 +96,7 @@ export function classByEtsNode(node: arkts.AstNode) {
|
|
|
96
96
|
return types.get(node.type) ?? throwError(`UNSUPPORTED NODE (ts): ${Es2pandaAstNodeType[node.type]}`)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
//
|
|
99
|
+
// Improve: add checks for casts in functions below
|
|
100
100
|
|
|
101
101
|
export function unpackNode<U extends arkts.AstNode, T extends ts.Node<U> >(node: U): T
|
|
102
102
|
export function unpackNode<U extends arkts.AstNode | undefined, T extends ts.Node<U> >(node: U): T | undefined
|
|
@@ -149,7 +149,7 @@ export function passIdentifier(node: ts.Identifier | string | undefined, typeAnn
|
|
|
149
149
|
)
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
//
|
|
152
|
+
// Improve: support optional params
|
|
153
153
|
export function passTypeParams(params: readonly ts.TypeParameterDeclaration[] | undefined): arkts.TSTypeParameterDeclaration | undefined {
|
|
154
154
|
if (params === undefined) {
|
|
155
155
|
return undefined
|
|
@@ -165,12 +165,12 @@ export function unpackModifiers(modifiers: KInt | undefined): ts.NodeArray<ts.Mo
|
|
|
165
165
|
// [Es2pandaModifierFlags.MODIFIER_FLAGS_CONSTRUCTOR, SyntaxKind.ConstructorKeyword],
|
|
166
166
|
|
|
167
167
|
[Es2pandaModifierFlags.MODIFIER_FLAGS_ABSTRACT, SyntaxKind.AbstractKeyword],
|
|
168
|
-
//
|
|
168
|
+
// Improve: unsupported
|
|
169
169
|
// [Es2pandaModifierFlags. , SyntaxKind.AccessorKeyword],
|
|
170
170
|
[Es2pandaModifierFlags.MODIFIER_FLAGS_ASYNC, SyntaxKind.AsyncKeyword],
|
|
171
171
|
[Es2pandaModifierFlags.MODIFIER_FLAGS_CONST, SyntaxKind.ConstKeyword],
|
|
172
172
|
[Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE, SyntaxKind.DeclareKeyword],
|
|
173
|
-
//
|
|
173
|
+
// Improve: choose one
|
|
174
174
|
// [Es2pandaModifierFlags.MODIFIER_FLAGS_DEFAULT_EXPORT, SyntaxKind.DefaultClause],
|
|
175
175
|
// [Es2pandaModifierFlags.MODIFIER_FLAGS_DEFAULT_EXPORT, SyntaxKind.DefaultKeyword],
|
|
176
176
|
[Es2pandaModifierFlags.MODIFIER_FLAGS_EXPORT, SyntaxKind.ExportKeyword],
|
|
@@ -209,7 +209,7 @@ export function passModifiers(modifiers: ReadonlyArray<ts.Modifier | undefined |
|
|
|
209
209
|
// [SyntaxKind.ConstructorKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_CONSTRUCTOR],
|
|
210
210
|
|
|
211
211
|
[SyntaxKind.AbstractKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_ABSTRACT],
|
|
212
|
-
//
|
|
212
|
+
// Improve: unsupported
|
|
213
213
|
// [SyntaxKind.AccessorKeyword, Es2pandaModifierFlags.],
|
|
214
214
|
[SyntaxKind.AsyncKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_ASYNC],
|
|
215
215
|
[SyntaxKind.ConstKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_CONST],
|
|
@@ -21,7 +21,7 @@ import { unpackNonNullableNode } from "../../arkts-api"
|
|
|
21
21
|
|
|
22
22
|
export { proceedToState, startChecker } from "../../arkts-api"
|
|
23
23
|
|
|
24
|
-
//
|
|
24
|
+
// Improve: like in arkts utils
|
|
25
25
|
export function getDecl(node: ts.Node): ts.Node | undefined {
|
|
26
26
|
if (node.node === undefined) {
|
|
27
27
|
throwError('there is no arkts pair of ts node (unable to getDecl)')
|
|
@@ -42,10 +42,10 @@ export function getDecl(node: ts.Node): ts.Node | undefined {
|
|
|
42
42
|
return ts.unpackNode(unpackNonNullableNode(decl))
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// Improve: like in arkts utils
|
|
46
46
|
export function getOriginalNode(node: ts.Node): ts.Node {
|
|
47
47
|
if (node.node === undefined) {
|
|
48
|
-
//
|
|
48
|
+
// Improve: fix this
|
|
49
49
|
throwError('there is no arkts pair of ts node (unable to getOriginalNode)')
|
|
50
50
|
}
|
|
51
51
|
if (node.node.originalPeer === nullptr) {
|
|
@@ -21,7 +21,7 @@ import { SyntaxKind } from "../static/enums"
|
|
|
21
21
|
|
|
22
22
|
type Visitor = (node: ts.Node) => ts.Node
|
|
23
23
|
|
|
24
|
-
//
|
|
24
|
+
// Improve: rethink (remove as)
|
|
25
25
|
function nodeVisitor<T extends ts.Node | undefined>(node: T, visitor: Visitor): T {
|
|
26
26
|
if (node === undefined) {
|
|
27
27
|
return node
|
|
@@ -29,7 +29,7 @@ function nodeVisitor<T extends ts.Node | undefined>(node: T, visitor: Visitor):
|
|
|
29
29
|
return visitor(node) as T
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//
|
|
32
|
+
// Improve: rethink (remove as)
|
|
33
33
|
function nodesVisitor<T extends ts.Node, TIn extends ts.NodeArray<T> | undefined>(nodes: TIn, visitor: Visitor): T[] | TIn {
|
|
34
34
|
if (nodes === undefined) {
|
|
35
35
|
return nodes
|
|
@@ -39,7 +39,7 @@ function nodesVisitor<T extends ts.Node, TIn extends ts.NodeArray<T> | undefined
|
|
|
39
39
|
|
|
40
40
|
type VisitEachChildFunction<T extends ts.Node> = (node: T, visitor: Visitor) => T
|
|
41
41
|
|
|
42
|
-
//
|
|
42
|
+
// Improve: add more nodes
|
|
43
43
|
type HasChildren =
|
|
44
44
|
| ts.SourceFile
|
|
45
45
|
| ts.FunctionDeclaration
|
|
@@ -54,7 +54,7 @@ type HasChildren =
|
|
|
54
54
|
|
|
55
55
|
type VisitEachChildTable = { [TNode in HasChildren as TNode["kind"]]: VisitEachChildFunction<TNode> }
|
|
56
56
|
|
|
57
|
-
//
|
|
57
|
+
// Improve: add more nodes
|
|
58
58
|
const visitEachChildTable: VisitEachChildTable = {
|
|
59
59
|
[SyntaxKind.SourceFile]: function (node: ts.SourceFile, visitor: Visitor) {
|
|
60
60
|
return factory.updateSourceFile(
|