@idlizer/arktscgen 2.1.10-arktscgen-3a → 2.1.10-arktscgen-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/build/libarkts-copy/native/meson.build +1 -1
  2. package/build/libarkts-copy/native/src/bridges.cc +72 -115
  3. package/build/libarkts-copy/native/src/common.cc +225 -84
  4. package/build/libarkts-copy/native/src/common.h +22 -22
  5. package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
  6. package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
  7. package/build/libarkts-copy/package.json +23 -19
  8. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
  9. package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
  10. package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
  11. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
  12. package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
  13. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
  14. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +44 -29
  15. package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
  16. package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +8 -8
  18. package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +9 -21
  19. package/build/libarkts-copy/src/arkts-api/node-utilities/AssignmentExpression.ts +12 -14
  20. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +5 -5
  21. package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +47 -13
  22. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +62 -32
  23. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +14 -13
  24. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +24 -21
  25. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +10 -12
  26. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +14 -18
  27. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +15 -16
  28. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +5 -8
  29. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +6 -12
  30. package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +12 -11
  31. package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +14 -33
  32. package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +12 -23
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +17 -21
  34. package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +9 -8
  35. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +21 -16
  36. package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +80 -35
  37. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +22 -32
  38. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +12 -14
  39. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +10 -12
  40. package/build/libarkts-copy/src/arkts-api/node-utilities/TryStatement.ts +10 -9
  41. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +10 -12
  42. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +8 -8
  43. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +53 -49
  44. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
  45. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
  46. package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
  47. package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +9 -9
  48. package/build/libarkts-copy/src/arkts-api/peers/ImportPathManager.ts +6 -8
  49. package/build/libarkts-copy/src/arkts-api/peers/Options.ts +8 -8
  50. package/build/libarkts-copy/src/arkts-api/plugins.ts +98 -30
  51. package/build/libarkts-copy/src/arkts-api/static/global.ts +35 -36
  52. package/build/libarkts-copy/src/arkts-api/static/globalUtils.ts +5 -5
  53. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +107 -91
  54. package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +54 -37
  55. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +86 -69
  56. package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +39 -23
  57. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
  58. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
  59. package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
  60. package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +8 -8
  61. package/build/libarkts-copy/src/checkSdk.ts +15 -18
  62. package/build/libarkts-copy/src/index.ts +29 -29
  63. package/build/libarkts-copy/src/plugin-utils.ts +52 -40
  64. package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
  65. package/build/libarkts-copy/src/tracer.ts +75 -69
  66. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +134 -274
  67. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +23 -23
  68. package/build/libarkts-copy/src/ts-api/index.ts +27 -35
  69. package/build/libarkts-copy/src/ts-api/static/enums.ts +3 -3
  70. package/build/libarkts-copy/src/ts-api/types.ts +535 -395
  71. package/build/libarkts-copy/src/ts-api/utilities/private.ts +115 -112
  72. package/build/libarkts-copy/src/ts-api/utilities/public.ts +18 -18
  73. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +33 -49
  74. package/build/libarkts-copy/src/utils.ts +97 -70
  75. package/build/libarkts-copy/tsconfig.json +3 -2
  76. package/lib/index.js +428 -159
  77. package/package.json +51 -53
  78. package/templates/Es2pandaNativeModule.ts +1 -0
  79. package/templates/factory.ts +1 -1
  80. package/templates/peer.ts +2 -1
  81. package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16382
  82. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1350
  83. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5195
  84. package/build/libarkts-copy/src/generated/factory.ts +0 -1286
  85. package/build/libarkts-copy/src/generated/index.ts +0 -222
  86. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -44
  87. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -54
  88. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -45
  89. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +0 -165
  90. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +0 -84
  91. package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -73
  92. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -109
  93. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +0 -119
  94. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -65
  95. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -111
  96. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -49
  97. package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -40
  98. package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -40
  99. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -61
  100. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -61
  101. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -110
  102. package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -40
  103. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -72
  104. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -94
  105. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -61
  106. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +0 -78
  107. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +0 -129
  108. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -74
  109. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -68
  110. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -58
  111. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +0 -76
  112. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +0 -365
  113. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +0 -76
  114. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +0 -62
  115. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +0 -137
  116. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +0 -66
  117. package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -40
  118. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -82
  119. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +0 -78
  120. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -58
  121. package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -40
  122. package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -62
  123. package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -40
  124. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -60
  125. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -66
  126. package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -40
  127. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -62
  128. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +0 -102
  129. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -90
  130. package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -75
  131. package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -61
  132. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +0 -129
  133. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -75
  134. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -79
  135. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -75
  136. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -58
  137. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -59
  138. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +0 -189
  139. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -62
  140. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +0 -55
  141. package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -58
  142. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -59
  143. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -89
  144. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +0 -66
  145. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +0 -78
  146. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -58
  147. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -75
  148. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +0 -63
  149. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -66
  150. package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -40
  151. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +0 -66
  152. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -64
  153. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +0 -94
  154. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +0 -82
  155. package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -84
  156. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -67
  157. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -69
  158. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -72
  159. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -67
  160. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +0 -106
  161. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +0 -74
  162. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +0 -70
  163. package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -40
  164. package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -162
  165. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -78
  166. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +0 -87
  167. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +0 -62
  168. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -61
  169. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +0 -62
  170. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -40
  171. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +0 -73
  172. package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -40
  173. package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -40
  174. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +0 -68
  175. package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -53
  176. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -45
  177. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -53
  178. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -115
  179. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -62
  180. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +0 -152
  181. package/build/libarkts-copy/src/generated/peers/NamedType.ts +0 -84
  182. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -64
  183. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -58
  184. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -78
  185. package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -40
  186. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -94
  187. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -58
  188. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -58
  189. package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -101
  190. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -65
  191. package/build/libarkts-copy/src/generated/peers/Program.ts +0 -206
  192. package/build/libarkts-copy/src/generated/peers/Property.ts +0 -92
  193. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -65
  194. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -75
  195. package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -40
  196. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +0 -310
  197. package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -40
  198. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -61
  199. package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -40
  200. package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +0 -48
  201. package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -40
  202. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -83
  203. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -120
  204. package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -44
  205. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -66
  206. package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -40
  207. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -58
  208. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -70
  209. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +0 -71
  210. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -58
  211. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -61
  212. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -84
  213. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -58
  214. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -58
  215. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +0 -70
  216. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -71
  217. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +0 -73
  218. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +0 -112
  219. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -76
  220. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -61
  221. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +0 -75
  222. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +0 -69
  223. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +0 -72
  224. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -73
  225. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -64
  226. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +0 -62
  227. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -61
  228. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +0 -160
  229. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -62
  230. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -62
  231. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -62
  232. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +0 -72
  233. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +0 -79
  234. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -61
  235. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -71
  236. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -68
  237. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -58
  238. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -66
  239. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -58
  240. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -58
  241. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -58
  242. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -74
  243. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -62
  244. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -80
  245. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +0 -71
  246. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +0 -75
  247. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -58
  248. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -58
  249. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -61
  250. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +0 -151
  251. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -71
  252. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -61
  253. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -71
  254. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +0 -121
  255. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +0 -75
  256. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -62
  257. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -68
  258. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -62
  259. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +0 -70
  260. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -58
  261. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -61
  262. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -58
  263. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -58
  264. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +0 -69
  265. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -69
  266. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +0 -68
  267. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -58
  268. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -62
  269. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +0 -89
  270. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +0 -81
  271. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -44
  272. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -45
  273. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -61
  274. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -70
  275. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -58
  276. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -68
  277. package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -40
  278. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -50
  279. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +0 -113
  280. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -79
  281. package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -40
  282. package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -40
  283. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -71
  284. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -64
@@ -13,27 +13,23 @@
13
13
  * limitations under the License.
14
14
  */
15
15
 
16
- import { throwError } from "../../utils"
16
+ import { throwError } from '../../utils';
17
17
 
18
- import * as ts from "../"
19
- import * as arkts from "../../arkts-api"
18
+ import * as ts from '../';
19
+ import * as arkts from '../../arkts-api';
20
20
 
21
- import { KInt } from "@koalaui/interop"
22
- import {
23
- SyntaxKind,
24
- TokenSyntaxKind,
25
- NodeFlags,
26
- } from "../static/enums"
21
+ import { KInt } from '@koalaui/interop';
22
+ import { SyntaxKind, TokenSyntaxKind, NodeFlags } from '../static/enums';
27
23
  import {
28
24
  Es2pandaAstNodeType,
29
25
  Es2pandaModifierFlags,
30
26
  Es2pandaScriptFunctionFlags,
31
27
  Es2pandaTokenType,
32
28
  Es2pandaVariableDeclarationKind,
33
- } from "../../arkts-api"
29
+ } from '../../arkts-api';
34
30
 
35
31
  export function emptyImplementation(): any {
36
- throwError("Not yet implemented")
32
+ throwError('Not yet implemented');
37
33
  }
38
34
 
39
35
  type kindTypes =
@@ -48,9 +44,9 @@ type kindTypes =
48
44
  | { new (node: arkts.ETSParameterExpression): ts.ParameterDeclaration }
49
45
  | { new (node: arkts.CallExpression): ts.CallExpression }
50
46
  | { new (node: arkts.BlockStatement): ts.Block }
51
- | { new (node: arkts.TSTypeParameter): ts.TypeParameterDeclaration}
52
- | { new (node: arkts.MemberExpression): ts.PropertyAccessExpression}
53
- | { new (node: arkts.IfStatement): ts.IfStatement}
47
+ | { new (node: arkts.TSTypeParameter): ts.TypeParameterDeclaration }
48
+ | { new (node: arkts.MemberExpression): ts.PropertyAccessExpression }
49
+ | { new (node: arkts.IfStatement): ts.IfStatement }
54
50
  | { new (node: arkts.ETSTypeReference): ts.TypeReferenceNode }
55
51
  | { new (node: arkts.ETSPrimitiveType | arkts.ETSTypeReference): ts.KeywordTypeNode }
56
52
  | { new (node: arkts.BinaryExpression): ts.BinaryExpression }
@@ -59,104 +55,109 @@ type kindTypes =
59
55
  | { new (node: arkts.ClassDeclaration): ts.ClassDeclaration }
60
56
  | { new (node: arkts.MethodDefinition): ts.MethodDeclaration }
61
57
  | { new (node: arkts.VariableDeclarator): ts.VariableDeclaration }
62
- | { new (node: arkts.VariableDeclaration): ts.VariableStatement }
58
+ | { new (node: arkts.VariableDeclaration): ts.VariableStatement };
63
59
 
64
60
  export function classByEtsNode(node: arkts.AstNode) {
65
- const types =
66
- new Map<Es2pandaAstNodeType, kindTypes>([
67
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE, ts.SourceFile],
68
- [Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER, ts.Identifier],
69
- [Es2pandaAstNodeType.AST_NODE_TYPE_STRING_LITERAL, ts.StringLiteral],
70
- [Es2pandaAstNodeType.AST_NODE_TYPE_NUMBER_LITERAL, ts.NumericLiteral],
71
- [Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT, ts.ExpressionStatement],
72
- [Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION, ts.FunctionDeclaration],
73
- [Es2pandaAstNodeType.AST_NODE_TYPE_RETURN_STATEMENT, ts.ReturnStatement],
74
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION, ts.ParameterDeclaration],
75
- [Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION, ts.CallExpression],
76
- [Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT, ts.Block],
77
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE, ts.TypeReferenceNode],
78
- [Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER, ts.TypeParameterDeclaration],
79
- [Es2pandaAstNodeType.AST_NODE_TYPE_MEMBER_EXPRESSION, ts.PropertyAccessExpression],
80
- [Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT, ts.IfStatement],
81
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PRIMITIVE_TYPE, ts.KeywordTypeNode],
82
- [Es2pandaAstNodeType.AST_NODE_TYPE_BINARY_EXPRESSION, ts.BinaryExpression],
83
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_UNION_TYPE, ts.UnionTypeNode],
84
- [Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION, ts.ArrowFunction],
85
- [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION, ts.ClassDeclaration],
86
- [Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION, ts.MethodDeclaration],
87
- [Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION, ts.VariableStatement],
88
- [Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR, ts.VariableDeclaration],
89
- [Es2pandaAstNodeType.AST_NODE_TYPE_SUPER_EXPRESSION, ts.SuperExpression],
61
+ const types = new Map<Es2pandaAstNodeType, kindTypes>([
62
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE, ts.SourceFile],
63
+ [Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER, ts.Identifier],
64
+ [Es2pandaAstNodeType.AST_NODE_TYPE_STRING_LITERAL, ts.StringLiteral],
65
+ [Es2pandaAstNodeType.AST_NODE_TYPE_NUMBER_LITERAL, ts.NumericLiteral],
66
+ [Es2pandaAstNodeType.AST_NODE_TYPE_EXPRESSION_STATEMENT, ts.ExpressionStatement],
67
+ [Es2pandaAstNodeType.AST_NODE_TYPE_FUNCTION_DECLARATION, ts.FunctionDeclaration],
68
+ [Es2pandaAstNodeType.AST_NODE_TYPE_RETURN_STATEMENT, ts.ReturnStatement],
69
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PARAMETER_EXPRESSION, ts.ParameterDeclaration],
70
+ [Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION, ts.CallExpression],
71
+ [Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT, ts.Block],
72
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TYPE_REFERENCE, ts.TypeReferenceNode],
73
+ [Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER, ts.TypeParameterDeclaration],
74
+ [Es2pandaAstNodeType.AST_NODE_TYPE_MEMBER_EXPRESSION, ts.PropertyAccessExpression],
75
+ [Es2pandaAstNodeType.AST_NODE_TYPE_IF_STATEMENT, ts.IfStatement],
76
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_PRIMITIVE_TYPE, ts.KeywordTypeNode],
77
+ [Es2pandaAstNodeType.AST_NODE_TYPE_BINARY_EXPRESSION, ts.BinaryExpression],
78
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_UNION_TYPE, ts.UnionTypeNode],
79
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION, ts.ArrowFunction],
80
+ [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION, ts.ClassDeclaration],
81
+ [Es2pandaAstNodeType.AST_NODE_TYPE_METHOD_DEFINITION, ts.MethodDeclaration],
82
+ [Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATION, ts.VariableStatement],
83
+ [Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR, ts.VariableDeclaration],
84
+ [Es2pandaAstNodeType.AST_NODE_TYPE_SUPER_EXPRESSION, ts.SuperExpression],
90
85
 
91
- [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_STATIC_BLOCK, ts.UnsupportedNode],
92
- [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_PROPERTY, ts.UnsupportedNode],
93
- [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION, ts.UnsupportedNode],
94
- ])
86
+ [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_STATIC_BLOCK, ts.UnsupportedNode],
87
+ [Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_PROPERTY, ts.UnsupportedNode],
88
+ [Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION, ts.UnsupportedNode],
89
+ ]);
95
90
 
96
- return types.get(node.type) ?? throwError(`UNSUPPORTED NODE (ts): ${Es2pandaAstNodeType[node.type]}`)
91
+ return types.get(node.type) ?? throwError(`UNSUPPORTED NODE (ts): ${Es2pandaAstNodeType[node.type]}`);
97
92
  }
98
93
 
99
94
  // Improve: add checks for casts in functions below
100
95
 
101
- export function unpackNode<U extends arkts.AstNode, T extends ts.Node<U> >(node: U): T
102
- export function unpackNode<U extends arkts.AstNode | undefined, T extends ts.Node<U> >(node: U): T | undefined
103
- export function unpackNode<U extends arkts.AstNode | undefined, T extends ts.Node<U> >(node: U): T | undefined {
96
+ export function unpackNode<U extends arkts.AstNode, T extends ts.Node<U>>(node: U): T;
97
+ export function unpackNode<U extends arkts.AstNode | undefined, T extends ts.Node<U>>(node: U): T | undefined;
98
+ export function unpackNode<U extends arkts.AstNode | undefined, T extends ts.Node<U>>(node: U): T | undefined {
104
99
  if (node === undefined) {
105
- return undefined
100
+ return undefined;
106
101
  }
107
- return (new (classByEtsNode(node))(node as any)) as T
102
+ return new (classByEtsNode(node))(node as any) as T;
108
103
  }
109
104
 
110
- export function passNode<T extends arkts.AstNode>(node: ts.Node<T>): T
111
- export function passNode<T extends arkts.AstNode>(node: ts.Node<T> | undefined): T | undefined
105
+ export function passNode<T extends arkts.AstNode>(node: ts.Node<T>): T;
106
+ export function passNode<T extends arkts.AstNode>(node: ts.Node<T> | undefined): T | undefined;
112
107
  export function passNode<T extends arkts.AstNode>(node: ts.Node<T> | undefined): T | undefined {
113
108
  if (node === undefined) {
114
- return undefined
109
+ return undefined;
115
110
  }
116
- return (node.node as T) ?? throwError('trying to pass non-compatible node')
111
+ return (node.node as T) ?? throwError('trying to pass non-compatible node');
117
112
  }
118
113
 
119
- export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode> >(nodes: readonly U[]): ts.NodeArray<T>
120
- export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode> >(nodes: readonly U[] | undefined): ts.NodeArray<T> | undefined
121
- export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode> >(nodes: readonly U[] | undefined): ts.NodeArray<T> | undefined {
122
- return nodes?.map((node: U) => unpackNode(node)) as ReadonlyArray<ts.Node<arkts.AstNode> > as ts.NodeArray<T>
114
+ export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode>>(
115
+ nodes: readonly U[]
116
+ ): ts.NodeArray<T>;
117
+ export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode>>(
118
+ nodes: readonly U[] | undefined
119
+ ): ts.NodeArray<T> | undefined;
120
+ export function unpackNodeArray<U extends arkts.AstNode | undefined, T extends ts.Node<arkts.AstNode>>(
121
+ nodes: readonly U[] | undefined
122
+ ): ts.NodeArray<T> | undefined {
123
+ return nodes?.map((node: U) => unpackNode(node)) as ReadonlyArray<ts.Node<arkts.AstNode>> as ts.NodeArray<T>;
123
124
  }
124
125
 
125
- export function passNodeArray<T extends arkts.AstNode>(nodes: readonly ts.Node<T>[]): T[]
126
- export function passNodeArray<T extends arkts.AstNode>(nodes: readonly ts.Node<T>[] | undefined): T[] | undefined
126
+ export function passNodeArray<T extends arkts.AstNode>(nodes: readonly ts.Node<T>[]): T[];
127
+ export function passNodeArray<T extends arkts.AstNode>(nodes: readonly ts.Node<T>[] | undefined): T[] | undefined;
127
128
  export function passNodeArray<T extends arkts.AstNode>(nodes: readonly ts.Node<T>[] | undefined): T[] | undefined {
128
- return nodes?.map((node: ts.Node<T>) => passNode<T>(node))
129
+ return nodes?.map((node: ts.Node<T>) => passNode<T>(node));
129
130
  }
130
131
 
131
- export function passIdentifier(node: ts.Identifier | string, typeAnnotation?: ts.TypeNode): arkts.Identifier
132
- export function passIdentifier(node: ts.Identifier | string | undefined, typeAnnotation?: ts.TypeNode): arkts.Identifier | undefined
133
- export function passIdentifier(node: ts.Identifier | string | undefined, typeAnnotation?: ts.TypeNode): arkts.Identifier | undefined {
132
+ export function passIdentifier(node: ts.Identifier | string, typeAnnotation?: ts.TypeNode): arkts.Identifier;
133
+ export function passIdentifier(
134
+ node: ts.Identifier | string | undefined,
135
+ typeAnnotation?: ts.TypeNode
136
+ ): arkts.Identifier | undefined;
137
+ export function passIdentifier(
138
+ node: ts.Identifier | string | undefined,
139
+ typeAnnotation?: ts.TypeNode
140
+ ): arkts.Identifier | undefined {
134
141
  if (node === undefined) {
135
- return undefined
142
+ return undefined;
136
143
  }
137
144
  if (node instanceof ts.Identifier) {
138
145
  if (typeAnnotation === undefined) {
139
- return node.node
146
+ return node.node;
140
147
  }
141
- return arkts.Identifier.create(
142
- node.node.name,
143
- passNode(typeAnnotation)
144
- )
148
+ return arkts.Identifier.create(node.node.name, passNode(typeAnnotation));
145
149
  }
146
- return arkts.Identifier.create(
147
- node,
148
- passNode(typeAnnotation)
149
- )
150
+ return arkts.Identifier.create(node, passNode(typeAnnotation));
150
151
  }
151
152
 
152
153
  // Improve: support optional params
153
- export function passTypeParams(params: readonly ts.TypeParameterDeclaration[] | undefined): arkts.TSTypeParameterDeclaration | undefined {
154
+ export function passTypeParams(
155
+ params: readonly ts.TypeParameterDeclaration[] | undefined
156
+ ): arkts.TSTypeParameterDeclaration | undefined {
154
157
  if (params === undefined) {
155
- return undefined
158
+ return undefined;
156
159
  }
157
- return arkts.factory.createTypeParameterDeclaration(
158
- passNodeArray(params)
159
- )
160
+ return arkts.factory.createTypeParameterDeclaration(passNodeArray(params));
160
161
  }
161
162
 
162
163
  export function unpackModifiers(modifiers: KInt | undefined): ts.NodeArray<ts.Modifier> {
@@ -182,28 +183,30 @@ export function unpackModifiers(modifiers: KInt | undefined): ts.NodeArray<ts.Mo
182
183
  [Es2pandaModifierFlags.MODIFIER_FLAGS_OVERRIDE, SyntaxKind.OverrideKeyword],
183
184
  [Es2pandaModifierFlags.MODIFIER_FLAGS_READONLY, SyntaxKind.ReadonlyKeyword],
184
185
  [Es2pandaModifierFlags.MODIFIER_FLAGS_STATIC, SyntaxKind.StaticKeyword],
185
- ])
186
+ ]);
186
187
 
187
- const bits = function*(flags: KInt) {
188
- let bit: KInt = 1
188
+ const bits = function* (flags: KInt) {
189
+ let bit: KInt = 1;
189
190
  while (flags >= bit) {
190
- if ((flags & bit) > 0) {
191
- yield bit
192
- }
193
- bit <<= 1
191
+ if ((flags & bit) > 0) {
192
+ yield bit;
193
+ }
194
+ bit <<= 1;
194
195
  }
195
- }
196
+ };
196
197
  if (modifiers === undefined) {
197
- return [] as ReadonlyArray<ts.Modifier> as ts.NodeArray<ts.Modifier>
198
+ return [] as ReadonlyArray<ts.Modifier> as ts.NodeArray<ts.Modifier>;
198
199
  }
199
- let mods: ts.Modifier[] = []
200
+ let mods: ts.Modifier[] = [];
200
201
  for (const bit of bits(modifiers)) {
201
- mods.push(new ts.Modifier(translation.get(bit) ?? throwError(`Unsupported modifier: ${bit}`)))
202
+ mods.push(new ts.Modifier(translation.get(bit) ?? throwError(`Unsupported modifier: ${bit}`)));
202
203
  }
203
- return mods as ReadonlyArray<ts.Modifier> as ts.NodeArray<ts.Modifier>
204
+ return mods as ReadonlyArray<ts.Modifier> as ts.NodeArray<ts.Modifier>;
204
205
  }
205
206
 
206
- export function passModifiers(modifiers: ReadonlyArray<ts.Modifier | undefined | Es2pandaModifierFlags> | undefined): KInt {
207
+ export function passModifiers(
208
+ modifiers: ReadonlyArray<ts.Modifier | undefined | Es2pandaModifierFlags> | undefined
209
+ ): KInt {
207
210
  const translation = new Map<ts.ModifierSyntaxKind, Es2pandaModifierFlags>([
208
211
  // [SyntaxKind.UnknownKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_NONE],
209
212
  // [SyntaxKind.ConstructorKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_CONSTRUCTOR],
@@ -224,25 +227,22 @@ export function passModifiers(modifiers: ReadonlyArray<ts.Modifier | undefined |
224
227
  [SyntaxKind.OverrideKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_OVERRIDE],
225
228
  [SyntaxKind.ReadonlyKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_READONLY],
226
229
  [SyntaxKind.StaticKeyword, Es2pandaModifierFlags.MODIFIER_FLAGS_STATIC],
227
- ])
230
+ ]);
228
231
 
229
232
  if (modifiers === undefined) {
230
- return Es2pandaModifierFlags.MODIFIER_FLAGS_NONE
233
+ return Es2pandaModifierFlags.MODIFIER_FLAGS_NONE;
231
234
  }
232
235
  return modifiers
233
236
  .map((mod: ts.Modifier | undefined | Es2pandaModifierFlags) => {
234
237
  if (mod === undefined) {
235
- return Es2pandaModifierFlags.MODIFIER_FLAGS_NONE
238
+ return Es2pandaModifierFlags.MODIFIER_FLAGS_NONE;
236
239
  }
237
240
  if (typeof mod === 'object') {
238
- return translation.get(mod.kind) ?? throwError(`Unsupported modifier: ${mod.kind}`)
241
+ return translation.get(mod.kind) ?? throwError(`Unsupported modifier: ${mod.kind}`);
239
242
  }
240
- return mod
243
+ return mod;
241
244
  })
242
- .reduce(
243
- (prev, curr) => (prev | curr),
244
- Es2pandaModifierFlags.MODIFIER_FLAGS_NONE
245
- )
245
+ .reduce((prev, curr) => prev | curr, Es2pandaModifierFlags.MODIFIER_FLAGS_NONE);
246
246
  }
247
247
 
248
248
  export function passToken<TKind extends TokenSyntaxKind>(token: ts.Token<TKind>): KInt {
@@ -250,9 +250,9 @@ export function passToken<TKind extends TokenSyntaxKind>(token: ts.Token<TKind>)
250
250
  [SyntaxKind.PlusToken, Es2pandaTokenType.TOKEN_TYPE_PUNCTUATOR_PLUS],
251
251
  [SyntaxKind.MinusToken, Es2pandaTokenType.TOKEN_TYPE_PUNCTUATOR_MINUS],
252
252
  [SyntaxKind.AsteriskToken, Es2pandaTokenType.TOKEN_TYPE_PUNCTUATOR_MULTIPLY],
253
- ])
253
+ ]);
254
254
 
255
- return translation.get(token.kind) ?? throwError('unsupported token')
255
+ return translation.get(token.kind) ?? throwError('unsupported token');
256
256
  }
257
257
 
258
258
  export function passModifiersToScriptFunction(modifiers: readonly ts.Modifier[] | undefined): KInt {
@@ -260,12 +260,15 @@ export function passModifiersToScriptFunction(modifiers: readonly ts.Modifier[]
260
260
  [SyntaxKind.StaticKeyword, Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_STATIC_BLOCK],
261
261
  [SyntaxKind.AsyncKeyword, Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_ASYNC],
262
262
  [SyntaxKind.PublicKeyword, Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_NONE],
263
- ])
263
+ ]);
264
264
 
265
- return modifiers?.reduce(
266
- (prev, curr) => prev | (translation.get(curr.kind) ?? throwError(`Unsupported ScriptFunction flag: ${curr.kind}`)),
267
- Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_NONE
268
- ) ?? Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_NONE
265
+ return (
266
+ modifiers?.reduce(
267
+ (prev, curr) =>
268
+ prev | (translation.get(curr.kind) ?? throwError(`Unsupported ScriptFunction flag: ${curr.kind}`)),
269
+ Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_NONE
270
+ ) ?? Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_NONE
271
+ );
269
272
  }
270
273
 
271
274
  export function passVariableDeclarationKind(flags: NodeFlags): Es2pandaVariableDeclarationKind {
@@ -273,9 +276,9 @@ export function passVariableDeclarationKind(flags: NodeFlags): Es2pandaVariableD
273
276
  [NodeFlags.Const, Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_CONST],
274
277
  [NodeFlags.Let, Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_LET],
275
278
  [NodeFlags.None, Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_VAR],
276
- ])
279
+ ]);
277
280
 
278
- return translation.get(flags) ?? throwError('unsupported VariableDeclarationKind')
281
+ return translation.get(flags) ?? throwError('unsupported VariableDeclarationKind');
279
282
  }
280
283
 
281
284
  export function unpackVariableDeclarationKind(kind: Es2pandaVariableDeclarationKind): NodeFlags {
@@ -283,7 +286,7 @@ export function unpackVariableDeclarationKind(kind: Es2pandaVariableDeclarationK
283
286
  [Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_CONST, NodeFlags.Const],
284
287
  [Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_LET, NodeFlags.Let],
285
288
  [Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_VAR, NodeFlags.None],
286
- ])
289
+ ]);
287
290
 
288
- return translation.get(kind) ?? throwError('unsupported VariableDeclarationKind')
291
+ return translation.get(kind) ?? throwError('unsupported VariableDeclarationKind');
289
292
  }
@@ -13,43 +13,43 @@
13
13
  * limitations under the License.
14
14
  */
15
15
 
16
- import { global } from "../../arkts-api/static/global"
17
- import { throwError } from "../../utils"
18
- import * as ts from "../."
19
- import { KNativePointer, nullptr } from "@koalaui/interop"
20
- import { unpackNonNullableNode } from "../../arkts-api"
16
+ import { global } from '../../arkts-api/static/global';
17
+ import { throwError } from '../../utils';
18
+ import * as ts from '../.';
19
+ import { KNativePointer, nullptr } from '@koalaui/interop';
20
+ import { unpackNonNullableNode } from '../../arkts-api';
21
21
 
22
- export { proceedToState, startChecker } from "../../arkts-api"
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
- throwError('there is no arkts pair of ts node (unable to getDecl)')
27
+ throwError('there is no arkts pair of ts node (unable to getDecl)');
28
28
  }
29
- let decl: KNativePointer = node.node.peer
30
- decl = global.es2panda._AstNodeVariableConst(global.context, decl)
29
+ let decl: KNativePointer = node.node.peer;
30
+ decl = global.es2panda._AstNodeVariableConst(global.context, decl);
31
31
  if (decl === nullptr) {
32
- return undefined
32
+ return undefined;
33
33
  }
34
- decl = global.es2panda._VariableDeclaration(global.context, decl)
34
+ decl = global.es2panda._VariableDeclaration(global.context, decl);
35
35
  if (decl === nullptr) {
36
- return undefined
36
+ return undefined;
37
37
  }
38
- decl = global.es2panda._DeclNode(global.context, decl)
38
+ decl = global.es2panda._DeclNode(global.context, decl);
39
39
  if (decl === nullptr) {
40
- return undefined
40
+ return undefined;
41
41
  }
42
- return ts.unpackNode(unpackNonNullableNode(decl))
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
- throwError('there is no arkts pair of ts node (unable to getOriginalNode)')
49
+ throwError('there is no arkts pair of ts node (unable to getOriginalNode)');
50
50
  }
51
51
  if (node.node.originalPeer === nullptr) {
52
- return node
52
+ return node;
53
53
  }
54
- return ts.unpackNode(unpackNonNullableNode(node.node.originalPeer))
54
+ return ts.unpackNode(unpackNonNullableNode(node.node.originalPeer));
55
55
  }
@@ -13,31 +13,34 @@
13
13
  * limitations under the License.
14
14
  */
15
15
 
16
- import { throwError } from "../../utils"
16
+ import { throwError } from '../../utils';
17
17
 
18
- import * as ts from "../."
19
- import { factory } from "../factory/nodeFactory"
20
- import { SyntaxKind } from "../static/enums"
18
+ import * as ts from '../.';
19
+ import { factory } from '../factory/nodeFactory';
20
+ import { SyntaxKind } from '../static/enums';
21
21
 
22
- type Visitor = (node: ts.Node) => ts.Node
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
- return node
27
+ return node;
28
28
  }
29
- return visitor(node) as T
29
+ return visitor(node) as T;
30
30
  }
31
31
 
32
32
  // Improve: rethink (remove as)
33
- function nodesVisitor<T extends ts.Node, TIn extends ts.NodeArray<T> | undefined>(nodes: TIn, visitor: Visitor): T[] | TIn {
33
+ function nodesVisitor<T extends ts.Node, TIn extends ts.NodeArray<T> | undefined>(
34
+ nodes: TIn,
35
+ visitor: Visitor
36
+ ): T[] | TIn {
34
37
  if (nodes === undefined) {
35
- return nodes
38
+ return nodes;
36
39
  }
37
- return nodes.map(node => visitor(node) as T)
40
+ return nodes.map((node) => visitor(node) as T);
38
41
  }
39
42
 
40
- type VisitEachChildFunction<T extends ts.Node> = (node: T, visitor: Visitor) => T
43
+ type VisitEachChildFunction<T extends ts.Node> = (node: T, visitor: Visitor) => T;
41
44
 
42
45
  // Improve: add more nodes
43
46
  type HasChildren =
@@ -50,17 +53,14 @@ type HasChildren =
50
53
  | ts.MethodDeclaration
51
54
  | ts.Block
52
55
  | ts.VariableStatement
53
- | ts.VariableDeclarationList
56
+ | ts.VariableDeclarationList;
54
57
 
55
- type VisitEachChildTable = { [TNode in HasChildren as TNode["kind"]]: VisitEachChildFunction<TNode> }
58
+ type VisitEachChildTable = { [TNode in HasChildren as TNode['kind']]: VisitEachChildFunction<TNode> };
56
59
 
57
60
  // Improve: add more nodes
58
61
  const visitEachChildTable: VisitEachChildTable = {
59
62
  [SyntaxKind.SourceFile]: function (node: ts.SourceFile, visitor: Visitor) {
60
- return factory.updateSourceFile(
61
- node,
62
- nodesVisitor(node.statements, visitor)
63
- )
63
+ return factory.updateSourceFile(node, nodesVisitor(node.statements, visitor));
64
64
  },
65
65
  [SyntaxKind.FunctionDeclaration]: function (node: ts.FunctionDeclaration, visitor: Visitor) {
66
66
  return factory.updateFunctionDeclaration(
@@ -71,14 +71,11 @@ const visitEachChildTable: VisitEachChildTable = {
71
71
  nodesVisitor(node.typeParameters, visitor),
72
72
  nodesVisitor(node.parameters, visitor),
73
73
  nodeVisitor(node.type, visitor),
74
- nodeVisitor(node.body, visitor),
75
- )
74
+ nodeVisitor(node.body, visitor)
75
+ );
76
76
  },
77
77
  [SyntaxKind.ExpressionStatement]: function (node: ts.ExpressionStatement, visitor: Visitor) {
78
- return factory.updateExpressionStatement(
79
- node,
80
- nodeVisitor(node.expression, visitor)
81
- )
78
+ return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor));
82
79
  },
83
80
  [SyntaxKind.CallExpression]: function (node: ts.CallExpression, visitor: Visitor) {
84
81
  return factory.updateCallExpression(
@@ -86,14 +83,14 @@ const visitEachChildTable: VisitEachChildTable = {
86
83
  nodeVisitor(node.expression, visitor),
87
84
  undefined,
88
85
  nodesVisitor(node.arguments, visitor)
89
- )
86
+ );
90
87
  },
91
88
  [SyntaxKind.PropertyAccessExpression]: function (node: ts.PropertyAccessExpression, visitor: Visitor) {
92
89
  return factory.updatePropertyAccessExpression(
93
90
  node,
94
91
  nodeVisitor(node.expression, visitor),
95
92
  nodeVisitor(node.name, visitor)
96
- )
93
+ );
97
94
  },
98
95
  [SyntaxKind.ClassDeclaration]: function (node: ts.ClassDeclaration, visitor: Visitor) {
99
96
  return factory.updateClassDeclaration(
@@ -103,7 +100,7 @@ const visitEachChildTable: VisitEachChildTable = {
103
100
  undefined,
104
101
  undefined,
105
102
  nodesVisitor(node.members, visitor)
106
- )
103
+ );
107
104
  },
108
105
  [SyntaxKind.MethodDeclaration]: function (node: ts.MethodDeclaration, visitor: Visitor) {
109
106
  return factory.updateMethodDeclaration(
@@ -115,41 +112,28 @@ const visitEachChildTable: VisitEachChildTable = {
115
112
  undefined,
116
113
  nodesVisitor(node.parameters, visitor),
117
114
  undefined,
118
- nodeVisitor(node.body, visitor),
119
- )
115
+ nodeVisitor(node.body, visitor)
116
+ );
120
117
  },
121
118
  [SyntaxKind.Block]: function (node: ts.Block, visitor: Visitor) {
122
- return factory.updateBlock(
123
- node,
124
- nodesVisitor(node.statements, visitor),
125
- )
119
+ return factory.updateBlock(node, nodesVisitor(node.statements, visitor));
126
120
  },
127
121
  [SyntaxKind.VariableStatement]: function (node: ts.VariableStatement, visitor: Visitor) {
128
- return factory.updateVariableStatement(
129
- node,
130
- undefined,
131
- nodeVisitor(node.declarationList, visitor),
132
- )
122
+ return factory.updateVariableStatement(node, undefined, nodeVisitor(node.declarationList, visitor));
133
123
  },
134
124
  [SyntaxKind.VariableDeclarationList]: function (node: ts.VariableDeclarationList, visitor: Visitor) {
135
- return factory.updateVariableDeclarationList(
136
- node,
137
- nodesVisitor(node.declarations, visitor),
138
- )
125
+ return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor));
139
126
  },
140
- }
127
+ };
141
128
 
142
129
  function nodeHasChildren(node: ts.Node): node is HasChildren {
143
- return node.kind in visitEachChildTable
130
+ return node.kind in visitEachChildTable;
144
131
  }
145
132
 
146
- export function visitEachChild<T extends ts.Node>(
147
- node: T,
148
- visitor: Visitor
149
- ): T {
133
+ export function visitEachChild<T extends ts.Node>(node: T, visitor: Visitor): T {
150
134
  const visitFunc = (visitEachChildTable as Record<SyntaxKind, VisitEachChildFunction<any> | undefined>)[node.kind];
151
135
  if (nodeHasChildren(node) && visitFunc === undefined) {
152
- throwError('Unsupported node kind: ' + node.kind)
136
+ throwError('Unsupported node kind: ' + node.kind);
153
137
  }
154
- return (visitFunc === undefined) ? node : visitFunc(node, visitor);
138
+ return visitFunc === undefined ? node : visitFunc(node, visitor);
155
139
  }