@idlizer/arktscgen 2.1.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.
Files changed (229) hide show
  1. package/build/libarkts-copy/generator/options.json5 +155 -0
  2. package/build/libarkts-copy/native/meson.build +62 -0
  3. package/build/libarkts-copy/native/meson_options.txt +24 -0
  4. package/build/libarkts-copy/native/src/bridges.cc +265 -0
  5. package/build/libarkts-copy/native/src/common.cc +231 -0
  6. package/build/libarkts-copy/native/src/common.h +39 -0
  7. package/build/libarkts-copy/native/src/generated/bridges.cc +11979 -0
  8. package/build/libarkts-copy/package.json +51 -0
  9. package/build/libarkts-copy/src/Es2pandaEnums.ts +183 -0
  10. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +123 -0
  11. package/build/libarkts-copy/src/InteropNativeModule.ts +50 -0
  12. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +31 -0
  13. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +147 -0
  14. package/build/libarkts-copy/src/arkts-api/index.ts +28 -0
  15. package/build/libarkts-copy/src/arkts-api/node-utilities/createCallExpression.ts +40 -0
  16. package/build/libarkts-copy/src/arkts-api/node-utilities/createNumberLiteral.ts +28 -0
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/createScriptFunction.ts +55 -0
  18. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +45 -0
  19. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +121 -0
  20. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +52 -0
  21. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +46 -0
  22. package/build/libarkts-copy/src/arkts-api/peers/Program.ts +55 -0
  23. package/build/libarkts-copy/src/arkts-api/static/global.ts +67 -0
  24. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +69 -0
  25. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +156 -0
  26. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +135 -0
  27. package/build/libarkts-copy/src/arkts-api/visitor.ts +297 -0
  28. package/build/libarkts-copy/src/es2panda.ts +277 -0
  29. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +1266 -0
  30. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +3745 -0
  31. package/build/libarkts-copy/src/generated/factory.ts +1299 -0
  32. package/build/libarkts-copy/src/generated/index.ts +191 -0
  33. package/build/libarkts-copy/src/generated/node-map.ts +182 -0
  34. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +39 -0
  35. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +49 -0
  36. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +40 -0
  37. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +110 -0
  38. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +74 -0
  39. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +98 -0
  40. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +70 -0
  41. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +57 -0
  42. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +95 -0
  43. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +42 -0
  44. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +53 -0
  45. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +53 -0
  46. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +95 -0
  47. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +64 -0
  48. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +63 -0
  49. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +53 -0
  50. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +65 -0
  51. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +97 -0
  52. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +64 -0
  53. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +53 -0
  54. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +50 -0
  55. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +58 -0
  56. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +233 -0
  57. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +80 -0
  58. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +54 -0
  59. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +70 -0
  60. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +58 -0
  61. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +74 -0
  62. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +65 -0
  63. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +50 -0
  64. package/build/libarkts-copy/src/generated/peers/Decorator.ts +54 -0
  65. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +52 -0
  66. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +58 -0
  67. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +54 -0
  68. package/build/libarkts-copy/src/generated/peers/ETSDynamicFunctionType.ts +40 -0
  69. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +84 -0
  70. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +68 -0
  71. package/build/libarkts-copy/src/generated/peers/ETSLaunchExpression.ts +57 -0
  72. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +71 -0
  73. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +62 -0
  74. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +69 -0
  75. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +60 -0
  76. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +50 -0
  77. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +51 -0
  78. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +126 -0
  79. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +54 -0
  80. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +51 -0
  81. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +51 -0
  82. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +73 -0
  83. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +58 -0
  84. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +68 -0
  85. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +50 -0
  86. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +53 -0
  87. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +55 -0
  88. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +50 -0
  89. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +58 -0
  90. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +56 -0
  91. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +73 -0
  92. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +57 -0
  93. package/build/libarkts-copy/src/generated/peers/Expression.ts +75 -0
  94. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +59 -0
  95. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +61 -0
  96. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +64 -0
  97. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +61 -0
  98. package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +40 -0
  99. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +69 -0
  100. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +64 -0
  101. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +62 -0
  102. package/build/libarkts-copy/src/generated/peers/Identifier.ts +154 -0
  103. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +65 -0
  104. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +61 -0
  105. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +54 -0
  106. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +53 -0
  107. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +54 -0
  108. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +49 -0
  109. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +57 -0
  110. package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +40 -0
  111. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +60 -0
  112. package/build/libarkts-copy/src/generated/peers/Literal.ts +40 -0
  113. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +40 -0
  114. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +48 -0
  115. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +95 -0
  116. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +54 -0
  117. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +105 -0
  118. package/build/libarkts-copy/src/generated/peers/NamedType.ts +76 -0
  119. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +56 -0
  120. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +50 -0
  121. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +47 -0
  122. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +90 -0
  123. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +50 -0
  124. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +50 -0
  125. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +57 -0
  126. package/build/libarkts-copy/src/generated/peers/Property.ts +82 -0
  127. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +57 -0
  128. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +62 -0
  129. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +201 -0
  130. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +53 -0
  131. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +79 -0
  132. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +82 -0
  133. package/build/libarkts-copy/src/generated/peers/Statement.ts +39 -0
  134. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +56 -0
  135. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +50 -0
  136. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +62 -0
  137. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +63 -0
  138. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +50 -0
  139. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +53 -0
  140. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +76 -0
  141. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +50 -0
  142. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +50 -0
  143. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +60 -0
  144. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +63 -0
  145. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +65 -0
  146. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +81 -0
  147. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +66 -0
  148. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +53 -0
  149. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +67 -0
  150. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +61 -0
  151. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +64 -0
  152. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +65 -0
  153. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +56 -0
  154. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +54 -0
  155. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +53 -0
  156. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +102 -0
  157. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +54 -0
  158. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +54 -0
  159. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +54 -0
  160. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +64 -0
  161. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +71 -0
  162. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +53 -0
  163. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +63 -0
  164. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +60 -0
  165. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +50 -0
  166. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +58 -0
  167. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +50 -0
  168. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +50 -0
  169. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +50 -0
  170. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +66 -0
  171. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +54 -0
  172. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +72 -0
  173. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +63 -0
  174. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +67 -0
  175. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +50 -0
  176. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +50 -0
  177. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +53 -0
  178. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +88 -0
  179. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +63 -0
  180. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +53 -0
  181. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +63 -0
  182. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +84 -0
  183. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +62 -0
  184. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +54 -0
  185. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +60 -0
  186. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +54 -0
  187. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +62 -0
  188. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +50 -0
  189. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +53 -0
  190. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +50 -0
  191. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +50 -0
  192. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +61 -0
  193. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +59 -0
  194. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +60 -0
  195. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +50 -0
  196. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +54 -0
  197. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +75 -0
  198. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +49 -0
  199. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +39 -0
  200. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +40 -0
  201. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +53 -0
  202. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +57 -0
  203. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +50 -0
  204. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +60 -0
  205. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +42 -0
  206. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +71 -0
  207. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +69 -0
  208. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +58 -0
  209. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +56 -0
  210. package/build/libarkts-copy/src/reexport-for-generated.ts +33 -0
  211. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +1375 -0
  212. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +110 -0
  213. package/build/libarkts-copy/src/ts-api/index.ts +35 -0
  214. package/build/libarkts-copy/src/ts-api/static/enums.ts +18 -0
  215. package/build/libarkts-copy/src/ts-api/types.ts +920 -0
  216. package/build/libarkts-copy/src/ts-api/utilities/private.ts +289 -0
  217. package/build/libarkts-copy/src/ts-api/utilities/public.ts +55 -0
  218. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +155 -0
  219. package/build/libarkts-copy/src/utils.ts +89 -0
  220. package/build/libarkts-copy/tsconfig.json +15 -0
  221. package/lib/index.js +11858 -0
  222. package/package.json +54 -0
  223. package/templates/Es2pandaEnums.ts +16 -0
  224. package/templates/Es2pandaNativeModule.ts +32 -0
  225. package/templates/bridges.cc +18 -0
  226. package/templates/factory.ts +34 -0
  227. package/templates/index.ts +16 -0
  228. package/templates/node-map.ts +31 -0
  229. package/templates/peer.ts +32 -0
@@ -0,0 +1,920 @@
1
+ import * as ts from "@koalaui/ets-tsc"
2
+ import * as arkts from "../arkts-api"
3
+
4
+ import { throwError } from "../utils"
5
+ import {
6
+ passModifiers,
7
+ todo,
8
+ unpackModifiers,
9
+ unpackNode,
10
+ unpackNodeArray,
11
+ unpackVariableDeclarationKind,
12
+ } from "./utilities/private"
13
+ import { SyntaxKind } from "./static/enums"
14
+
15
+ // TODO: write implementation
16
+ export interface TransformationContext {}
17
+
18
+ // TODO: write implementation
19
+ export interface Program {}
20
+
21
+ // TODO: remove U type param
22
+ export type NodeArray<T extends Node<U>, U extends arkts.AstNode | undefined = arkts.AstNode | undefined> = ts.NodeArray<T>
23
+
24
+ export abstract class Node<T extends arkts.AstNode | undefined = arkts.AstNode | undefined> implements ts.Node {
25
+ constructor(node: T) {
26
+ this.node = node
27
+ }
28
+
29
+ readonly node: T
30
+
31
+ // TODO: remove any
32
+ get parent(): any {
33
+ if (this.node === undefined) {
34
+ throwError('trying to get parent of undefined _node')
35
+ }
36
+ return unpackNode(this.node.parent)
37
+ }
38
+
39
+ set parent(node: Node) {
40
+ if (this.node === undefined) {
41
+ throwError('trying to set parent of undefined')
42
+ }
43
+ if (node.node === undefined) {
44
+ throwError('trying to set parent to undefined')
45
+ }
46
+ this.node.parent = node.node
47
+ }
48
+
49
+ set modifiers(flags: readonly Modifier[] | undefined) {
50
+ if (this.node === undefined) {
51
+ throwError('trying to set modifiers of undefined')
52
+ }
53
+ this.node.modifiers = passModifiers(flags)
54
+ }
55
+
56
+ get modifiers(): NodeArray<Modifier> {
57
+ return unpackModifiers(this.node?.modifiers)
58
+ }
59
+
60
+ abstract kind: SyntaxKind
61
+
62
+ // TODO:
63
+ 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.") }
64
+ getSourceFile(): ts.SourceFile { throw new Error("Method not implemented.") }
65
+ getChildCount(sourceFile?: ts.SourceFile | undefined): number { throw new Error("Method not implemented.") }
66
+ getChildAt(index: number, sourceFile?: ts.SourceFile | undefined): ts.Node { throw new Error("Method not implemented.") }
67
+ getChildren(sourceFile?: ts.SourceFile | undefined): ts.Node[] { throw new Error("Method not implemented.") }
68
+
69
+ getStart(sourceFile?: ts.SourceFile | undefined, includeJsDocComment?: boolean | undefined): number { throw new Error("Method not implemented.") }
70
+ getFullStart(): number { throw new Error("Method not implemented.") }
71
+ getEnd(): number { throw new Error("Method not implemented.") }
72
+ getWidth(sourceFile?: ts.SourceFileLike | undefined): number { throw new Error("Method not implemented.") }
73
+ getFullWidth(): number { throw new Error("Method not implemented.") }
74
+ getLeadingTriviaWidth(sourceFile?: ts.SourceFile | undefined): number { throw new Error("Method not implemented.") }
75
+ getFullText(sourceFile?: ts.SourceFile | undefined): string { throw new Error("Method not implemented.") }
76
+ getText(sourceFile?: ts.SourceFile | undefined): string { throw new Error("Method not implemented.") }
77
+ getFirstToken(sourceFile?: ts.SourceFile | undefined): ts.Node | undefined { throw new Error("Method not implemented.") }
78
+ getLastToken(sourceFile?: ts.SourceFile | undefined): ts.Node | undefined { throw new Error("Method not implemented.") }
79
+
80
+ get symbol(): ts.Symbol { return todo() }
81
+ get flags(): ts.NodeFlags { return todo() }
82
+ get pos(): number { return todo() }
83
+ get end(): number { return todo() }
84
+ }
85
+
86
+ // TODO: add all tokens
87
+ export type BinaryOperator =
88
+ | ts.SyntaxKind.PlusToken
89
+ | ts.SyntaxKind.MinusToken
90
+
91
+ | ts.SyntaxKind.AsteriskToken
92
+
93
+ export type BinaryOperatorToken = Token<BinaryOperator>;
94
+
95
+ // TODO: rethink maybe (temporary solution)
96
+ export class Token<TKind extends ts.TokenSyntaxKind> extends Node<undefined> {
97
+ constructor(kind: TKind) {
98
+ super(undefined)
99
+ this.kind = kind
100
+ }
101
+
102
+ readonly kind: TKind;
103
+ }
104
+
105
+ export type ModifierSyntaxKind =
106
+ // | SyntaxKind.ConstructorKeyword
107
+ | SyntaxKind.AbstractKeyword
108
+ | SyntaxKind.AccessorKeyword
109
+ | SyntaxKind.AsyncKeyword
110
+ | SyntaxKind.ConstKeyword
111
+ | SyntaxKind.DeclareKeyword
112
+ | SyntaxKind.DefaultKeyword
113
+ | SyntaxKind.ExportKeyword
114
+ | SyntaxKind.InKeyword
115
+ | SyntaxKind.PrivateKeyword
116
+ | SyntaxKind.ProtectedKeyword
117
+ | SyntaxKind.PublicKeyword
118
+ | SyntaxKind.ReadonlyKeyword
119
+ | SyntaxKind.OutKeyword
120
+ | SyntaxKind.OverrideKeyword
121
+ | SyntaxKind.StaticKeyword;
122
+
123
+ export class Modifier extends Node<undefined> {
124
+ constructor(kind: ModifierSyntaxKind) {
125
+ super(undefined)
126
+ this.kind = kind
127
+ }
128
+
129
+ public toString(): string {
130
+ return `${this.kind}`
131
+ }
132
+
133
+ kind: ModifierSyntaxKind
134
+ }
135
+
136
+ export abstract class Expression extends Node<arkts.AstNode> implements ts.Expression {
137
+ // TODO: support minimal interface
138
+ _expressionBrand: any
139
+ }
140
+
141
+ export class FunctionDeclaration extends Node<arkts.FunctionDeclaration> implements ts.FunctionDeclaration, FunctionLikeDeclarationBase {
142
+ constructor(node: arkts.FunctionDeclaration) {
143
+ super(node)
144
+ this.name = unpackNode(node.name)
145
+ this.body = unpackNode(node.body)
146
+ this.typeParameters = unpackNodeArray(node.typeParamsDecl?.parameters)
147
+ this.type = unpackNode(node.returnType)
148
+ this.parameters = unpackNodeArray(node.parameters)
149
+ }
150
+
151
+ readonly name?: Identifier | undefined
152
+ readonly body?: Block | undefined
153
+ readonly typeParameters?: NodeArray<TypeParameterDeclaration> | undefined
154
+ readonly type?: TypeNode | undefined
155
+ readonly parameters: NodeArray<ParameterDeclaration>
156
+ readonly kind: ts.SyntaxKind.FunctionDeclaration = ts.SyntaxKind.FunctionDeclaration
157
+
158
+ // brands
159
+ _functionLikeDeclarationBrand: any
160
+ _declarationBrand: any
161
+ _statementBrand: any
162
+ }
163
+
164
+ export class FunctionExpression extends Node<arkts.FunctionExpression> implements ts.FunctionExpression, FunctionLikeDeclarationBase {
165
+ constructor(node: arkts.FunctionExpression) {
166
+ super(node)
167
+ this.name = unpackNode(node.scriptFunction.ident)
168
+ if (node.scriptFunction.body === undefined) {
169
+ throwError('body expected to be not undefined')
170
+ }
171
+ this.body = unpackNode(node.scriptFunction.body)
172
+ this.parameters = unpackNodeArray(node.scriptFunction.parameters)
173
+ }
174
+
175
+ readonly name?: Identifier
176
+ readonly body: Block
177
+ readonly parameters: NodeArray<ParameterDeclaration>
178
+ readonly kind: ts.SyntaxKind.FunctionExpression = ts.SyntaxKind.FunctionExpression
179
+
180
+ // brands
181
+ _primaryExpressionBrand: any
182
+ _memberExpressionBrand: any
183
+ _leftHandSideExpressionBrand: any
184
+ _updateExpressionBrand: any
185
+ _unaryExpressionBrand: any
186
+ _expressionBrand: any
187
+ _functionLikeDeclarationBrand: any
188
+ _declarationBrand: any
189
+ }
190
+
191
+ export class Identifier extends Node<arkts.Identifier> implements ts.Identifier, Expression {
192
+ constructor(node: arkts.Identifier) {
193
+ super(node)
194
+ this.text = node.name
195
+ }
196
+
197
+ readonly text: string
198
+ readonly kind: ts.SyntaxKind.Identifier = ts.SyntaxKind.Identifier
199
+
200
+ // TODO:
201
+ get escapedText(): ts.__String { return todo() }
202
+
203
+ // brands
204
+ _primaryExpressionBrand: any
205
+ _memberExpressionBrand: any
206
+ _leftHandSideExpressionBrand: any
207
+ _updateExpressionBrand: any
208
+ _unaryExpressionBrand: any
209
+ _expressionBrand: any
210
+ _declarationBrand: any
211
+ }
212
+
213
+ export class PrivateIdentifier extends Node<arkts.Identifier> implements ts.PrivateIdentifier, Expression {
214
+ constructor(node: arkts.Identifier) {
215
+ super(node)
216
+ this.text = node.name
217
+ if (!node.isPrivate) {
218
+ throwError('identifier expected to be private')
219
+ }
220
+ }
221
+
222
+ readonly text: string
223
+ readonly kind: ts.SyntaxKind.PrivateIdentifier = ts.SyntaxKind.PrivateIdentifier
224
+
225
+ // TODO:
226
+ get escapedText(): ts.__String { return todo() }
227
+
228
+ // brands
229
+ _primaryExpressionBrand: any
230
+ _memberExpressionBrand: any
231
+ _leftHandSideExpressionBrand: any
232
+ _updateExpressionBrand: any
233
+ _unaryExpressionBrand: any
234
+ _expressionBrand: any
235
+ _declarationBrand: any
236
+ }
237
+
238
+ export abstract class Statement extends Node<arkts.AstNode> implements ts.Statement {
239
+ // brands
240
+ _statementBrand: any
241
+ }
242
+
243
+ export class Block extends Node<arkts.BlockStatement> implements ts.Block {
244
+ constructor(node: arkts.BlockStatement) {
245
+ super(node)
246
+ this.statements = unpackNodeArray(node.statements)
247
+ }
248
+
249
+ readonly statements: NodeArray<Statement>
250
+ readonly kind: ts.SyntaxKind.Block = ts.SyntaxKind.Block
251
+
252
+ // brands
253
+ _statementBrand: any
254
+ }
255
+
256
+ export class SourceFile extends Node<arkts.EtsScript> implements ts.SourceFile {
257
+ constructor(node: arkts.EtsScript) {
258
+ super(node)
259
+
260
+ this.statements = unpackNodeArray(this.node.statements)
261
+ }
262
+
263
+ readonly statements: NodeArray<Statement>
264
+ readonly kind: ts.SyntaxKind.SourceFile = ts.SyntaxKind.SourceFile
265
+
266
+ // TODO:
267
+ getLineAndCharacterOfPosition(pos: number): ts.LineAndCharacter { throw new Error("Method not implemented.") }
268
+ getLineEndOfPosition(pos: number): number { throw new Error("Method not implemented.") }
269
+ getLineStarts(): readonly number[] { throw new Error("Method not implemented.") }
270
+ getPositionOfLineAndCharacter(line: number, character: number): number { throw new Error("Method not implemented.") }
271
+ update(newText: string, textChangeRange: ts.TextChangeRange): ts.SourceFile { throw new Error("Method not implemented.") }
272
+ get endOfFileToken(): ts.Token<ts.SyntaxKind.EndOfFileToken> { return todo() }
273
+ get fileName(): string { return todo() }
274
+ get text() { return todo() }
275
+ get amdDependencies(): readonly ts.AmdDependency[] { return todo() }
276
+ get referencedFiles(): readonly ts.FileReference[] { return todo() }
277
+ get typeReferenceDirectives(): readonly ts.FileReference[] { return todo() }
278
+ get libReferenceDirectives(): readonly ts.FileReference[] { return todo() }
279
+ get languageVariant(): ts.LanguageVariant { return todo() }
280
+ get isDeclarationFile(): boolean { return todo() }
281
+ get hasNoDefaultLib(): boolean { return todo() }
282
+ get languageVersion(): ts.ScriptTarget { return todo() }
283
+
284
+ // brands
285
+ _declarationBrand: any
286
+ }
287
+
288
+ export abstract class LeftHandSideExpression extends Node<arkts.AstNode> implements ts.LeftHandSideExpression, Expression {
289
+ // brands
290
+ _leftHandSideExpressionBrand: any
291
+ _updateExpressionBrand: any
292
+ _unaryExpressionBrand: any
293
+ _expressionBrand: any
294
+ }
295
+
296
+ export class ExpressionStatement extends Node<arkts.ExpressionStatement> implements ts.ExpressionStatement, Statement {
297
+ constructor(node: arkts.ExpressionStatement) {
298
+ super(node)
299
+ this.expression = unpackNode(this.node.expression)
300
+ }
301
+
302
+ readonly expression: Expression
303
+ readonly kind: ts.SyntaxKind.ExpressionStatement = ts.SyntaxKind.ExpressionStatement
304
+
305
+ // brands
306
+ _statementBrand: any
307
+ }
308
+
309
+ export class CallExpression extends Node<arkts.CallExpression> implements ts.CallExpression, LeftHandSideExpression {
310
+ constructor(node: arkts.CallExpression) {
311
+ super(node)
312
+ this.expression = unpackNode(node.expression)
313
+ this.arguments = unpackNodeArray(node.arguments)
314
+ }
315
+
316
+ readonly expression: LeftHandSideExpression
317
+ readonly arguments: NodeArray<Expression>
318
+ readonly kind: ts.SyntaxKind.CallExpression = ts.SyntaxKind.CallExpression
319
+
320
+ // brands
321
+ _leftHandSideExpressionBrand: any
322
+ _updateExpressionBrand: any
323
+ _unaryExpressionBrand: any
324
+ _expressionBrand: any
325
+ _declarationBrand: any
326
+ }
327
+
328
+ export class PropertyAccessExpression extends Node<arkts.MemberExpression> implements ts.PropertyAccessExpression, Expression {
329
+ constructor(node: arkts.MemberExpression) {
330
+ super(node)
331
+ this.expression = unpackNode(node.object)
332
+ this.name = unpackNode(node.property)
333
+ }
334
+
335
+ readonly expression: LeftHandSideExpression
336
+ readonly name: Identifier
337
+ readonly kind: ts.SyntaxKind.PropertyAccessExpression = ts.SyntaxKind.PropertyAccessExpression
338
+
339
+ // brands
340
+ _memberExpressionBrand: any
341
+ _leftHandSideExpressionBrand: any
342
+ _updateExpressionBrand: any
343
+ _unaryExpressionBrand: any
344
+ _expressionBrand: any
345
+ _declarationBrand: any
346
+ }
347
+
348
+ export class StringLiteral extends Node<arkts.StringLiteral> implements ts.StringLiteral {
349
+ constructor(node: arkts.StringLiteral) {
350
+ super(node)
351
+
352
+ this.text = node.str
353
+ }
354
+
355
+ readonly text: string
356
+ readonly kind: ts.SyntaxKind.StringLiteral = ts.SyntaxKind.StringLiteral
357
+
358
+ // brands
359
+ _literalExpressionBrand: any
360
+ _primaryExpressionBrand: any
361
+ _memberExpressionBrand: any
362
+ _leftHandSideExpressionBrand: any
363
+ _updateExpressionBrand: any
364
+ _unaryExpressionBrand: any
365
+ _expressionBrand: any
366
+ _declarationBrand: any
367
+ }
368
+
369
+ export class ClassDeclaration extends Node<arkts.ClassDeclaration> implements ts.ClassDeclaration {
370
+ constructor(node: arkts.ClassDeclaration) {
371
+ super(node)
372
+ this.name = unpackNode(node.definition.name)
373
+ this.members = unpackNodeArray(node.definition.members)
374
+ this.typeParameters = unpackNodeArray(node.definition.typeParamsDecl?.parameters)
375
+ }
376
+
377
+ readonly name: Identifier
378
+ readonly members: NodeArray<ClassElement>
379
+ readonly typeParameters?: NodeArray<TypeParameterDeclaration>
380
+ readonly kind: ts.SyntaxKind.ClassDeclaration = ts.SyntaxKind.ClassDeclaration
381
+
382
+ // brands
383
+ _declarationBrand: any
384
+ _statementBrand: any
385
+ }
386
+
387
+ export abstract class ClassElement extends Node<arkts.AstNode> implements ts.ClassElement {
388
+ // brands
389
+ _declarationBrand: any
390
+ _classElementBrand: any
391
+ }
392
+
393
+ export type MemberName = Identifier | PrivateIdentifier;
394
+
395
+ // TODO: support
396
+ // export type PropertyName = Identifier | StringLiteral | NumericLiteral | ts.ComputedPropertyName | PrivateIdentifier;
397
+ export type PropertyName = Identifier | StringLiteral | NumericLiteral | PrivateIdentifier;
398
+
399
+ // TODO: support
400
+ export type DeclarationName =
401
+ | PropertyName
402
+ // | JsxAttributeName
403
+ // | StringLiteralLike
404
+ // | ElementAccessExpression
405
+ // | BindingPattern
406
+ // | EntityNameExpression;
407
+
408
+ export interface Declaration extends Node<arkts.AstNode> {}
409
+
410
+ export abstract class NamedDeclaration extends Node<arkts.AstNode> implements ts.NamedDeclaration, Declaration {
411
+ readonly name?: DeclarationName;
412
+
413
+ // brands
414
+ _declarationBrand: any
415
+ }
416
+
417
+ export type SignatureDeclaration = ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration | MethodSignature | ts.IndexSignatureDeclaration | FunctionTypeNode | ts.ConstructorTypeNode | ts.JSDocFunctionType | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | ts.AccessorDeclaration | FunctionExpression | ArrowFunction;
418
+
419
+ export interface SignatureDeclarationBase extends NamedDeclaration {}
420
+
421
+ export type VariableLikeDeclaration = ts.VariableDeclaration | ParameterDeclaration | ts.BindingElement | PropertyDeclaration | ts.PropertyAssignment | PropertySignature | ts.JsxAttribute | ts.ShorthandPropertyAssignment | ts.EnumMember | ts.JSDocPropertyTag | ts.JSDocParameterTag;
422
+
423
+ export interface FunctionLikeDeclarationBase extends SignatureDeclarationBase {
424
+ // brands
425
+ _functionLikeDeclarationBrand: any;
426
+ }
427
+
428
+ // TODO: support
429
+ // export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
430
+ export type FunctionLikeDeclaration = FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction;
431
+
432
+ export class MethodSignature extends Node<arkts.AstNode> implements ts.MethodSignature, SignatureDeclarationBase {
433
+ constructor(node: arkts.AstNode) {
434
+ super(node)
435
+ }
436
+
437
+ // readonly name: PropertyName
438
+ // readonly parameters: NodeArray<ParameterDeclaration>
439
+ readonly kind: ts.SyntaxKind.MethodSignature = ts.SyntaxKind.MethodSignature
440
+
441
+ // TODO:
442
+ name: any
443
+ parameters: any
444
+
445
+ // brands
446
+ _declarationBrand: any
447
+ _typeElementBrand: any
448
+ }
449
+
450
+ // export class MethodDeclaration extends Node implements ts.MethodDeclaration, FunctionLikeDeclarationBase, ClassElement {
451
+ export class MethodDeclaration extends Node<arkts.MethodDefinition> implements ts.MethodDeclaration, ClassElement {
452
+ constructor(node: arkts.MethodDefinition) {
453
+ super(node)
454
+ this.name = unpackNode(node.name)
455
+ this.parameters = unpackNodeArray(node.scriptFunction.parameters)
456
+ this.body = unpackNode(node.scriptFunction.body)
457
+ }
458
+
459
+ // tsc: readonly name?: PropertyName
460
+ readonly name: Identifier
461
+ readonly parameters: NodeArray<ParameterDeclaration>
462
+ // tsc: readonly body?: FunctionBody | undefined
463
+ readonly body?: Block | undefined
464
+ readonly kind: ts.SyntaxKind.MethodDeclaration = ts.SyntaxKind.MethodDeclaration
465
+
466
+ // brands
467
+ _functionLikeDeclarationBrand: any
468
+ _classElementBrand: any
469
+ _objectLiteralBrand: any
470
+ _declarationBrand: any
471
+ }
472
+
473
+ // export class ConstructorDeclaration extends Node<arkts.MethodDefinition> implements ts.ConstructorDeclaration, FunctionLikeDeclarationBase, ClassElement {
474
+ export class ConstructorDeclaration extends Node<arkts.MethodDefinition> implements ts.ConstructorDeclaration, ClassElement {
475
+ constructor(node: arkts.MethodDefinition) {
476
+ super(node)
477
+ this.name = unpackNode(node.name)
478
+ this.parameters = unpackNodeArray(node.scriptFunction.parameters)
479
+ this.body = unpackNode(node.scriptFunction.body)
480
+ }
481
+
482
+ // ts: readonly name?: PropertyName
483
+ readonly name: Identifier
484
+ readonly parameters: NodeArray<ParameterDeclaration>
485
+ // ts: readonly body?: FunctionBody | undefined
486
+ readonly body?: Block
487
+ readonly kind: ts.SyntaxKind.Constructor = ts.SyntaxKind.Constructor
488
+
489
+ // brands
490
+ _functionLikeDeclarationBrand: any
491
+ _classElementBrand: any
492
+ _objectLiteralBrand: any
493
+ _declarationBrand: any
494
+ }
495
+
496
+ // TODO: specify arkts.AstNode type
497
+ export class PropertySignature extends Node<arkts.AstNode> implements ts.TypeElement {
498
+ constructor(node: arkts.AstNode) {
499
+ super(node)
500
+ }
501
+
502
+ readonly name?: PropertyName
503
+ readonly kind: ts.SyntaxKind.PropertySignature = ts.SyntaxKind.PropertySignature
504
+
505
+ // brands
506
+ _typeElementBrand: any
507
+ _declarationBrand: any
508
+ }
509
+
510
+ // TODO: specify arkts.AstNode type
511
+ export class PropertyDeclaration extends Node<arkts.AstNode> implements ts.PropertyDeclaration, ClassElement {
512
+ constructor(node: arkts.AstNode) {
513
+ super(node)
514
+ }
515
+
516
+ readonly kind: ts.SyntaxKind.PropertyDeclaration = ts.SyntaxKind.PropertyDeclaration
517
+
518
+ // TODO:
519
+ name: any
520
+
521
+ // brands
522
+ _classElementBrand: any
523
+ _declarationBrand: any
524
+ }
525
+
526
+ // TODO: specify arkts.AstNode type
527
+ export class GetAccessorDeclaration extends Node<arkts.AstNode> implements ts.GetAccessorDeclaration, FunctionLikeDeclarationBase, ClassElement {
528
+ constructor(node: arkts.AstNode) {
529
+ super(node)
530
+ }
531
+
532
+ // readonly name: PropertyName
533
+ // readonly parameters: NodeArray<ParameterDeclaration>
534
+ readonly kind: ts.SyntaxKind.GetAccessor = ts.SyntaxKind.GetAccessor
535
+
536
+ // TODO:
537
+ name: any
538
+ parameters: any
539
+
540
+ // brands
541
+ _functionLikeDeclarationBrand: any
542
+ _declarationBrand: any
543
+ _classElementBrand: any
544
+ _typeElementBrand: any
545
+ _objectLiteralBrand: any
546
+ }
547
+
548
+ // TODO: specify arkts.AstNode type
549
+ export class SetAccessorDeclaration extends Node<arkts.AstNode> implements ts.SetAccessorDeclaration, FunctionLikeDeclarationBase, ClassElement {
550
+ constructor(node: arkts.AstNode) {
551
+ super(node)
552
+ }
553
+
554
+ // readonly name: PropertyName
555
+ // readonly parameters: NodeArray<ParameterDeclaration>
556
+ readonly kind: ts.SyntaxKind.SetAccessor = ts.SyntaxKind.SetAccessor
557
+
558
+ // TODO:
559
+ name: any
560
+ parameters: any
561
+
562
+ // brands
563
+ _functionLikeDeclarationBrand: any
564
+ _declarationBrand: any
565
+ _classElementBrand: any
566
+ _typeElementBrand: any
567
+ _objectLiteralBrand: any
568
+ }
569
+
570
+ export class ParameterDeclaration extends Node<arkts.ETSParameterExpression> implements ts.ParameterDeclaration, NamedDeclaration {
571
+ constructor(node: arkts.ETSParameterExpression) {
572
+ super(node)
573
+ }
574
+
575
+ readonly kind: ts.SyntaxKind.Parameter = ts.SyntaxKind.Parameter
576
+
577
+ // TODO:
578
+ name: any
579
+
580
+ // brands
581
+ _declarationBrand: any
582
+ }
583
+
584
+ export type BindingName = Identifier | ts.BindingPattern;
585
+
586
+ export class VariableStatement extends Node<arkts.VariableDeclaration> implements ts.VariableStatement {
587
+ constructor(node: arkts.VariableDeclaration) {
588
+ super(node)
589
+ this.declarationList = new VariableDeclarationList(node)
590
+ }
591
+
592
+ readonly declarationList: VariableDeclarationList
593
+ readonly kind: ts.SyntaxKind.VariableStatement = ts.SyntaxKind.VariableStatement
594
+
595
+ // brands
596
+ _statementBrand: any
597
+ }
598
+
599
+ export class VariableDeclarationList extends Node<arkts.VariableDeclaration> implements ts.VariableDeclarationList {
600
+ constructor(node: arkts.VariableDeclaration) {
601
+ super(node)
602
+ this.declarations = unpackNodeArray(node.declarators)
603
+ }
604
+
605
+ readonly declarations: NodeArray<VariableDeclaration>
606
+ get flags(): ts.NodeFlags { return unpackVariableDeclarationKind(this.node.declarationKind) }
607
+ readonly kind: ts.SyntaxKind.VariableDeclarationList = ts.SyntaxKind.VariableDeclarationList
608
+ }
609
+
610
+ export class VariableDeclaration extends Node<arkts.VariableDeclarator> implements ts.VariableDeclaration, NamedDeclaration {
611
+ constructor(node: arkts.VariableDeclarator) {
612
+ super(node)
613
+ this.name = unpackNode(node.name)
614
+ }
615
+
616
+ readonly name: Identifier
617
+ readonly kind: ts.SyntaxKind.VariableDeclaration = ts.SyntaxKind.VariableDeclaration
618
+
619
+ // brands
620
+ _declarationBrand: any
621
+ }
622
+
623
+ export class TypeParameterDeclaration extends Node<arkts.TSTypeParameter> implements ts.TypeParameterDeclaration {
624
+ constructor(node: arkts.TSTypeParameter) {
625
+ super(node)
626
+ this.name = unpackNode(node.name)
627
+ }
628
+
629
+ readonly name: Identifier
630
+ readonly kind: ts.SyntaxKind.TypeParameter = ts.SyntaxKind.TypeParameter
631
+
632
+ // brands
633
+ _declarationBrand: any
634
+ }
635
+
636
+ export abstract class TypeNode extends Node<arkts.AstNode> implements ts.TypeNode {
637
+ // brands
638
+ _typeNodeBrand: any
639
+ }
640
+
641
+ export class KeywordTypeNode extends Node<arkts.ETSPrimitiveType | arkts.ETSTypeReference> implements ts.KeywordTypeNode, TypeNode {
642
+ constructor(node: arkts.ETSPrimitiveType | arkts.ETSTypeReference) {
643
+ super(node)
644
+ }
645
+
646
+ readonly kind: ts.KeywordTypeSyntaxKind = ts.SyntaxKind.UnknownKeyword
647
+
648
+ // brands
649
+ _typeNodeBrand: any
650
+ }
651
+
652
+ export class TypeReferenceNode extends Node<arkts.AstNode> implements ts.TypeReferenceNode, TypeNode {
653
+ constructor(node: arkts.AstNode) {
654
+ super(node)
655
+ }
656
+
657
+ readonly kind: ts.SyntaxKind.TypeReference = ts.SyntaxKind.TypeReference
658
+
659
+ // TODO:
660
+ typeName: any
661
+
662
+ // brands
663
+ _typeNodeBrand: any
664
+ }
665
+
666
+ export class FunctionTypeNode extends Node<arkts.AstNode> implements ts.FunctionTypeNode, TypeNode, SignatureDeclarationBase {
667
+ constructor(node: arkts.AstNode) {
668
+ super(node)
669
+ }
670
+
671
+ readonly name?: DeclarationName
672
+ readonly kind: ts.SyntaxKind.FunctionType = ts.SyntaxKind.FunctionType
673
+
674
+ // TODO: support minimal interface
675
+ parameters: any
676
+ type: any
677
+
678
+ // brands
679
+ _typeNodeBrand: any
680
+ _declarationBrand: any
681
+ }
682
+
683
+ export class UnionTypeNode extends Node<arkts.ETSUnionType> implements ts.UnionTypeNode, TypeNode {
684
+ constructor(node: arkts.ETSUnionType) {
685
+ super(node)
686
+ this.types = unpackNodeArray(node.types)
687
+ }
688
+
689
+ readonly types: NodeArray<TypeNode>
690
+ readonly kind: ts.SyntaxKind.UnionType = ts.SyntaxKind.UnionType
691
+
692
+ // brands
693
+ _typeNodeBrand: any
694
+ }
695
+
696
+ export class ReturnStatement extends Node<arkts.ReturnStatement> implements ts.ReturnStatement, Statement {
697
+ constructor(node: arkts.ReturnStatement) {
698
+ super(node)
699
+ this.expression = unpackNode(node.argument)
700
+ }
701
+
702
+ readonly expression: Expression | undefined
703
+ readonly kind: ts.SyntaxKind.ReturnStatement = ts.SyntaxKind.ReturnStatement
704
+
705
+ // brands
706
+ _statementBrand: any
707
+ }
708
+
709
+ export class IfStatement extends Node<arkts.IfStatement> implements ts.IfStatement {
710
+ constructor(node: arkts.IfStatement) {
711
+ super(node)
712
+ }
713
+
714
+ readonly kind: ts.SyntaxKind.IfStatement = ts.SyntaxKind.IfStatement
715
+
716
+ // TODO:
717
+ thenStatement: any
718
+ expression: any
719
+
720
+ // brands
721
+ _statementBrand: any
722
+ }
723
+
724
+ export class BinaryExpression extends Node<arkts.BinaryExpression> implements ts.BinaryExpression {
725
+ constructor(node: arkts.BinaryExpression) {
726
+ super(node)
727
+ }
728
+
729
+ readonly kind: ts.SyntaxKind.BinaryExpression = ts.SyntaxKind.BinaryExpression
730
+
731
+ // TODO:
732
+ left: any
733
+ right: any
734
+ operatorToken: any
735
+
736
+ // brands
737
+ _expressionBrand: any
738
+ _declarationBrand: any
739
+ }
740
+
741
+ export class AssignmentExpression extends Node<arkts.AssignmentExpression> implements ts.AssignmentExpression<any> {
742
+ constructor(node: arkts.AssignmentExpression) {
743
+ super(node)
744
+ }
745
+
746
+ readonly kind: ts.SyntaxKind.BinaryExpression = ts.SyntaxKind.BinaryExpression
747
+
748
+ // TODO:
749
+ right: any
750
+ left: any
751
+ operatorToken: any
752
+
753
+ // brands
754
+ _expressionBrand: any
755
+ _declarationBrand: any
756
+ }
757
+
758
+ export class ArrowFunction extends Node<arkts.ArrowFunctionExpression> implements ts.ArrowFunction {
759
+ constructor(node: arkts.ArrowFunctionExpression) {
760
+ super(node)
761
+ if (node.scriptFunction.body === undefined) {
762
+ throwError('node.scriptFunction.body not expected to be undefined')
763
+ }
764
+ this.body = unpackNode(node.scriptFunction.body)
765
+ this.parameters = unpackNodeArray(node.scriptFunction.parameters)
766
+ }
767
+
768
+ get name(): never { return throwError(`name doesn't exist for ArrowFunction`) }
769
+ readonly body: Block
770
+ readonly parameters: NodeArray<ParameterDeclaration>
771
+ readonly kind: ts.SyntaxKind.ArrowFunction = ts.SyntaxKind.ArrowFunction
772
+
773
+ // TODO:
774
+ equalsGreaterThanToken: any
775
+
776
+ // brands
777
+ _expressionBrand: any
778
+ _functionLikeDeclarationBrand: any
779
+ _declarationBrand: any
780
+ }
781
+
782
+ export class NumericLiteral extends Node<arkts.NumberLiteral> implements ts.NumericLiteral, Declaration {
783
+ constructor(node: arkts.NumberLiteral) {
784
+ super(node)
785
+
786
+ this.text = `${node.value}`
787
+ }
788
+
789
+ readonly text: string
790
+ readonly kind: ts.SyntaxKind.NumericLiteral = ts.SyntaxKind.NumericLiteral
791
+
792
+ // brands
793
+ _literalExpressionBrand: any
794
+ _declarationBrand: any
795
+ _primaryExpressionBrand: any
796
+ _memberExpressionBrand: any
797
+ _leftHandSideExpressionBrand: any
798
+ _updateExpressionBrand: any
799
+ _unaryExpressionBrand: any
800
+ _expressionBrand: any
801
+ }
802
+
803
+ export class SuperExpression extends Node<arkts.SuperExpression> implements ts.SuperExpression {
804
+ constructor(node: arkts.SuperExpression) {
805
+ super(node)
806
+ }
807
+
808
+ readonly kind: ts.SyntaxKind.SuperKeyword = ts.SyntaxKind.SuperKeyword
809
+
810
+ // brands
811
+ _primaryExpressionBrand: any
812
+ _memberExpressionBrand: any
813
+ _leftHandSideExpressionBrand: any
814
+ _updateExpressionBrand: any
815
+ _unaryExpressionBrand: any
816
+ _expressionBrand: any
817
+ }
818
+
819
+ export class HeritageClause extends Node<arkts.SuperExpression> implements ts.HeritageClause {
820
+ constructor(node: arkts.SuperExpression) {
821
+ super(node)
822
+ }
823
+
824
+ readonly kind: ts.SyntaxKind.HeritageClause = ts.SyntaxKind.HeritageClause
825
+ // token: ts.SyntaxKind.ExtendsKeyword | ts.SyntaxKind.ImplementsKeyword
826
+ // types: ts.NodeArray<ts.ExpressionWithTypeArguments>
827
+
828
+ // TODO:
829
+ token: any
830
+ types: any
831
+ }
832
+
833
+
834
+ // TODO: there is no ParenthesizedExpression in ArkTS,
835
+ // so for temporary solution we're just gonna ignore this type of nodes
836
+ // and replace it with Expression underneath
837
+ export type ParenthesizedExpression = Expression
838
+ // export class ParenthesizedExpression extends Node<undefined> implements ts.ParenthesizedExpression {
839
+ // constructor(expression: Expression) {
840
+ // super(undefined)
841
+ // this.expression = expression
842
+ // }
843
+
844
+ // readonly expression: Expression
845
+ // readonly kind: ts.SyntaxKind.ParenthesizedExpression = ts.SyntaxKind.ParenthesizedExpression
846
+
847
+ // // brands
848
+ // _primaryExpressionBrand: any
849
+ // _memberExpressionBrand: any
850
+ // _leftHandSideExpressionBrand: any
851
+ // _updateExpressionBrand: any
852
+ // _unaryExpressionBrand: any
853
+ // _expressionBrand: any
854
+ // }
855
+
856
+ // TODO:
857
+ export class ImportDeclaration extends Node<arkts.UnsupportedNode> implements ts.ImportDeclaration {
858
+ constructor(node: arkts.UnsupportedNode) {
859
+ super(node)
860
+ }
861
+
862
+ readonly kind: ts.SyntaxKind.ImportDeclaration = ts.SyntaxKind.ImportDeclaration
863
+
864
+ // TODO:
865
+ moduleSpecifier: any
866
+
867
+ // brands
868
+ _statementBrand: any
869
+ }
870
+
871
+ // TODO:
872
+ export class ImportClause extends Node<arkts.UnsupportedNode> implements ts.ImportClause {
873
+ constructor(node: arkts.UnsupportedNode) {
874
+ super(node)
875
+ }
876
+
877
+ readonly kind: ts.SyntaxKind.ImportClause = ts.SyntaxKind.ImportClause
878
+
879
+ // TODO:
880
+ isTypeOnly: any
881
+
882
+ // brands
883
+ _declarationBrand: any
884
+ }
885
+
886
+ // TODO:
887
+ export class NamedImports extends Node<arkts.UnsupportedNode> implements ts.NamedImports {
888
+ constructor(node: arkts.UnsupportedNode) {
889
+ super(node)
890
+ }
891
+
892
+ readonly kind: ts.SyntaxKind.NamedImports = ts.SyntaxKind.NamedImports
893
+
894
+ // TODO:
895
+ elements: any
896
+ }
897
+
898
+ export class ImportSpecifier extends Node<arkts.Identifier> implements ts.ImportSpecifier {
899
+ constructor(node: arkts.Identifier) {
900
+ super(node)
901
+ this.name = unpackNode(this.node)
902
+ }
903
+
904
+ readonly name: Identifier
905
+ readonly kind: ts.SyntaxKind.ImportSpecifier = ts.SyntaxKind.ImportSpecifier
906
+
907
+ // TODO:
908
+ isTypeOnly: any
909
+
910
+ // brands
911
+ _declarationBrand: any
912
+ }
913
+
914
+ export class UnsupportedNode extends Node<arkts.AstNode> implements ts.Node {
915
+ constructor(node: arkts.AstNode) {
916
+ super(node)
917
+ }
918
+
919
+ readonly kind: ts.SyntaxKind = SyntaxKind.Unknown
920
+ }