@idlizer/arktscgen 2.1.5 → 2.1.9-arktscgen-4

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 (360) hide show
  1. package/build/libarkts-copy/generator/options.json5 +34 -0
  2. package/build/libarkts-copy/native/meson.build +128 -62
  3. package/build/libarkts-copy/native/meson_options.txt +19 -0
  4. package/build/libarkts-copy/native/src/bridges.cc +278 -15
  5. package/build/libarkts-copy/native/src/common.cc +212 -43
  6. package/build/libarkts-copy/native/src/common.h +95 -2
  7. package/build/libarkts-copy/native/src/generated/bridges.cc +2801 -466
  8. package/build/libarkts-copy/package.json +82 -62
  9. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +97 -3
  10. package/build/libarkts-copy/src/InteropNativeModule.ts +3 -1
  11. package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +1 -1
  12. package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +78 -0
  13. package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +131 -0
  14. package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +193 -0
  15. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +78 -0
  16. package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +89 -0
  17. package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +50 -0
  18. package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +44 -0
  19. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -3
  20. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +93 -10
  21. package/build/libarkts-copy/src/arkts-api/index.ts +13 -1
  22. package/build/libarkts-copy/src/arkts-api/node-cache.ts +8 -4
  23. package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationDeclaration.ts +32 -0
  24. package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +37 -0
  25. package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +26 -0
  26. package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +1 -1
  27. package/build/libarkts-copy/src/arkts-api/node-utilities/BinaryExpression.ts +37 -0
  28. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockExpression.ts +27 -0
  29. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +29 -0
  30. package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +2 -2
  31. package/build/libarkts-copy/src/arkts-api/node-utilities/ChainExpression.ts +27 -0
  32. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +54 -0
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +1 -1
  34. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +27 -4
  35. package/build/libarkts-copy/src/arkts-api/node-utilities/ConditionalExpression.ts +36 -0
  36. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
  37. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +3 -27
  38. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSNewClassInstanceExpression.ts +34 -0
  39. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +3 -9
  40. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSPrimitiveType.ts +28 -0
  41. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +1 -1
  42. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +1 -1
  43. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReference.ts +27 -0
  44. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReferencePart.ts +36 -0
  45. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUndefinedType.ts +24 -0
  46. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUnionType.ts +27 -0
  47. package/build/libarkts-copy/src/arkts-api/node-utilities/Identifier.ts +27 -0
  48. package/build/libarkts-copy/src/arkts-api/node-utilities/ImportSpecifier.ts +31 -0
  49. package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +1 -1
  50. package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +2 -2
  51. package/build/libarkts-copy/src/arkts-api/node-utilities/NullLiteral.ts +24 -0
  52. package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +2 -2
  53. package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
  54. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +40 -0
  55. package/build/libarkts-copy/src/arkts-api/node-utilities/ReturnStatement.ts +27 -0
  56. package/build/libarkts-copy/src/arkts-api/node-utilities/StringLiteral.ts +27 -0
  57. package/build/libarkts-copy/src/arkts-api/node-utilities/SuperExpression.ts +24 -0
  58. package/build/libarkts-copy/src/arkts-api/node-utilities/TSAsExpression.ts +36 -0
  59. package/build/libarkts-copy/src/arkts-api/node-utilities/TSClassImplements.ts +31 -0
  60. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceBody.ts +28 -0
  61. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +30 -10
  62. package/build/libarkts-copy/src/arkts-api/node-utilities/TSNonNullExpression.ts +27 -0
  63. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +10 -2
  64. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
  65. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterDeclaration.ts +31 -0
  66. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterInstantiation.ts +30 -0
  67. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +1 -1
  68. package/build/libarkts-copy/src/arkts-api/node-utilities/TemplateLiteral.ts +35 -0
  69. package/build/libarkts-copy/src/arkts-api/node-utilities/ThisExpression.ts +24 -0
  70. package/build/libarkts-copy/src/arkts-api/node-utilities/UndefinedLiteral.ts +24 -0
  71. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
  72. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +1 -1
  73. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +3 -1
  74. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +78 -15
  75. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +8 -1
  76. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +72 -6
  77. package/build/libarkts-copy/src/arkts-api/peers/{Program.ts → ExternalSource.ts} +3 -21
  78. package/build/libarkts-copy/src/arkts-api/peers/Options.ts +34 -0
  79. package/build/libarkts-copy/src/arkts-api/plugins.ts +62 -0
  80. package/build/libarkts-copy/src/arkts-api/static/global.ts +9 -5
  81. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +195 -23
  82. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +36 -10
  83. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +68 -20
  84. package/build/libarkts-copy/src/arkts-api/visitor.ts +162 -18
  85. package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +32 -0
  86. package/build/libarkts-copy/src/checkSdk.ts +25 -0
  87. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +448 -436
  88. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +775 -60
  89. package/build/libarkts-copy/src/generated/factory.ts +12 -15
  90. package/build/libarkts-copy/src/generated/index.ts +10 -3
  91. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +7 -1
  92. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +7 -1
  93. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +7 -1
  94. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +58 -6
  95. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +10 -4
  96. package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +75 -0
  97. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +11 -5
  98. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +40 -6
  99. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +9 -3
  100. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +11 -5
  101. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +7 -1
  102. package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +7 -1
  103. package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +7 -1
  104. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +9 -3
  105. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +9 -3
  106. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +9 -3
  107. package/build/libarkts-copy/src/generated/peers/BindingProps.ts +7 -1
  108. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +10 -4
  109. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +26 -7
  110. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +9 -3
  111. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +10 -4
  112. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +20 -3
  113. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +10 -4
  114. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +9 -3
  115. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +9 -3
  116. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +33 -4
  117. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +128 -42
  118. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +28 -4
  119. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +9 -3
  120. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +39 -5
  121. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +9 -3
  122. package/build/libarkts-copy/src/generated/peers/CodeGen.ts +7 -1
  123. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +9 -3
  124. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +10 -4
  125. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +9 -3
  126. package/build/libarkts-copy/src/generated/peers/Declaration.ts +7 -1
  127. package/build/libarkts-copy/src/generated/peers/Decorator.ts +9 -3
  128. package/build/libarkts-copy/src/generated/peers/{OverloadInfo.ts → DiagnosticInfo.ts} +8 -2
  129. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +9 -3
  130. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +9 -3
  131. package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +7 -1
  132. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +10 -4
  133. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +10 -4
  134. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +16 -5
  135. package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +10 -4
  136. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +59 -4
  137. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +10 -4
  138. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +11 -5
  139. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +11 -5
  140. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +10 -4
  141. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +10 -4
  142. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +46 -12
  143. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +10 -4
  144. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +7 -1
  145. package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +10 -4
  146. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +10 -4
  147. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +14 -8
  148. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +10 -4
  149. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +11 -5
  150. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +10 -4
  151. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +15 -4
  152. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +10 -4
  153. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +16 -4
  154. package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +7 -1
  155. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +9 -3
  156. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +9 -3
  157. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +18 -7
  158. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +26 -3
  159. package/build/libarkts-copy/src/generated/peers/Expression.ts +7 -1
  160. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +9 -3
  161. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +9 -3
  162. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +9 -3
  163. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +8 -2
  164. package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +7 -1
  165. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +44 -6
  166. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +10 -4
  167. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +7 -1
  168. package/build/libarkts-copy/src/generated/peers/IRNode.ts +7 -1
  169. package/build/libarkts-copy/src/generated/peers/Identifier.ts +16 -5
  170. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +14 -3
  171. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +28 -4
  172. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +9 -3
  173. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +9 -3
  174. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +9 -3
  175. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +7 -1
  176. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +9 -3
  177. package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +7 -1
  178. package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +7 -1
  179. package/build/libarkts-copy/src/generated/peers/LabelPair.ts +7 -1
  180. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +9 -3
  181. package/build/libarkts-copy/src/generated/peers/Literal.ts +15 -1
  182. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +7 -1
  183. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +7 -1
  184. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +9 -3
  185. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +9 -3
  186. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +26 -10
  187. package/build/libarkts-copy/src/generated/peers/NamedType.ts +9 -3
  188. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +9 -3
  189. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +9 -3
  190. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +12 -6
  191. package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +7 -1
  192. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +10 -4
  193. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +9 -3
  194. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +10 -4
  195. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +9 -3
  196. package/build/libarkts-copy/src/generated/peers/Program.ts +194 -0
  197. package/build/libarkts-copy/src/generated/peers/Property.ts +10 -4
  198. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +9 -3
  199. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +10 -4
  200. package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +7 -1
  201. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +77 -10
  202. package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +7 -1
  203. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +9 -3
  204. package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +7 -1
  205. package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +7 -1
  206. package/build/libarkts-copy/src/generated/peers/SourceRange.ts +7 -1
  207. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +10 -4
  208. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +46 -9
  209. package/build/libarkts-copy/src/generated/peers/Statement.ts +7 -1
  210. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +10 -4
  211. package/build/libarkts-copy/src/generated/peers/{ETSDynamicFunctionType.ts → SuggestionInfo.ts} +7 -5
  212. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +10 -4
  213. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +10 -4
  214. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +10 -4
  215. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +10 -4
  216. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +10 -4
  217. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +10 -4
  218. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +10 -4
  219. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +10 -4
  220. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +11 -5
  221. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +10 -4
  222. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +10 -4
  223. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +48 -6
  224. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +11 -5
  225. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +10 -4
  226. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +10 -4
  227. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +10 -4
  228. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +10 -4
  229. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +10 -4
  230. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +10 -4
  231. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +10 -4
  232. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +10 -4
  233. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +78 -8
  234. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +10 -4
  235. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +10 -4
  236. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +10 -4
  237. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +10 -4
  238. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +10 -4
  239. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +10 -4
  240. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +10 -4
  241. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +10 -4
  242. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +10 -4
  243. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +10 -4
  244. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +10 -4
  245. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +10 -4
  246. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +10 -4
  247. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +10 -4
  248. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +10 -4
  249. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +10 -4
  250. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +10 -4
  251. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +10 -4
  252. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +10 -4
  253. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +10 -4
  254. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +10 -4
  255. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +53 -6
  256. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +10 -4
  257. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +10 -4
  258. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +10 -4
  259. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +41 -7
  260. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +15 -4
  261. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +10 -4
  262. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +10 -4
  263. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +10 -4
  264. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +10 -4
  265. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +10 -4
  266. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +10 -4
  267. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +10 -4
  268. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +10 -4
  269. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +10 -4
  270. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +11 -5
  271. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +10 -4
  272. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +10 -4
  273. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +10 -4
  274. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +11 -5
  275. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +37 -3
  276. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +7 -1
  277. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +7 -1
  278. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +10 -4
  279. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +15 -4
  280. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +9 -3
  281. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +10 -4
  282. package/build/libarkts-copy/src/generated/peers/VReg.ts +7 -1
  283. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +7 -1
  284. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +48 -8
  285. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +11 -5
  286. package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +7 -1
  287. package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +7 -1
  288. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +15 -4
  289. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +10 -4
  290. package/build/libarkts-copy/src/index.ts +31 -1
  291. package/build/libarkts-copy/src/plugin-utils.ts +117 -0
  292. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +15 -0
  293. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +15 -0
  294. package/build/libarkts-copy/src/ts-api/types.ts +15 -0
  295. package/build/libarkts-copy/src/utils.ts +24 -41
  296. package/build/libarkts-copy/src/wrapper-compat/README.md +16 -0
  297. package/build/libarkts-copy/src/wrapper-compat/arkts-api/class-by-peer.ts +46 -0
  298. package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeFactory.ts +454 -0
  299. package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeTests.ts +99 -0
  300. package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +88 -0
  301. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +38 -0
  302. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +35 -0
  303. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +38 -0
  304. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +27 -0
  305. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +45 -0
  306. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +27 -0
  307. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +73 -0
  308. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +51 -0
  309. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +42 -0
  310. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +39 -0
  311. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +43 -0
  312. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +28 -0
  313. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +37 -0
  314. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +28 -0
  315. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +37 -0
  316. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +42 -0
  317. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +46 -0
  318. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +30 -0
  319. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +37 -0
  320. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +27 -0
  321. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +46 -0
  322. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +28 -0
  323. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +47 -0
  324. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +40 -0
  325. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +36 -0
  326. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +41 -0
  327. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +42 -0
  328. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +39 -0
  329. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +45 -0
  330. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/AstNode.ts +26 -0
  331. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +53 -0
  332. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +60 -0
  333. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +39 -0
  334. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +33 -0
  335. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +33 -0
  336. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +34 -0
  337. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +105 -0
  338. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +38 -0
  339. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +38 -0
  340. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +33 -0
  341. package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/global.ts +16 -0
  342. package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/globalUtils.ts +27 -0
  343. package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +108 -0
  344. package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +907 -0
  345. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +69 -0
  346. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/performance.ts +190 -0
  347. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +198 -0
  348. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +325 -0
  349. package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +421 -0
  350. package/build/libarkts-copy/src/wrapper-compat/index.ts +20 -0
  351. package/build/libarkts-copy/tsconfig.json +2 -1
  352. package/lib/index.js +1704 -273
  353. package/package.json +2 -2
  354. package/templates/Es2pandaEnums.ts +4 -0
  355. package/templates/Es2pandaNativeModule.ts +5 -1
  356. package/templates/factory.ts +5 -1
  357. package/templates/index.ts +5 -1
  358. package/templates/node-map.ts +5 -1
  359. package/templates/peer.ts +5 -1
  360. package/build/libarkts-copy/README.md +0 -36
@@ -1,63 +1,83 @@
1
1
  {
2
- "name": "@koalaui/libarkts",
3
- "version": "1.5.15+devel",
4
- "bin": "./lib/es2panda",
5
- "types": "./build/index.d.ts",
6
- "exports": {
7
- ".": "./lib/libarkts.js",
8
- "./plugins/*": "./lib/plugins/*.js"
9
- },
10
- "files": [
11
- "./lib/**/*",
12
- "./build/**/*",
13
- "./plugins/build/src/**/*"
14
- ],
15
- "config": {
16
- "gen_version": "3.8.0",
17
- "panda_sdk_path": "../../incremental/tools/panda/node_modules/@panda/sdk"
18
- },
19
- "dependencies": {
20
- "@koalaui/ets-tsc": "4.9.5-r5",
21
- "@koalaui/build-common": "1.5.15+devel",
22
- "@koalaui/compat": "1.5.15+devel",
23
- "@koalaui/common": "1.5.15+devel",
24
- "@koalaui/interop": "1.5.15+devel",
25
- "node-addon-api": "8.0.0",
26
- "node-api-headers": "0.0.5",
27
- "commander": "10.0.1"
28
- },
29
- "devDependencies": {
30
- "rollup": "^4.13.0",
31
- "@rollup/plugin-commonjs": "^26.0.1",
32
- "@rollup/plugin-node-resolve": "^15.3.0",
33
- "@rollup/plugin-terser": "^0.4.4",
34
- "@rollup/plugin-typescript": "^11.1.6"
35
- },
36
- "scripts": {
37
- "clean": "rimraf build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
38
- "clean:plugins": "rimraf plugins/build",
39
- "compile:koala:interop": "npm run --prefix ../../interop compile",
40
- "compile:meson": "cd native && meson setup build && meson compile -C build",
41
- "copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda.node ./build/native/build",
42
- "compile:native": "npm run compile:koala:interop && npm run compile:meson && npm run copy:.node",
43
- "compile:src": "npx ets-tsc -p ./tsconfig.json",
44
- "compile": "npm run compile:native && npm run compile:src && rollup -c rollup.lib.mjs && rollup -c rollup.es2panda.mjs",
45
- "compile:plugins": "npx rollup -c ./rollup.printer-plugin.mjs && npx rollup -c ./rollup.no-visitor-plugin.mjs ",
46
- "restart": "npx fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc --file-option --restart-stages && ninja -f build/abc/build.ninja",
47
- "direct": "PANDA_SDK_PATH=../../incremental/tools/panda/node_modules/@panda/sdk node . --file ./plugins/input/direct.ets --output ./build/abc/direct.abc --dump-plugin-ast --arktsconfig ./arktsconfig-direct.json && file build/abc/direct.abc",
48
- "memo": "PANDA_SDK_PATH=../../incremental/tools/panda/node_modules/@panda/sdk node . --file ./plugins/input/memo.ets --output ./build/abc/memo.abc --dump-plugin-ast --arktsconfig ./arktsconfig-memo.json --restart-stages",
49
- "run": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run restart",
50
- "run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run memo",
51
- "run:abc": "../../incremental/tools/panda/node_modules/@panda/sdk/linux_host_tools/bin/ark --load-runtimes=ets --boot-panda-files=../../incremental/tools/panda/node_modules/@panda/sdk/ets/etsstdlib.abc ./main.abc main.ETSGLOBAL::main",
52
- "mocha": "PANDA_SDK_PATH=../../incremental/tools/panda/node_modules/@panda/sdk TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
53
- "test": "npm run compile:native && npm run mocha",
54
- "compile:playground": "cd playground && meson setup build && meson compile -C build",
55
- "run:playground": "npm run compile:playground && ./playground/build/playground.out",
56
- "panda:sdk:clean": "cd ../../incremental/tools/panda && rimraf node_modules",
57
- "panda:sdk:install": "cd ../../incremental/tools/panda && npm run panda:sdk:install",
58
- "panda:sdk:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
59
- "regenerate:current": "npm run compile -C ../../../arktscgen && node ../../../arktscgen --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize --debug",
60
- "regenerate": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
61
- "reinstall:regenerate": "npm run panda:sdk:reinstall && npm run regenerate"
62
- }
63
- }
2
+ "name": "@koalaui/libarkts",
3
+ "version": "1.7.5+devel",
4
+ "bin": "./lib/es2panda",
5
+ "typesVersions": {
6
+ "*": {
7
+ "./compat/*": [
8
+ "./build/wrapper-compat/index.d.ts"
9
+ ],
10
+ "*": [
11
+ "./build/index.d.ts"
12
+ ]
13
+ }
14
+ },
15
+ "exports": {
16
+ ".": "./lib/libarkts.js",
17
+ "./compat": "./lib/libarkts-compat.js",
18
+ "./plugins/*": "./lib/plugins/*.js"
19
+ },
20
+ "files": [
21
+ "./lib/**/*",
22
+ "./build/**/*",
23
+ "./plugins/build/src/**/*"
24
+ ],
25
+ "config": {
26
+ "gen_version": "2.1.9-arktscgen-3",
27
+ "panda_sdk_path": "../../incremental/tools/panda/node_modules/@panda/sdk",
28
+ "ohos_panda_sdk_path": "../build/sdk",
29
+ "panda_sdk_version": "next"
30
+ },
31
+ "dependencies": {
32
+ "@koalaui/ets-tsc": "4.9.5-r5",
33
+ "@koalaui/build-common": "1.7.5+devel",
34
+ "@koalaui/compat": "1.7.5+devel",
35
+ "@koalaui/common": "1.7.5+devel",
36
+ "@koalaui/interop": "1.7.5+devel",
37
+ "node-addon-api": "8.0.0",
38
+ "node-api-headers": "0.0.5",
39
+ "commander": "10.0.1"
40
+ },
41
+ "devDependencies": {
42
+ "rollup": "^4.13.0",
43
+ "@rollup/plugin-commonjs": "^26.0.1",
44
+ "@rollup/plugin-node-resolve": "^15.3.0",
45
+ "@rollup/plugin-terser": "^0.4.4",
46
+ "@rollup/plugin-typescript": "^11.1.6"
47
+ },
48
+ "scripts": {
49
+ "clean": "rimraf build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
50
+ "clean:plugins": "rimraf plugins/build",
51
+ "compile:koala:interop": "npm run --prefix ../../interop compile",
52
+ "compile:meson": "cd native && meson setup build && meson compile -C build",
53
+ "crosscompile:meson": "cd native && CXX=clang++ meson setup -D cross_compile=true build && CXX=clang++ meson compile -C build",
54
+ "copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda_*.node ./build/native/build",
55
+ "compile:native": "npm run compile:koala:interop && npm run compile:meson && npm run copy:.node",
56
+ "crosscompile:native": "npm run compile:koala:interop && npm run crosscompile:meson && npm run copy:.node",
57
+ "compile:src": "npx ets-tsc -p ./tsconfig.json",
58
+ "compile": "npm run compile:native && npm run compile:js",
59
+ "compile:release": "npm run crosscompile:native && npm run compile:js",
60
+ "compile:js": "npm run compile:src && rollup -c rollup.lib.mjs && rollup -c rollup.es2panda.mjs",
61
+ "compile:gn": "npm run compile:koala:interop && npm run compile:js",
62
+ "compile:plugins": "npx rollup -c ./rollup.printer-plugin.mjs && npx rollup -c ./rollup.no-visitor-plugin.mjs ",
63
+ "restart": "node ../fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc --restart-stages && ninja -f build/abc/build.ninja",
64
+ "direct": "node ../fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc && ninja -f build/abc/build.ninja",
65
+ "run": "npm run compile && npm run compile:plugins && npm run direct",
66
+ "run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run memo",
67
+ "run:abc": "$npm_package_config_panda_sdk_path/linux_host_tools/bin/ark --load-runtimes=ets --boot-panda-files=$npm_package_config_panda_sdk_path/ets/etsstdlib.abc ./main.abc main.ETSGLOBAL::main",
68
+ "mocha": "PANDA_SDK_PATH=${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
69
+ "mocha:ohos": "PANDA_SDK_PATH=${PANDA_SDK_PATH:=$npm_package_config_ohos_panda_sdk_path} TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
70
+ "test:light": "npm run mocha",
71
+ "test": "npm run compile:native && npm run test:light",
72
+ "test:golden": "npm run compile:native && TEST_GOLDEN=1 npm run test:light",
73
+ "compile:playground": "cd playground && meson setup build && meson compile -C build",
74
+ "run:playground": "npm run compile:playground && ./playground/build/playground.out",
75
+ "panda:sdk:clean": "cd ../../incremental/tools/panda && rimraf node_modules",
76
+ "panda:sdk:install": "cd ../../incremental/tools/panda && echo \"Installing panda sdk $npm_package_config_panda_sdk_version\" && PANDA_SDK_VERSION=$npm_package_config_panda_sdk_version npm run panda:sdk:install",
77
+ "panda:sdk:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
78
+ "regenerate:current": "npm run compile -C ../../../arktscgen && node ../../../arktscgen --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize --debug",
79
+ "regenerate": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
80
+ "regenerate:ohos": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path ${PANDA_SDK_PATH:=$npm_package_config_ohos_panda_sdk_path} --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
81
+ "reinstall:regenerate": "npm run panda:sdk:reinstall && npm run regenerate"
82
+ }
83
+ }
@@ -22,10 +22,12 @@ import {
22
22
  loadNativeModuleLibrary,
23
23
  KDouble,
24
24
  KUInt,
25
+ KStringArrayPtr,
25
26
  } from "@koalaui/interop"
26
27
  import { Es2pandaNativeModule as GeneratedEs2pandaNativeModule, KNativePointerArray } from "./generated/Es2pandaNativeModule"
27
28
  import * as path from "path"
28
29
  import * as fs from "fs"
30
+ import { Es2pandaPluginDiagnosticType } from "./generated/Es2pandaEnums"
29
31
 
30
32
  // TODO: this type should be in interop
31
33
  export type KPtrArray = BigUint64Array
@@ -61,6 +63,24 @@ export class Es2pandaNativeModule {
61
63
  _CreateContextFromString(config: KPtr, source: String, filename: String): KPtr {
62
64
  throw new Error("Not implemented")
63
65
  }
66
+ _CreateContextFromFile(config: KPtr, filename: String): KPtr {
67
+ throw new Error("Not implemented")
68
+ }
69
+ _CreateCacheContextFromFile(config: KNativePointer, sourceFileName: String, globalContext: KNativePointer, isExternal: KBoolean): KNativePointer {
70
+ throw new Error("Not implemented");
71
+ }
72
+ _InsertGlobalStructInfo(context: KNativePointer, str: String): void {
73
+ throw new Error("Not implemented");
74
+ }
75
+ _HasGlobalStructInfo(context: KNativePointer, str: String): KBoolean {
76
+ throw new Error("Not implemented");
77
+ }
78
+ _CreateGlobalContext(config: KNativePointer, externalFileList: KStringArrayPtr, fileNum: KUInt, lspUsage: KBoolean): KNativePointer {
79
+ throw new Error("Not implemented");
80
+ }
81
+ _DestroyGlobalContext(context: KNativePointer): void {
82
+ throw new Error("Not implemented");
83
+ }
64
84
  _DestroyContext(context: KPtr): void {
65
85
  throw new Error("Not implemented")
66
86
  }
@@ -97,9 +117,15 @@ export class Es2pandaNativeModule {
97
117
  _DeclarationFromIdentifier(context: KPtr, identifier: KPtr): KPtr {
98
118
  throw new Error("Not implemented")
99
119
  }
120
+ _ProgramSourceFilePath(context: KNativePointer, instance: KNativePointer): KNativePointer {
121
+ throw new Error("Not implemented");
122
+ }
100
123
  _ProgramExternalSources(context: KNativePointer, instance: KNativePointer): KNativePointer {
101
124
  throw new Error("Not implemented");
102
125
  }
126
+ _ProgramDirectExternalSources(context: KNativePointer, instance: KNativePointer): KNativePointer {
127
+ throw new Error("Not implemented")
128
+ }
103
129
  _ExternalSourceName(instance: KNativePointer): KNativePointer {
104
130
  throw new Error("Not implemented");
105
131
  }
@@ -127,12 +153,79 @@ export class Es2pandaNativeModule {
127
153
  _SourcePositionLine(context: KNativePointer, instance: KNativePointer): KInt {
128
154
  throw new Error("Not implemented");
129
155
  }
156
+ _ConfigGetOptions(config: KNativePointer): KNativePointer {
157
+ throw new Error("Not implemented");
158
+ }
159
+ _OptionsArkTsConfig(context: KNativePointer, options: KNativePointer): KNativePointer {
160
+ throw new Error("Not implemented");
161
+ }
162
+
163
+ // From koala-wrapper
164
+ _ClassVariableDeclaration(context: KNativePointer, classInstance: KNativePointer): KNativePointer {
165
+ throw new Error("Not implemented")
166
+ }
167
+ _IsMethodDefinition(node: KPtr): KBoolean {
168
+ throw new Error("Not implemented")
169
+ }
170
+ _SourceRangeStart(context: KNativePointer, range: KNativePointer): KNativePointer {
171
+ throw new Error("Not implemented")
172
+ }
173
+ _SourceRangeEnd(context: KNativePointer, range: KNativePointer): KNativePointer {
174
+ throw new Error("Not implemented")
175
+ }
176
+ _CreateSourceRange(context: KNativePointer, start: KNativePointer, end: KNativePointer): KNativePointer {
177
+ throw new Error("Not implemented")
178
+ }
179
+ _IsArrayExpression(node: KPtr): KBoolean {
180
+ throw new Error("Not implemented")
181
+ }
182
+ _ETSParserGetGlobalProgramAbsName(context: KNativePointer): KNativePointer {
183
+ throw new Error("Not implemented")
184
+ }
185
+ _CreateDiagnosticKind(context: KNativePointer, message: string, type: Es2pandaPluginDiagnosticType): KNativePointer {
186
+ throw new Error("Not implemented")
187
+ }
188
+ _CreateDiagnosticInfo(context: KNativePointer, kind: KNativePointer, args: string[], argc: number): KNativePointer {
189
+ throw new Error("Not implemented")
190
+ }
191
+ _CreateSuggestionInfo(context: KNativePointer, kind: KNativePointer, args: string[],
192
+ argc: number, substitutionCode: string): KNativePointer {
193
+ throw new Error("Not implemented")
194
+ }
195
+ _LogDiagnostic(context: KNativePointer, kind: KNativePointer, argv: string[], argc: number, pos: KNativePointer): void {
196
+ throw new Error("Not implemented")
197
+ }
198
+ _LogDiagnosticWithSuggestion(context: KNativePointer, diagnosticInfo: KNativePointer,
199
+ suggestionInfo?: KNativePointer, range?: KNativePointer): void {
200
+ throw new Error("Not implemented")
201
+ }
202
+ _SetUpSoPath(soPath: string): void {
203
+ throw new Error("Not implemented")
204
+ }
205
+ _MemInitialize(): void {
206
+ throw new Error("Not implemented")
207
+ }
208
+ _MemFinalize(): void {
209
+ throw new Error("Not implemented")
210
+ }
211
+ _ProgramCanSkipPhases(context: KNativePointer, program: KNativePointer): boolean {
212
+ throw new Error("Not implemented")
213
+ }
214
+ _GenerateTsDeclarationsFromContext(config: KPtr, outputDeclEts: String, outputEts: String, exportAll: KBoolean, isolated: KBoolean): KPtr {
215
+ throw new Error("Not implemented")
216
+ }
217
+ _GenerateStaticDeclarationsFromContext(config: KPtr, outputPath: String): KPtr {
218
+ throw new Error("Not implemented")
219
+ }
220
+ _AstNodeProgram(context: KNativePointer, instance: KNativePointer): KNativePointer {
221
+ throw new Error("Not implemented")
222
+ }
130
223
  }
131
224
 
132
225
  export function findNativeModule(): string {
133
226
  const candidates = [
134
- path.resolve(__dirname, "../native/build/es2panda.node"),
135
- path.resolve(__dirname, "../build/native/build/es2panda.node"),
227
+ path.resolve(__dirname, "../native/build"),
228
+ path.resolve(__dirname, "../build/native/build"),
136
229
  ]
137
230
  let result = undefined
138
231
  candidates.forEach(path => {
@@ -141,7 +234,8 @@ export function findNativeModule(): string {
141
234
  return
142
235
  }
143
236
  })
144
- if (result) return result
237
+ if (result)
238
+ return path.join(result, "es2panda")
145
239
  throw new Error("Cannot find native module")
146
240
  }
147
241
 
@@ -19,7 +19,6 @@ import {
19
19
  registerNativeModuleLibraryName,
20
20
  loadNativeModuleLibrary
21
21
  } from "@koalaui/interop"
22
- import * as path from "path"
23
22
  import { findNativeModule } from "./Es2pandaNativeModule"
24
23
 
25
24
  export class InteropNativeModule {
@@ -32,6 +31,9 @@ export class InteropNativeModule {
32
31
  _GetStringFinalizer(): KPtr {
33
32
  throw new Error("Not implemented")
34
33
  }
34
+ _RawUtf8ToString(ptr: KPtr): string {
35
+ throw new Error("Not implemented")
36
+ }
35
37
  _InvokeFinalizer(ptr: KPtr, finalizer: KPtr): void {
36
38
  throw new Error("Not implemented")
37
39
  }
@@ -14,8 +14,8 @@
14
14
  */
15
15
 
16
16
  import { AstNode } from "./peers/AstNode"
17
- import { Program } from "./peers/Program"
18
17
  import { visitEachChild } from "./visitor"
18
+ import { Program } from "../generated"
19
19
 
20
20
  export interface VisitorOptions {
21
21
  program?: Program
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import { ChainExpression, Expression, isChainExpression, isMemberExpression, MemberExpression } from "src/generated";
17
+ import { AbstractVisitor } from "./AbstractVisitor";
18
+ import { AstNode } from "./peers/AstNode"
19
+ import { factory } from "./factory/nodeFactory";
20
+ import { Es2pandaTokenType, Es2pandaVariableDeclarationKind, Es2pandaVariableDeclaratorFlag } from "src/generated/Es2pandaEnums";
21
+
22
+
23
+ export class ChainExpressionFilter extends AbstractVisitor {
24
+ static counter = 0
25
+ transformChainExpression(node: ChainExpression): Expression {
26
+ const expression = node.expression
27
+ if (expression == undefined) return node
28
+ if (!isMemberExpression(expression)) return node
29
+ return this.transformMemberExpression(expression)
30
+ }
31
+ transformMemberExpression(expression: MemberExpression): Expression {
32
+ const temporaryVarName = `chaintmp%%_${ChainExpressionFilter.counter++}`
33
+ return factory.createBlockExpression(
34
+ [
35
+ factory.createVariableDeclaration(
36
+ Es2pandaVariableDeclarationKind.VARIABLE_DECLARATION_KIND_LET,
37
+ [
38
+ factory.createVariableDeclarator(
39
+ Es2pandaVariableDeclaratorFlag.VARIABLE_DECLARATOR_FLAG_LET,
40
+ factory.createIdentifier(temporaryVarName),
41
+ expression.object
42
+ )
43
+ ],
44
+ undefined
45
+ ),
46
+ factory.createExpressionStatement(
47
+ factory.createConditionalExpression(
48
+ factory.createBinaryExpression(
49
+ factory.createIdentifier(temporaryVarName, undefined),
50
+ factory.createUndefinedLiteral(),
51
+ Es2pandaTokenType.TOKEN_TYPE_PUNCTUATOR_STRICT_EQUAL
52
+ ),
53
+ factory.createUndefinedLiteral(),
54
+ factory.createMemberExpression(
55
+ factory.createIdentifier(temporaryVarName, undefined),
56
+ expression.property,
57
+ expression.kind,
58
+ expression.isComputed,
59
+ false
60
+ )
61
+ )
62
+ )
63
+ ]
64
+ )
65
+ }
66
+
67
+
68
+ visitor(beforeChildren: AstNode): AstNode {
69
+ const node = this.visitEachChild(beforeChildren)
70
+ if (isChainExpression(node)) {
71
+ return this.transformChainExpression(node)
72
+ }
73
+ if (isMemberExpression(node) && node.isOptional) {
74
+ return this.transformMemberExpression(node)
75
+ }
76
+ return node
77
+ }
78
+ }
@@ -0,0 +1,131 @@
1
+ /*
2
+ * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import { AnnotationUsage, ClassDefinition, ClassElement, Expression, isArrowFunctionExpression, isClassDefinition, isClassProperty, isETSFunctionType, isETSModule, isETSNewClassInstanceExpression, isScriptFunction, isTSEnumDeclaration, TSEnumDeclaration, TSEnumMember } from "src/generated";
17
+ import { AbstractVisitor } from "./AbstractVisitor";
18
+ import { AstNode } from "./peers/AstNode"
19
+ import { Es2pandaModifierFlags } from "src/generated/Es2pandaEnums";
20
+ import { factory } from "src/generated/factory";
21
+ import { arkts } from "src";
22
+ import { TypeAliasDeclaration } from "@koalaui/ets-tsc";
23
+
24
+ function filterAnnotations(annotations: AnnotationUsage[]): AnnotationUsage[] {
25
+ return annotations.filter(it => it.baseName?.name != "OptionalParametersAnnotation")
26
+ }
27
+
28
+ export abstract class ContextAwareVisitor extends AbstractVisitor {
29
+ private contextStack: ('global' | 'namespace')[] = ['global']
30
+ protected get context() {
31
+ return this.contextStack.at(-1)!
32
+ }
33
+ private enter(node:AstNode): () => void {
34
+ if (isETSModule(node) && node.ident?.name !== 'ETSGLOBAL') {
35
+ this.contextStack.push('namespace')
36
+ return () => this.contextStack.pop()
37
+ }
38
+ if (isClassDefinition(node) && node.isNamespaceTransformed && node.ident?.name !== 'ETSGLOBAL') {
39
+ this.contextStack.push('namespace')
40
+ return () => this.contextStack.pop()
41
+ }
42
+ return () => {}
43
+ }
44
+
45
+ visitEachChild(node: AstNode, options?: object): AstNode {
46
+ const leave = this.enter(node)
47
+ const r = super.visitEachChild(node, options)
48
+ leave()
49
+ return r
50
+ }
51
+ }
52
+
53
+ export class CheckedBackFilter extends ContextAwareVisitor {
54
+ transformInitializer(node: Expression|undefined): Expression|undefined {
55
+ if (node == undefined) return undefined
56
+ if (!isETSNewClassInstanceExpression(node)) return node
57
+ return node.arguments[1]
58
+ }
59
+ transformEnum(node: ClassDefinition): AstNode {
60
+ return TSEnumDeclaration.createTSEnumDeclaration(
61
+ node.ident,
62
+ node.body.map(it => {
63
+ const member: ClassElement = it as ClassElement
64
+ if (!isClassProperty(member)) return undefined
65
+ if (isClassProperty(member) && member.id?.name.startsWith("#")) return undefined
66
+ return factory.createTSEnumMember(
67
+ member.key,
68
+ this.transformInitializer(member.value),
69
+ false
70
+ )
71
+ }).filter(it => it != undefined) as TSEnumMember[],
72
+ false,
73
+ false,
74
+ !!(node.modifierFlags & Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE) && this.context !== 'namespace'
75
+ )
76
+ }
77
+ transformScopedClass(node:ClassDefinition): ClassDefinition {
78
+ return ClassDefinition.createClassDefinition(
79
+ node.ident,
80
+ node.typeParams,
81
+ node.superTypeParams,
82
+ node.implements,
83
+ node.ctor,
84
+ node.super,
85
+ node.body,
86
+ node.modifiers,
87
+ this.context === 'namespace'
88
+ ? node.modifierFlags & (~Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE)
89
+ : node.modifierFlags
90
+ )
91
+ }
92
+ transformScopedEnum(node:TSEnumDeclaration): TSEnumDeclaration {
93
+ return TSEnumDeclaration.createTSEnumDeclaration(
94
+ node.key,
95
+ node.members,
96
+ node.isConst,
97
+ false,
98
+ !!(node.modifierFlags & Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE) && this.context !== 'namespace'
99
+ )
100
+ }
101
+ visitor(beforeChildren: AstNode): AstNode {
102
+ const node = this.visitEachChild(beforeChildren)
103
+ if (isTSEnumDeclaration(node)) {
104
+ return this.transformScopedEnum(node)
105
+ }
106
+ if (isClassDefinition(node)) {
107
+ if (node.isEnumTransformed) {
108
+ return this.transformEnum(node)
109
+ } else {
110
+ const transformed = this.context === 'namespace'
111
+ ? this.transformScopedClass(node)
112
+ : node
113
+ return transformed.setAnnotations(filterAnnotations([...node.annotations]))
114
+ }
115
+ }
116
+ if (isClassProperty(node)) {
117
+ return node.setAnnotations(filterAnnotations([...node.annotations]))
118
+ }
119
+ if (isArrowFunctionExpression(node)) {
120
+ return node.setAnnotations(filterAnnotations([...node.annotations]))
121
+ }
122
+ if (isETSFunctionType(node)) {
123
+ return node.setAnnotations(filterAnnotations([...node.annotations]))
124
+ }
125
+ if (isScriptFunction(node)) {
126
+ return node.setAnnotations(filterAnnotations([...node.annotations]))
127
+ }
128
+
129
+ return node
130
+ }
131
+ }