@idlizer/arktscgen 2.1.7 → 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 (354) hide show
  1. package/build/libarkts-copy/generator/options.json5 +34 -0
  2. package/build/libarkts-copy/native/meson.build +128 -75
  3. package/build/libarkts-copy/native/meson_options.txt +6 -0
  4. package/build/libarkts-copy/native/src/bridges.cc +271 -8
  5. package/build/libarkts-copy/native/src/common.cc +166 -45
  6. package/build/libarkts-copy/native/src/common.h +53 -8
  7. package/build/libarkts-copy/native/src/generated/bridges.cc +2654 -319
  8. package/build/libarkts-copy/package.json +31 -17
  9. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +97 -3
  10. package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +1 -1
  11. package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +78 -0
  12. package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +86 -8
  13. package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +193 -0
  14. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +78 -0
  15. package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +89 -0
  16. package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +50 -0
  17. package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +10 -17
  18. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -3
  19. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +89 -6
  20. package/build/libarkts-copy/src/arkts-api/index.ts +10 -1
  21. package/build/libarkts-copy/src/arkts-api/node-cache.ts +8 -4
  22. package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationDeclaration.ts +32 -0
  23. package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +37 -0
  24. package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +26 -0
  25. package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +1 -1
  26. package/build/libarkts-copy/src/arkts-api/node-utilities/BinaryExpression.ts +37 -0
  27. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockExpression.ts +27 -0
  28. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +29 -0
  29. package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +2 -2
  30. package/build/libarkts-copy/src/arkts-api/node-utilities/ChainExpression.ts +27 -0
  31. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +54 -0
  32. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +1 -1
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +3 -3
  34. package/build/libarkts-copy/src/arkts-api/node-utilities/ConditionalExpression.ts +36 -0
  35. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
  36. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +3 -33
  37. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSNewClassInstanceExpression.ts +34 -0
  38. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +3 -9
  39. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSPrimitiveType.ts +28 -0
  40. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +1 -1
  41. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +1 -1
  42. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReference.ts +27 -0
  43. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReferencePart.ts +36 -0
  44. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUndefinedType.ts +24 -0
  45. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUnionType.ts +27 -0
  46. package/build/libarkts-copy/src/arkts-api/node-utilities/Identifier.ts +27 -0
  47. package/build/libarkts-copy/src/arkts-api/node-utilities/ImportSpecifier.ts +31 -0
  48. package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +1 -1
  49. package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +2 -2
  50. package/build/libarkts-copy/src/arkts-api/node-utilities/NullLiteral.ts +24 -0
  51. package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +2 -2
  52. package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
  53. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +40 -0
  54. package/build/libarkts-copy/src/arkts-api/node-utilities/ReturnStatement.ts +27 -0
  55. package/build/libarkts-copy/src/arkts-api/node-utilities/StringLiteral.ts +27 -0
  56. package/build/libarkts-copy/src/arkts-api/node-utilities/SuperExpression.ts +24 -0
  57. package/build/libarkts-copy/src/arkts-api/node-utilities/TSAsExpression.ts +36 -0
  58. package/build/libarkts-copy/src/arkts-api/node-utilities/TSClassImplements.ts +31 -0
  59. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceBody.ts +28 -0
  60. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +2 -2
  61. package/build/libarkts-copy/src/arkts-api/node-utilities/TSNonNullExpression.ts +27 -0
  62. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
  63. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterDeclaration.ts +31 -0
  64. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterInstantiation.ts +30 -0
  65. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +1 -1
  66. package/build/libarkts-copy/src/arkts-api/node-utilities/TemplateLiteral.ts +35 -0
  67. package/build/libarkts-copy/src/arkts-api/node-utilities/ThisExpression.ts +24 -0
  68. package/build/libarkts-copy/src/arkts-api/node-utilities/UndefinedLiteral.ts +24 -0
  69. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
  70. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +1 -1
  71. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +3 -1
  72. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +75 -12
  73. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +8 -1
  74. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +71 -4
  75. package/build/libarkts-copy/src/arkts-api/peers/{Program.ts → ExternalSource.ts} +2 -22
  76. package/build/libarkts-copy/src/arkts-api/peers/Options.ts +34 -0
  77. package/build/libarkts-copy/src/arkts-api/plugins.ts +26 -12
  78. package/build/libarkts-copy/src/arkts-api/static/global.ts +7 -4
  79. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +180 -23
  80. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +32 -8
  81. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +54 -12
  82. package/build/libarkts-copy/src/arkts-api/visitor.ts +32 -37
  83. package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +32 -0
  84. package/build/libarkts-copy/src/checkSdk.ts +25 -0
  85. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +448 -436
  86. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +778 -63
  87. package/build/libarkts-copy/src/generated/factory.ts +12 -15
  88. package/build/libarkts-copy/src/generated/index.ts +10 -3
  89. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +7 -1
  90. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +7 -1
  91. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +7 -1
  92. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +58 -6
  93. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +10 -4
  94. package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +75 -0
  95. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +11 -5
  96. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +40 -6
  97. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +9 -3
  98. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +11 -5
  99. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +7 -1
  100. package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +7 -1
  101. package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +7 -1
  102. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +9 -3
  103. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +9 -3
  104. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +9 -3
  105. package/build/libarkts-copy/src/generated/peers/BindingProps.ts +7 -1
  106. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +10 -4
  107. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +26 -7
  108. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +9 -3
  109. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +10 -4
  110. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +20 -3
  111. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +10 -4
  112. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +9 -3
  113. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +9 -3
  114. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +33 -4
  115. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +128 -42
  116. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +28 -4
  117. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +9 -3
  118. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +39 -5
  119. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +9 -3
  120. package/build/libarkts-copy/src/generated/peers/CodeGen.ts +7 -1
  121. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +9 -3
  122. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +10 -4
  123. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +9 -3
  124. package/build/libarkts-copy/src/generated/peers/Declaration.ts +7 -1
  125. package/build/libarkts-copy/src/generated/peers/Decorator.ts +9 -3
  126. package/build/libarkts-copy/src/generated/peers/{OverloadInfo.ts → DiagnosticInfo.ts} +8 -2
  127. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +9 -3
  128. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +9 -3
  129. package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +7 -1
  130. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +10 -4
  131. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +10 -4
  132. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +16 -5
  133. package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +10 -4
  134. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +59 -4
  135. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +10 -4
  136. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +11 -5
  137. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +11 -5
  138. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +10 -4
  139. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +10 -4
  140. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +46 -12
  141. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +10 -4
  142. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +7 -1
  143. package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +10 -4
  144. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +10 -4
  145. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +14 -8
  146. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +10 -4
  147. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +11 -5
  148. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +10 -4
  149. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +15 -4
  150. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +10 -4
  151. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +16 -4
  152. package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +7 -1
  153. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +9 -3
  154. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +9 -3
  155. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +18 -7
  156. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +26 -3
  157. package/build/libarkts-copy/src/generated/peers/Expression.ts +7 -1
  158. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +9 -3
  159. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +9 -3
  160. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +9 -3
  161. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +8 -2
  162. package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +7 -1
  163. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +44 -6
  164. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +10 -4
  165. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +7 -1
  166. package/build/libarkts-copy/src/generated/peers/IRNode.ts +7 -1
  167. package/build/libarkts-copy/src/generated/peers/Identifier.ts +16 -5
  168. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +14 -3
  169. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +28 -4
  170. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +9 -3
  171. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +9 -3
  172. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +9 -3
  173. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +7 -1
  174. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +9 -3
  175. package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +7 -1
  176. package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +7 -1
  177. package/build/libarkts-copy/src/generated/peers/LabelPair.ts +7 -1
  178. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +9 -3
  179. package/build/libarkts-copy/src/generated/peers/Literal.ts +15 -1
  180. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +7 -1
  181. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +7 -1
  182. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +9 -3
  183. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +9 -3
  184. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +26 -10
  185. package/build/libarkts-copy/src/generated/peers/NamedType.ts +9 -3
  186. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +9 -3
  187. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +9 -3
  188. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +15 -9
  189. package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +7 -1
  190. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +10 -4
  191. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +9 -3
  192. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +10 -4
  193. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +9 -3
  194. package/build/libarkts-copy/src/generated/peers/Program.ts +194 -0
  195. package/build/libarkts-copy/src/generated/peers/Property.ts +10 -4
  196. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +9 -3
  197. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +10 -4
  198. package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +7 -1
  199. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +77 -10
  200. package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +7 -1
  201. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +9 -3
  202. package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +7 -1
  203. package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +7 -1
  204. package/build/libarkts-copy/src/generated/peers/SourceRange.ts +7 -1
  205. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +10 -4
  206. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +46 -9
  207. package/build/libarkts-copy/src/generated/peers/Statement.ts +7 -1
  208. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +10 -4
  209. package/build/libarkts-copy/src/generated/peers/{ETSDynamicFunctionType.ts → SuggestionInfo.ts} +7 -5
  210. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +10 -4
  211. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +10 -4
  212. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +10 -4
  213. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +10 -4
  214. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +10 -4
  215. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +10 -4
  216. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +10 -4
  217. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +10 -4
  218. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +11 -5
  219. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +10 -4
  220. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +10 -4
  221. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +48 -6
  222. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +11 -5
  223. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +10 -4
  224. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +10 -4
  225. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +10 -4
  226. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +10 -4
  227. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +10 -4
  228. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +10 -4
  229. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +10 -4
  230. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +10 -4
  231. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +78 -8
  232. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +10 -4
  233. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +10 -4
  234. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +10 -4
  235. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +10 -4
  236. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +10 -4
  237. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +10 -4
  238. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +10 -4
  239. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +10 -4
  240. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +10 -4
  241. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +10 -4
  242. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +10 -4
  243. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +10 -4
  244. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +10 -4
  245. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +10 -4
  246. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +10 -4
  247. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +10 -4
  248. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +10 -4
  249. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +10 -4
  250. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +10 -4
  251. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +10 -4
  252. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +10 -4
  253. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +53 -6
  254. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +10 -4
  255. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +10 -4
  256. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +10 -4
  257. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +41 -7
  258. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +15 -4
  259. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +10 -4
  260. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +10 -4
  261. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +10 -4
  262. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +10 -4
  263. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +10 -4
  264. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +10 -4
  265. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +10 -4
  266. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +10 -4
  267. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +10 -4
  268. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +11 -5
  269. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +10 -4
  270. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +10 -4
  271. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +10 -4
  272. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +11 -5
  273. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +37 -3
  274. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +7 -1
  275. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +7 -1
  276. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +10 -4
  277. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +15 -4
  278. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +9 -3
  279. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +10 -4
  280. package/build/libarkts-copy/src/generated/peers/VReg.ts +7 -1
  281. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +7 -1
  282. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +48 -8
  283. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +11 -5
  284. package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +7 -1
  285. package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +7 -1
  286. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +15 -4
  287. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +10 -4
  288. package/build/libarkts-copy/src/index.ts +13 -1
  289. package/build/libarkts-copy/src/plugin-utils.ts +117 -0
  290. package/build/libarkts-copy/src/utils.ts +17 -28
  291. package/build/libarkts-copy/src/wrapper-compat/README.md +16 -0
  292. package/build/libarkts-copy/src/wrapper-compat/arkts-api/class-by-peer.ts +46 -0
  293. package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeFactory.ts +454 -0
  294. package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeTests.ts +99 -0
  295. package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +88 -0
  296. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +38 -0
  297. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +35 -0
  298. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +38 -0
  299. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +27 -0
  300. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +45 -0
  301. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +27 -0
  302. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +73 -0
  303. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +51 -0
  304. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +42 -0
  305. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +39 -0
  306. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +43 -0
  307. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +28 -0
  308. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +37 -0
  309. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +28 -0
  310. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +37 -0
  311. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +42 -0
  312. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +46 -0
  313. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +30 -0
  314. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +37 -0
  315. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +27 -0
  316. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +46 -0
  317. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +28 -0
  318. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +47 -0
  319. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +40 -0
  320. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +36 -0
  321. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +41 -0
  322. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +42 -0
  323. package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +39 -0
  324. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +45 -0
  325. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/AstNode.ts +26 -0
  326. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +53 -0
  327. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +60 -0
  328. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +39 -0
  329. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +33 -0
  330. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +33 -0
  331. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +34 -0
  332. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +105 -0
  333. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +38 -0
  334. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +38 -0
  335. package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +33 -0
  336. package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/global.ts +16 -0
  337. package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/globalUtils.ts +27 -0
  338. package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +108 -0
  339. package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +907 -0
  340. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +69 -0
  341. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/performance.ts +190 -0
  342. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +198 -0
  343. package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +325 -0
  344. package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +421 -0
  345. package/build/libarkts-copy/src/wrapper-compat/index.ts +20 -0
  346. package/lib/index.js +323 -148
  347. package/package.json +2 -2
  348. package/templates/Es2pandaEnums.ts +4 -0
  349. package/templates/Es2pandaNativeModule.ts +5 -1
  350. package/templates/factory.ts +5 -1
  351. package/templates/index.ts +5 -1
  352. package/templates/node-map.ts +5 -1
  353. package/templates/peer.ts +5 -1
  354. package/build/libarkts-copy/README.md +0 -36
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "@koalaui/libarkts",
3
- "version": "1.7.1+devel",
3
+ "version": "1.7.5+devel",
4
4
  "bin": "./lib/es2panda",
5
- "types": "./build/index.d.ts",
5
+ "typesVersions": {
6
+ "*": {
7
+ "./compat/*": [
8
+ "./build/wrapper-compat/index.d.ts"
9
+ ],
10
+ "*": [
11
+ "./build/index.d.ts"
12
+ ]
13
+ }
14
+ },
6
15
  "exports": {
7
16
  ".": "./lib/libarkts.js",
17
+ "./compat": "./lib/libarkts-compat.js",
8
18
  "./plugins/*": "./lib/plugins/*.js"
9
19
  },
10
20
  "files": [
@@ -13,17 +23,17 @@
13
23
  "./plugins/build/src/**/*"
14
24
  ],
15
25
  "config": {
16
- "gen_version": "2.1.7",
26
+ "gen_version": "2.1.9-arktscgen-3",
17
27
  "panda_sdk_path": "../../incremental/tools/panda/node_modules/@panda/sdk",
18
28
  "ohos_panda_sdk_path": "../build/sdk",
19
- "panda_sdk_version": "1.5.0-dev.31052"
29
+ "panda_sdk_version": "next"
20
30
  },
21
31
  "dependencies": {
22
32
  "@koalaui/ets-tsc": "4.9.5-r5",
23
- "@koalaui/build-common": "1.7.1+devel",
24
- "@koalaui/compat": "1.7.1+devel",
25
- "@koalaui/common": "1.7.1+devel",
26
- "@koalaui/interop": "1.7.1+devel",
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",
27
37
  "node-addon-api": "8.0.0",
28
38
  "node-api-headers": "0.0.5",
29
39
  "commander": "10.0.1"
@@ -40,10 +50,13 @@
40
50
  "clean:plugins": "rimraf plugins/build",
41
51
  "compile:koala:interop": "npm run --prefix ../../interop compile",
42
52
  "compile:meson": "cd native && meson setup build && meson compile -C build",
43
- "copy:.node": "mkdir -p ./build/native/build && cp ./native/build/es2panda.node ./build/native/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",
44
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",
45
57
  "compile:src": "npx ets-tsc -p ./tsconfig.json",
46
58
  "compile": "npm run compile:native && npm run compile:js",
59
+ "compile:release": "npm run crosscompile:native && npm run compile:js",
47
60
  "compile:js": "npm run compile:src && rollup -c rollup.lib.mjs && rollup -c rollup.es2panda.mjs",
48
61
  "compile:gn": "npm run compile:koala:interop && npm run compile:js",
49
62
  "compile:plugins": "npx rollup -c ./rollup.printer-plugin.mjs && npx rollup -c ./rollup.no-visitor-plugin.mjs ",
@@ -51,19 +64,20 @@
51
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",
52
65
  "run": "npm run compile && npm run compile:plugins && npm run direct",
53
66
  "run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run memo",
54
- "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",
55
- "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",
56
- "mocha:ohos": "PANDA_SDK_PATH=../build/sdk TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
57
- "test": "npm run compile:native && npm run mocha",
58
- "test:golden": "npm run compile:native && TEST_GOLDEN=1 npm run mocha",
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",
59
73
  "compile:playground": "cd playground && meson setup build && meson compile -C build",
60
74
  "run:playground": "npm run compile:playground && ./playground/build/playground.out",
61
75
  "panda:sdk:clean": "cd ../../incremental/tools/panda && rimraf node_modules",
62
- "panda:sdk:install": "cd ../../incremental/tools/panda && PANDA_SDK_VERSION=$npm_package_config_panda_sdk_version npm run panda:sdk:install && npm run panda:patch",
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",
63
77
  "panda:sdk:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
64
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",
65
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",
66
- "regenerate:ohos": "npx --yes @idlizer/arktscgen@$npm_package_config_gen_version --panda-sdk-path $npm_package_config_ohos_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",
67
81
  "reinstall:regenerate": "npm run panda:sdk:reinstall && npm run regenerate"
68
82
  }
69
- }
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
 
@@ -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
+ }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
2
+ * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License.
5
5
  * You may obtain a copy of the License at
@@ -13,16 +13,47 @@
13
13
  * limitations under the License.
14
14
  */
15
15
 
16
- import { ClassDefinition, ClassElement, ClassProperty, Es2pandaModifierFlags, Expression, TSEnumDeclaration, TSEnumMember, asString, factory, isCallExpression, isClassDeclaration, isClassDefinition, isClassProperty, isETSNewClassInstanceExpression } from "./index";
16
+ import { AnnotationUsage, ClassDefinition, ClassElement, Expression, isArrowFunctionExpression, isClassDefinition, isClassProperty, isETSFunctionType, isETSModule, isETSNewClassInstanceExpression, isScriptFunction, isTSEnumDeclaration, TSEnumDeclaration, TSEnumMember } from "src/generated";
17
17
  import { AbstractVisitor } from "./AbstractVisitor";
18
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";
19
23
 
24
+ function filterAnnotations(annotations: AnnotationUsage[]): AnnotationUsage[] {
25
+ return annotations.filter(it => it.baseName?.name != "OptionalParametersAnnotation")
26
+ }
20
27
 
21
- export class CheckedBackFilter extends AbstractVisitor {
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 {
22
54
  transformInitializer(node: Expression|undefined): Expression|undefined {
23
55
  if (node == undefined) return undefined
24
56
  if (!isETSNewClassInstanceExpression(node)) return node
25
- // new ZZZ(ordinal, value) !-> value
26
57
  return node.arguments[1]
27
58
  }
28
59
  transformEnum(node: ClassDefinition): AstNode {
@@ -40,14 +71,61 @@ export class CheckedBackFilter extends AbstractVisitor {
40
71
  }).filter(it => it != undefined) as TSEnumMember[],
41
72
  false,
42
73
  false,
43
- !!(node.modifierFlags & Es2pandaModifierFlags.MODIFIER_FLAGS_DECLARE)
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'
44
99
  )
45
100
  }
46
101
  visitor(beforeChildren: AstNode): AstNode {
47
102
  const node = this.visitEachChild(beforeChildren)
48
- if (isClassDefinition(node) && node.isEnumTransformed) {
49
- return this.transformEnum(node)
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
+ }
50
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
+
51
129
  return node
52
130
  }
53
- }
131
+ }
@@ -0,0 +1,193 @@
1
+ /*
2
+ * Copyright (c) 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 { Config } from "./peers/Config"
17
+ import { CompilationOptions, PluginContextImpl, ProgramTransformer } from "./plugins"
18
+ import { findStdlib, proceedToState, recheckContext } from "./utilities/public"
19
+ import { global } from "./static/global"
20
+ import { passString, passStringArray } from "./utilities/private"
21
+ import { Context } from "./peers/Context"
22
+ import { Es2pandaContextState } from "../generated/Es2pandaEnums"
23
+ import { Program } from "../generated"
24
+ import { runTransformerOnProgram } from "../plugin-utils"
25
+ import { ProgramProvider } from "./ProgramProvider"
26
+ import { Options } from "./peers/Options"
27
+
28
+ export interface ProgramInfo {
29
+ /**
30
+ * Input to compile (absolute file path)
31
+ */
32
+ absoluteName: string
33
+ /**
34
+ * Location of output (undefined for external sources)
35
+ */
36
+ output: string | undefined
37
+ }
38
+
39
+ export function getProgramsForPluginApplication(
40
+ programs: ProgramInfo[],
41
+ ) {
42
+ const programsForCodeGeneration = programs
43
+ .filter(it => it.output != undefined)
44
+ .map(it => it.absoluteName)
45
+ // Generally, it would be ok to return just the list above,
46
+ // but for experimental purpose let's filter programs that
47
+ // are mentioned as both codegeneration and caching
48
+ const programsForCaching = new Set(
49
+ programs
50
+ .filter(it => it.output == undefined)
51
+ .map(it => it.absoluteName)
52
+ )
53
+ return programsForCodeGeneration.filter(it => !programsForCaching.has(it))
54
+ }
55
+
56
+ export function compileWithCache(
57
+ configPath: string,
58
+ orderedPrograms: ProgramInfo[],
59
+ parsedPlugins: ProgramTransformer[] | undefined,
60
+ checkedPlugins: ProgramTransformer[] | undefined,
61
+ ) {
62
+ if (orderedPrograms.length == 0) {
63
+ console.log("No files to compile")
64
+ return
65
+ }
66
+ const globalConfig = Config.create(
67
+ [
68
+ '_', '--arktsconfig', configPath, '--extension', 'ets', '--stdlib', findStdlib(),
69
+ orderedPrograms[0].absoluteName // Putting some file here to avoid "Fatal error: Unresolved module name"
70
+ ]
71
+ )
72
+ console.log(orderedPrograms)
73
+ const globalContext = global.es2panda._CreateGlobalContext(
74
+ globalConfig.peer,
75
+ passStringArray(orderedPrograms.map(it => it.absoluteName)),
76
+ orderedPrograms.length,
77
+ false
78
+ )
79
+
80
+ const programsForPluginApplication = getProgramsForPluginApplication(
81
+ orderedPrograms
82
+ )
83
+
84
+ orderedPrograms.forEach((it) => {
85
+ console.log(">>>", "considering", it.absoluteName)
86
+ const args = ['_', '--arktsconfig', configPath, '--extension', 'ets', '--stdlib', findStdlib()]
87
+ if (it.output) {
88
+ args.push('--output', it.output, it.absoluteName)
89
+ }
90
+ const config = Config.create(
91
+ args
92
+ )
93
+ const isExternalProgram = (it.output == undefined)
94
+ const context = global.es2panda._CreateCacheContextFromFile(
95
+ config.peer,
96
+ passString(it.absoluteName),
97
+ globalContext,
98
+ isExternalProgram,
99
+ )
100
+
101
+ global.config = config.peer
102
+ global.compilerContext = new Context(context)
103
+ const options = Options.createOptions(new Config(global.config))
104
+ global.arktsconfig = options.getArkTsConfig()
105
+
106
+ function applyPlugins(plugins: ProgramTransformer[] | undefined, state: Es2pandaContextState) {
107
+ plugins?.forEach(plugin => {
108
+ const program = new Program(global.es2panda._ContextProgram(context))
109
+ const provider = new ProgramProvider(program)
110
+ let currentProgram = provider.next()
111
+ let isFirstProgram = true
112
+ while (currentProgram) {
113
+ if (
114
+ (!isExternalProgram && programsForPluginApplication.includes(currentProgram.absoluteName)) ||
115
+ (isExternalProgram && currentProgram.absoluteName == it.absoluteName)
116
+ ) {
117
+ const options: CompilationOptions = {
118
+ isMainProgram: isFirstProgram,
119
+ stage: state,
120
+ restart: false,
121
+ }
122
+ runTransformerOnProgram(
123
+ currentProgram,
124
+ options,
125
+ plugin,
126
+ new PluginContextImpl(),
127
+ )
128
+ }
129
+ currentProgram = provider.next()
130
+ isFirstProgram = false
131
+ }
132
+ if (state == Es2pandaContextState.ES2PANDA_STATE_CHECKED) {
133
+ recheckContext(context)
134
+ }
135
+ })
136
+ }
137
+
138
+ function proceedToParsed() {
139
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_PARSED)
140
+ }
141
+
142
+ function applyParsedPlugins() {
143
+ applyPlugins(parsedPlugins, Es2pandaContextState.ES2PANDA_STATE_PARSED)
144
+ }
145
+
146
+ function proceedToChecked() {
147
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_CHECKED)
148
+ }
149
+
150
+ function applyCheckedPlugins() {
151
+ applyPlugins(checkedPlugins, Es2pandaContextState.ES2PANDA_STATE_CHECKED)
152
+ }
153
+
154
+ function proceedToFinalState() {
155
+ if (isExternalProgram) {
156
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_LOWERED)
157
+ } else {
158
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_BIN_GENERATED)
159
+ }
160
+ }
161
+
162
+ function cleanup() {
163
+ global.es2panda._DestroyContext(
164
+ context
165
+ )
166
+ global.es2panda._DestroyConfig(
167
+ config.peer
168
+ )
169
+ }
170
+
171
+ const operations = [
172
+ proceedToParsed,
173
+ applyParsedPlugins,
174
+ proceedToChecked,
175
+ applyCheckedPlugins,
176
+ proceedToFinalState,
177
+ cleanup,
178
+ ]
179
+
180
+ operations.forEach(operation => {
181
+ console.log('>>>', operation.name)
182
+ operation()
183
+ console.log('>>>', operation.name, 'OK')
184
+ })
185
+ })
186
+
187
+ global.es2panda._DestroyGlobalContext(
188
+ globalContext
189
+ )
190
+ global.es2panda._DestroyConfig(
191
+ globalConfig.peer
192
+ )
193
+ }