@idlizer/arktscgen 2.1.10-arktscgen-4 → 2.1.10-arktscgen-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/build/libarkts-copy/native/meson.build +1 -1
  2. package/build/libarkts-copy/native/src/bridges.cc +72 -115
  3. package/build/libarkts-copy/native/src/common.cc +225 -84
  4. package/build/libarkts-copy/native/src/common.h +22 -22
  5. package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
  6. package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
  7. package/build/libarkts-copy/package.json +21 -17
  8. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
  9. package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
  10. package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
  11. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
  12. package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
  13. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
  14. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +38 -29
  15. package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
  16. package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +8 -8
  18. package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +9 -21
  19. package/build/libarkts-copy/src/arkts-api/node-utilities/AssignmentExpression.ts +12 -14
  20. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +5 -5
  21. package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +26 -24
  22. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +62 -32
  23. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +14 -13
  24. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +24 -21
  25. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +10 -12
  26. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +14 -18
  27. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +15 -16
  28. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +5 -8
  29. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +6 -12
  30. package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +12 -11
  31. package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +14 -33
  32. package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +12 -23
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +17 -21
  34. package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +9 -8
  35. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +21 -16
  36. package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +52 -53
  37. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +22 -32
  38. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +12 -14
  39. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +10 -12
  40. package/build/libarkts-copy/src/arkts-api/node-utilities/TryStatement.ts +10 -9
  41. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +10 -12
  42. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +8 -8
  43. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +53 -49
  44. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
  45. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
  46. package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
  47. package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +9 -9
  48. package/build/libarkts-copy/src/arkts-api/peers/ImportPathManager.ts +6 -8
  49. package/build/libarkts-copy/src/arkts-api/peers/Options.ts +8 -8
  50. package/build/libarkts-copy/src/arkts-api/plugins.ts +98 -30
  51. package/build/libarkts-copy/src/arkts-api/static/global.ts +35 -36
  52. package/build/libarkts-copy/src/arkts-api/static/globalUtils.ts +5 -5
  53. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +107 -91
  54. package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +54 -37
  55. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +86 -69
  56. package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +39 -23
  57. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
  58. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
  59. package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
  60. package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +8 -8
  61. package/build/libarkts-copy/src/checkSdk.ts +15 -18
  62. package/build/libarkts-copy/src/index.ts +29 -29
  63. package/build/libarkts-copy/src/plugin-utils.ts +52 -40
  64. package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
  65. package/build/libarkts-copy/src/tracer.ts +75 -69
  66. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +134 -274
  67. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +23 -23
  68. package/build/libarkts-copy/src/ts-api/index.ts +27 -35
  69. package/build/libarkts-copy/src/ts-api/static/enums.ts +3 -3
  70. package/build/libarkts-copy/src/ts-api/types.ts +535 -395
  71. package/build/libarkts-copy/src/ts-api/utilities/private.ts +115 -112
  72. package/build/libarkts-copy/src/ts-api/utilities/public.ts +18 -18
  73. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +33 -49
  74. package/build/libarkts-copy/src/utils.ts +97 -70
  75. package/build/libarkts-copy/tsconfig.json +3 -2
  76. package/lib/index.js +172 -77
  77. package/package.json +51 -52
  78. package/templates/Es2pandaNativeModule.ts +1 -0
  79. package/templates/peer.ts +1 -0
  80. package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16375
  81. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1344
  82. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5192
  83. package/build/libarkts-copy/src/generated/factory.ts +0 -1285
  84. package/build/libarkts-copy/src/generated/index.ts +0 -222
  85. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -44
  86. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -54
  87. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -45
  88. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +0 -165
  89. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +0 -84
  90. package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -73
  91. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -109
  92. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +0 -119
  93. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -65
  94. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -111
  95. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -49
  96. package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -40
  97. package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -40
  98. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -61
  99. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -61
  100. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -110
  101. package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -40
  102. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -72
  103. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -94
  104. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -61
  105. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +0 -78
  106. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +0 -129
  107. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -74
  108. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -68
  109. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -58
  110. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +0 -76
  111. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +0 -365
  112. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +0 -76
  113. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +0 -62
  114. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +0 -137
  115. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +0 -66
  116. package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -40
  117. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -82
  118. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +0 -78
  119. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -58
  120. package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -40
  121. package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -62
  122. package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -40
  123. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -60
  124. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -66
  125. package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -40
  126. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -62
  127. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +0 -102
  128. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -90
  129. package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -69
  130. package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -61
  131. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +0 -129
  132. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -75
  133. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -79
  134. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -75
  135. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -58
  136. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -59
  137. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +0 -189
  138. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -62
  139. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +0 -55
  140. package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -58
  141. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -59
  142. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -89
  143. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +0 -66
  144. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +0 -78
  145. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -58
  146. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -75
  147. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +0 -63
  148. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -66
  149. package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -40
  150. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +0 -66
  151. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -64
  152. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +0 -94
  153. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +0 -82
  154. package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -84
  155. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -67
  156. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -69
  157. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -72
  158. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -67
  159. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +0 -106
  160. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +0 -74
  161. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +0 -70
  162. package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -40
  163. package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -162
  164. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -78
  165. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +0 -87
  166. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +0 -62
  167. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -61
  168. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +0 -62
  169. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -40
  170. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +0 -73
  171. package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -40
  172. package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -40
  173. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +0 -68
  174. package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -53
  175. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -45
  176. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -53
  177. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -115
  178. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -62
  179. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +0 -152
  180. package/build/libarkts-copy/src/generated/peers/NamedType.ts +0 -84
  181. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -64
  182. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -58
  183. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -78
  184. package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -40
  185. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -94
  186. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -58
  187. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -58
  188. package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -101
  189. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -65
  190. package/build/libarkts-copy/src/generated/peers/Program.ts +0 -206
  191. package/build/libarkts-copy/src/generated/peers/Property.ts +0 -92
  192. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -65
  193. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -75
  194. package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -40
  195. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +0 -310
  196. package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -40
  197. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -61
  198. package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -40
  199. package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +0 -48
  200. package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -40
  201. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -83
  202. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -120
  203. package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -44
  204. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -66
  205. package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -40
  206. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -58
  207. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -70
  208. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +0 -71
  209. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -58
  210. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -61
  211. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -84
  212. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -58
  213. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -58
  214. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +0 -70
  215. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -71
  216. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +0 -73
  217. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +0 -112
  218. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -76
  219. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -61
  220. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +0 -75
  221. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +0 -69
  222. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +0 -72
  223. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -73
  224. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -64
  225. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +0 -62
  226. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -61
  227. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +0 -160
  228. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -62
  229. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -62
  230. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -62
  231. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +0 -72
  232. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +0 -79
  233. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -61
  234. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -71
  235. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -68
  236. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -58
  237. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -66
  238. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -58
  239. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -58
  240. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -58
  241. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -74
  242. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -62
  243. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -80
  244. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +0 -71
  245. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +0 -75
  246. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -58
  247. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -58
  248. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -61
  249. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +0 -151
  250. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -71
  251. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -61
  252. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -71
  253. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +0 -121
  254. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +0 -75
  255. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -62
  256. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -68
  257. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -62
  258. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +0 -70
  259. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -58
  260. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -61
  261. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -58
  262. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -58
  263. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +0 -69
  264. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -69
  265. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +0 -68
  266. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -58
  267. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -62
  268. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +0 -89
  269. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +0 -81
  270. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -44
  271. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -45
  272. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -61
  273. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -70
  274. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -58
  275. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -68
  276. package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -40
  277. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -50
  278. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +0 -113
  279. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -79
  280. package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -40
  281. package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -40
  282. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -71
  283. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -64
@@ -14,12 +14,17 @@
14
14
  */
15
15
 
16
16
  #include <common.h>
17
+ #include <iterator>
18
+ #include <regex.h>
19
+ #include <sstream>
17
20
  #include <utility>
21
+ #include <vector>
22
+
18
23
  #include "interop-types.h"
19
24
 
20
25
  using std::string, std::cout, std::endl, std::vector;
21
26
 
22
- es2panda_Impl *es2pandaImplementation = nullptr;
27
+ es2panda_Impl* es2pandaImplementation = nullptr;
23
28
  static thread_local StageArena currentArena;
24
29
 
25
30
  StageArena* StageArena::instance()
@@ -75,28 +80,28 @@ void* StageArena::alloc(size_t size)
75
80
  }
76
81
 
77
82
  #ifdef KOALA_WINDOWS
78
- #include <windows.h>
79
- #define PLUGIN_DIR "windows_host_tools"
80
- #define LIB_PREFIX "lib"
81
- #define LIB_SUFFIX ".dll"
83
+ #include <windows.h>
84
+ #define PLUGIN_DIR "windows_host_tools"
85
+ #define LIB_PREFIX "lib"
86
+ #define LIB_SUFFIX ".dll"
82
87
  #endif
83
88
 
84
89
  #if defined(KOALA_LINUX) || defined(KOALA_MACOS)
85
- #include <dlfcn.h>
90
+ #include <dlfcn.h>
86
91
 
87
- #ifdef __x86_64__
88
- #define PLUGIN_DIR "linux_host_tools"
89
- #else
90
- #define PLUGIN_DIR "linux_arm64_host_tools"
91
- #endif
92
+ #ifdef __x86_64__
93
+ #define PLUGIN_DIR "linux_host_tools"
94
+ #else
95
+ #define PLUGIN_DIR "linux_arm64_host_tools"
96
+ #endif
92
97
 
93
- #define LIB_PREFIX "lib"
94
- #define LIB_SUFFIX ".so"
98
+ #define LIB_PREFIX "lib"
99
+ #define LIB_SUFFIX ".so"
95
100
  #endif
96
101
 
97
- const char* DEFAULT_SDK_PATH = "../../../incremental/tools/panda/node_modules/@panda/sdk" ;
98
- const char* NAME = LIB_PREFIX "es2panda-public" LIB_SUFFIX;
102
+ const char* DEFAULT_SDK_PATH = "../../../incremental/tools/panda/node_modules/@panda/sdk";
99
103
 
104
+ const char* LIB_ES2PANDA_PUBLIC_ALT = LIB_PREFIX "es2panda-public" LIB_SUFFIX;
100
105
  const char* LIB_ES2PANDA_PUBLIC = LIB_PREFIX "es2panda_public" LIB_SUFFIX;
101
106
  const char* IS_UI_FLAG = "IS_UI_FLAG";
102
107
  const char* NOT_UI_FLAG = "NOT_UI_FLAG";
@@ -104,15 +109,15 @@ const string MODULE_SUFFIX = ".d.ets";
104
109
  const string ARKUI = "arkui";
105
110
 
106
111
  #ifdef KOALA_WINDOWS
107
- const char *SEPARATOR = "\\";
112
+ const char* SEPARATOR = "\\";
108
113
  #else
109
- const char *SEPARATOR = "/";
114
+ const char* SEPARATOR = "/";
110
115
  #endif
111
- const char *LIB_DIR = "lib";
116
+ const char* LIB_DIR = "lib";
112
117
 
113
118
  static std::string ES2PANDA_LIB_PATH = "";
114
119
 
115
- std::string joinPath(vector<string> &paths)
120
+ std::string joinPath(vector<string>& paths)
116
121
  {
117
122
  std::string res;
118
123
  for (std::size_t i = 0; i < paths.size(); ++i) {
@@ -125,20 +130,20 @@ std::string joinPath(vector<string> &paths)
125
130
  return res;
126
131
  }
127
132
 
128
- void impl_SetUpSoPath(KStringPtr &soPath)
133
+ void impl_SetUpSoPath(KStringPtr& soPath)
129
134
  {
130
135
  ES2PANDA_LIB_PATH = std::string(soPath.c_str());
131
136
  }
132
137
  KOALA_INTEROP_V1(SetUpSoPath, KStringPtr);
133
138
 
134
- // Improve: simplify this
135
- void* FindLibrary() {
136
- void *res = nullptr;
139
+ void* TryLibrary(const char* name)
140
+ {
141
+ void* res = nullptr;
137
142
  std::vector<std::string> pathArray;
138
143
 
139
144
  // find by SetUpSoPath
140
145
  if (!ES2PANDA_LIB_PATH.empty()) {
141
- pathArray = {ES2PANDA_LIB_PATH, LIB_DIR, LIB_ES2PANDA_PUBLIC};
146
+ pathArray = {ES2PANDA_LIB_PATH, LIB_DIR, name};
142
147
  res = loadLibrary(joinPath(pathArray));
143
148
  if (res) {
144
149
  return res;
@@ -148,7 +153,7 @@ void* FindLibrary() {
148
153
  // find by set PANDA_SDK_PATH
149
154
  char* envValue = getenv("PANDA_SDK_PATH");
150
155
  if (envValue) {
151
- pathArray = {envValue, PLUGIN_DIR, LIB_DIR, NAME};
156
+ pathArray = {envValue, PLUGIN_DIR, LIB_DIR, name};
152
157
  res = loadLibrary(joinPath(pathArray));
153
158
  if (res) {
154
159
  return res;
@@ -156,14 +161,14 @@ void* FindLibrary() {
156
161
  }
157
162
 
158
163
  // find by set LD_LIBRARY_PATH
159
- pathArray = {LIB_ES2PANDA_PUBLIC};
164
+ pathArray = {name};
160
165
  res = loadLibrary(joinPath(pathArray));
161
166
  if (res) {
162
167
  return res;
163
168
  }
164
169
 
165
170
  // find by DEFAULT_SDK_PATH
166
- pathArray = {DEFAULT_SDK_PATH, PLUGIN_DIR, LIB_DIR, NAME};
171
+ pathArray = {DEFAULT_SDK_PATH, PLUGIN_DIR, LIB_DIR, name};
167
172
  res = loadLibrary(joinPath(pathArray));
168
173
  if (res) {
169
174
  return res;
@@ -172,7 +177,24 @@ void* FindLibrary() {
172
177
  return nullptr;
173
178
  }
174
179
 
175
- es2panda_Impl *GetImplSlow()
180
+ // TODO: @panda/sdk will be changed to match ohos-sdk
181
+ void* FindLibrary() {
182
+ void *res = nullptr;
183
+
184
+ res = TryLibrary(LIB_ES2PANDA_PUBLIC);
185
+ if (res) {
186
+ return res;
187
+ }
188
+
189
+ res = TryLibrary(LIB_ES2PANDA_PUBLIC_ALT);
190
+ if (res) {
191
+ return res;
192
+ }
193
+
194
+ return nullptr;
195
+ }
196
+
197
+ es2panda_Impl* GetImplSlow()
176
198
  {
177
199
  if (es2pandaImplementation) {
178
200
  return es2pandaImplementation;
@@ -187,7 +209,7 @@ es2panda_Impl *GetImplSlow()
187
209
  printf("no entry point");
188
210
  abort();
189
211
  }
190
- es2pandaImplementation = reinterpret_cast<es2panda_Impl *(*)(int)>(symbol)(ES2PANDA_LIB_VERSION);
212
+ es2pandaImplementation = reinterpret_cast<es2panda_Impl* (*)(int)>(symbol)(ES2PANDA_LIB_VERSION);
191
213
  return es2pandaImplementation;
192
214
  }
193
215
 
@@ -196,51 +218,42 @@ string getString(KStringPtr ptr)
196
218
  return ptr.data();
197
219
  }
198
220
 
221
+ const char** getStringArray(KStringArray& ptr)
222
+ {
223
+ return const_cast<const char**>(ptr.get()); // release()?
224
+ }
225
+
199
226
  char* getStringCopy(KStringPtr& ptr)
200
227
  {
201
228
  return StageArena::strdup(ptr.c_str() ? ptr.c_str() : "");
202
229
  }
203
230
 
204
- KNativePointer impl_CreateConfig(KInt argc, KStringArray argvPtr) {
205
- const std::size_t headerLen = 4;
206
-
207
- const char** argv = StageArena::allocArray<const char*>(argc);
208
- std::size_t position = headerLen;
209
- std::size_t strLen;
210
- for (std::size_t i = 0; i < static_cast<std::size_t>(argc); ++i) {
211
- strLen = unpackUInt(argvPtr + position);
212
- position += headerLen;
213
- argv[i] = StageArena::strdup(std::string(reinterpret_cast<const char*>(argvPtr + position), strLen).c_str());
214
- position += strLen;
215
- }
216
- return GetImpl()->CreateConfig(argc, argv);
231
+ KNativePointer impl_CreateConfig(KInt argc, KStringArray& argvPtr)
232
+ {
233
+ return GetImpl()->CreateConfig(argc, getStringArray(argvPtr));
217
234
  }
218
235
  KOALA_INTEROP_2(CreateConfig, KNativePointer, KInt, KStringArray)
219
236
 
220
- KNativePointer impl_DestroyConfig(KNativePointer configPtr) {
237
+ KNativePointer impl_DestroyConfig(KNativePointer configPtr)
238
+ {
221
239
  auto config = reinterpret_cast<es2panda_Config*>(configPtr);
222
240
  GetImpl()->DestroyConfig(config);
223
241
  return nullptr;
224
242
  }
225
243
  KOALA_INTEROP_1(DestroyConfig, KNativePointer, KNativePointer)
226
244
 
227
- void impl_DestroyContext(KNativePointer contextPtr) {
245
+ void impl_DestroyContext(KNativePointer contextPtr)
246
+ {
228
247
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
229
248
  GetImpl()->DestroyContext(context);
230
249
  StageArena::instance()->cleanup();
231
250
  }
232
251
  KOALA_INTEROP_V1(DestroyContext, KNativePointer)
233
252
 
234
- KNativePointer impl_UpdateCallExpression(
235
- KNativePointer contextPtr,
236
- KNativePointer nodePtr,
237
- KNativePointer calleePtr,
238
- KNativePointerArray argumentsPtr,
239
- KInt argumentsLen,
240
- KNativePointer typeParamsPtr,
241
- KBoolean optionalT,
242
- KBoolean trailingCommaT
243
- ) {
253
+ KNativePointer impl_UpdateCallExpression(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer calleePtr,
254
+ KNativePointerArray argumentsPtr, KInt argumentsLen, KNativePointer typeParamsPtr, KBoolean optionalT,
255
+ KBoolean trailingCommaT)
256
+ {
244
257
  auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
245
258
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
246
259
  auto callee = reinterpret_cast<es2panda_AstNode*>(calleePtr);
@@ -249,26 +262,28 @@ KNativePointer impl_UpdateCallExpression(
249
262
  auto optional = static_cast<bool>(optionalT);
250
263
  auto trailingComma = static_cast<bool>(trailingCommaT);
251
264
 
252
- auto nn = GetImpl()->CreateCallExpression(
253
- context, callee, arguments, argumentsLen, typeParams, optional, trailingComma
254
- );
265
+ auto nn =
266
+ GetImpl()->CreateCallExpression(context, callee, arguments, argumentsLen, typeParams, optional, trailingComma);
255
267
  GetImpl()->AstNodeSetOriginalNode(context, nn, node);
256
268
  return nn;
257
269
  }
258
- KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer, KNativePointerArray, KInt, KNativePointer, KBoolean, KBoolean)
270
+ KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer,
271
+ KNativePointerArray, KInt, KNativePointer, KBoolean, KBoolean)
259
272
 
260
- KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr) {
273
+ KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr)
274
+ {
261
275
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
262
276
  auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
263
277
 
264
- return
265
- (GetImpl()->IdentifierIsOptionalConst(context, node) ? (1 << 0) : 0) |
266
- (GetImpl()->IdentifierIsReferenceConst(context, node) ? (1 << 1) : 0) |
267
- (GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
278
+ return (GetImpl()->IdentifierIsOptionalConst(context, node) ? (1 << 0) : 0) |
279
+ (GetImpl()->IdentifierIsReferenceConst(context, node) ? (1 << 1) : 0) |
280
+ (GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
268
281
  }
269
282
  KOALA_INTEROP_2(IdentifierIdentifierFlags, KInt, KNativePointer, KNativePointer)
270
283
 
271
- void impl_ClassDefinitionSetBody(KNativePointer context, KNativePointer receiver, KNativePointerArray body, KUInt bodyLength) {
284
+ void impl_ClassDefinitionSetBody(
285
+ KNativePointer context, KNativePointer receiver, KNativePointerArray body, KUInt bodyLength)
286
+ {
272
287
  const auto _context = reinterpret_cast<es2panda_Context*>(context);
273
288
  const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
274
289
  const auto _body = reinterpret_cast<es2panda_AstNode**>(body);
@@ -285,24 +300,25 @@ Improve: NOT FROM API (shouldn't be there)
285
300
  -----------------------------------------------------------------------------------------------------------------------------
286
301
  */
287
302
 
288
- es2panda_AstNode * cachedParentNode;
289
- es2panda_Context * cachedContext;
303
+ es2panda_AstNode* cachedParentNode;
304
+ es2panda_Context* cachedContext;
290
305
 
291
- static void changeParent(es2panda_AstNode *child)
306
+ static void changeParent(es2panda_AstNode* child)
292
307
  {
293
308
  GetImpl()->AstNodeSetParent(cachedContext, child, cachedParentNode);
294
309
  }
295
310
 
296
- static void SetRightParent(es2panda_AstNode *node, void *arg)
311
+ static void SetRightParent(es2panda_AstNode* node, void* arg)
297
312
  {
298
- es2panda_Context *ctx = static_cast<es2panda_Context *>(arg);
313
+ es2panda_Context* ctx = static_cast<es2panda_Context*>(arg);
299
314
  cachedContext = ctx;
300
315
  cachedParentNode = node;
301
316
 
302
317
  GetImpl()->AstNodeIterateConst(ctx, node, changeParent);
303
318
  }
304
319
 
305
- KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer programPtr) {
320
+ KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer programPtr)
321
+ {
306
322
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
307
323
  auto program = reinterpret_cast<es2panda_AstNode*>(programPtr);
308
324
 
@@ -311,7 +327,8 @@ KNativePointer impl_AstNodeUpdateAll(KNativePointer contextPtr, KNativePointer p
311
327
  }
312
328
  KOALA_INTEROP_2(AstNodeUpdateAll, KNativePointer, KNativePointer, KNativePointer)
313
329
 
314
- void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer nodePtr) {
330
+ void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer nodePtr)
331
+ {
315
332
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
316
333
  auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
317
334
  cachedParentNode = node;
@@ -320,7 +337,8 @@ void impl_AstNodeSetChildrenParentPtr(KNativePointer contextPtr, KNativePointer
320
337
  }
321
338
  KOALA_INTEROP_V2(AstNodeSetChildrenParentPtr, KNativePointer, KNativePointer)
322
339
 
323
- void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativePointer replacedNode) {
340
+ void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativePointer replacedNode)
341
+ {
324
342
  auto _context = reinterpret_cast<es2panda_Context*>(context);
325
343
  auto _newNode = reinterpret_cast<es2panda_AstNode*>(newNode);
326
344
  auto _replacedNode = reinterpret_cast<es2panda_AstNode*>(replacedNode);
@@ -343,17 +361,15 @@ void impl_AstNodeOnUpdate(KNativePointer context, KNativePointer newNode, KNativ
343
361
  }
344
362
  KOALA_INTEROP_V3(AstNodeOnUpdate, KNativePointer, KNativePointer, KNativePointer)
345
363
 
346
- std::vector<void*> cachedChildren;
364
+ static thread_local std::vector<es2panda_AstNode*> cachedChildren;
347
365
 
348
- static void visitChild(es2panda_AstNode *node)
366
+ static void visitChild(es2panda_AstNode* node)
349
367
  {
350
368
  cachedChildren.emplace_back(node);
351
369
  }
352
370
 
353
- KNativePointer impl_AstNodeChildren(
354
- KNativePointer contextPtr,
355
- KNativePointer nodePtr
356
- ) {
371
+ KNativePointer impl_AstNodeChildren(KNativePointer contextPtr, KNativePointer nodePtr)
372
+ {
357
373
  auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
358
374
  auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
359
375
  cachedContext = context;
@@ -362,7 +378,132 @@ KNativePointer impl_AstNodeChildren(
362
378
  GetImpl()->AstNodeIterateConst(context, node, visitChild);
363
379
  return StageArena::clone(cachedChildren);
364
380
  }
365
- KOALA_INTEROP_2(AstNodeChildren, KNativePointer, KNativePointer, KNativePointer)
381
+ KOALA_INTEROP_2(AstNodeChildren, KNativePointer, KNativePointer, KNativePointer);
382
+
383
+ struct Pattern {
384
+ es2panda_Context* context;
385
+ std::string key;
386
+ std::string value;
387
+ es2panda_Impl* impl;
388
+
389
+ Pattern(es2panda_Context* context, const std::string& part) : context(context), impl(GetImpl())
390
+ {
391
+ std::istringstream stream(part);
392
+ std::getline(stream, key, '=');
393
+ std::getline(stream, value, '=');
394
+ }
395
+ bool match(es2panda_AstNode* node)
396
+ {
397
+ if (key == "type") {
398
+ auto type = impl->AstNodeTypeConst(context, node);
399
+ switch (type) {
400
+ case Es2pandaAstNodeType::AST_NODE_TYPE_METHOD_DEFINITION:
401
+ case Es2pandaAstNodeType::AST_NODE_TYPE_SCRIPT_FUNCTION:
402
+
403
+ return value == "method";
404
+ case Es2pandaAstNodeType::AST_NODE_TYPE_STRUCT_DECLARATION:
405
+ return value == "struct";
406
+ default:
407
+ return false;
408
+ }
409
+ }
410
+ if (key == "annotation") {
411
+ std::size_t length = 0;
412
+ Es2pandaAstNodeType type = impl->AstNodeTypeConst(context, node);
413
+ es2panda_AstNode** result = nullptr;
414
+ switch (type) {
415
+ case Es2pandaAstNodeType::AST_NODE_TYPE_METHOD_DEFINITION: {
416
+ auto function = impl->MethodDefinitionFunction(context, node);
417
+ result = impl->FunctionDeclarationAnnotations(context, function, &length);
418
+ break;
419
+ }
420
+ case Es2pandaAstNodeType::AST_NODE_TYPE_FUNCTION_DECLARATION:
421
+ result = impl->FunctionDeclarationAnnotations(context, node, &length);
422
+ break;
423
+ case AST_NODE_TYPE_ARROW_FUNCTION_EXPRESSION: {
424
+ auto function = impl->ArrowFunctionExpressionFunction(context, node);
425
+ result = impl->FunctionDeclarationAnnotations(context, function, &length);
426
+ break;
427
+ }
428
+ case Es2pandaAstNodeType::AST_NODE_TYPE_CLASS_PROPERTY:
429
+ result = impl->ClassPropertyAnnotations(context, node, &length);
430
+ break;
431
+ default:
432
+ return false;
433
+ }
434
+ bool found = false;
435
+ for (std::size_t i = 0; i < length && result; i++) {
436
+ es2panda_AstNode* ident = impl->AnnotationUsageIrGetBaseNameConst(context, result[i]);
437
+ const char* name = impl->IdentifierNameConst(context, ident);
438
+ found |= matchWildcard(value, name);
439
+ }
440
+ return found;
441
+ }
442
+ return false;
443
+ }
444
+
445
+ bool matchWildcard(const std::string& pattern, const char* value)
446
+ {
447
+ if (pattern.find('*') == std::string::npos) {
448
+ return pattern == value;
449
+ }
450
+ regex_t regex;
451
+ regmatch_t match[1];
452
+ regcomp(&regex, pattern.c_str(), REG_NEWLINE);
453
+ return regexec(&regex, value, 1, match, 0) != REG_NOMATCH;
454
+ }
455
+ };
456
+
457
+ struct Matcher {
458
+ es2panda_Context* context;
459
+ const char* query;
460
+ std::vector<Pattern> patterns;
461
+ es2panda_Impl* impl;
462
+ Matcher(es2panda_Context* context, const char* query) : context(context), query(query), impl(GetImpl())
463
+ {
464
+ std::istringstream stream(query);
465
+ std::string item;
466
+ while (std::getline(stream, item, ';')) {
467
+ patterns.emplace_back(Pattern(context, item));
468
+ }
469
+ }
470
+ bool match(es2panda_AstNode* node)
471
+ {
472
+ bool result = true;
473
+ for (auto pattern : patterns) {
474
+ result &= pattern.match(node);
475
+ }
476
+ return result;
477
+ }
478
+ };
479
+
480
+ KNativePointer impl_FilterNodes(KNativePointer context, KNativePointer node, const KStringPtr& filters)
481
+ {
482
+ auto _node = reinterpret_cast<es2panda_AstNode*>(node);
483
+ auto _context = reinterpret_cast<es2panda_Context*>(context);
484
+ const char* _filters = filters.c_str();
485
+ std::vector<es2panda_AstNode*> result;
486
+ es2panda_Impl* impl = GetImpl();
487
+ Matcher matcher(_context, _filters);
488
+ std::vector<es2panda_AstNode*> queue;
489
+ queue.push_back(_node);
490
+ while (queue.size() > 0) {
491
+ auto* current = queue.back();
492
+ queue.pop_back();
493
+ if (matcher.match(current)) {
494
+ result.push_back(current);
495
+ } else {
496
+ impl->AstNodeIterateConst(_context, current, visitChild);
497
+ // We want to retain match order, so add children in reverse order.
498
+ for (auto it = cachedChildren.rbegin(); it != cachedChildren.rend(); ++it) {
499
+ queue.push_back(*it);
500
+ }
501
+ cachedChildren.clear();
502
+ }
503
+ }
504
+ return StageArena::cloneVector(result.data(), result.size());
505
+ }
506
+ KOALA_INTEROP_3(FilterNodes, KNativePointer, KNativePointer, KNativePointer, KStringPtr)
366
507
 
367
508
  /*
368
509
  -----------------------------------------------------------------------------------------------------------------------------
@@ -390,9 +531,9 @@ static bool isUIHeaderFile(es2panda_Context* context, es2panda_Program* program)
390
531
  result = GetImpl()->ProgramModuleNameConst(context, program);
391
532
  string moduleName(result);
392
533
 
393
- return fileNameWithExtension.length() >= MODULE_SUFFIX.length()
394
- && fileNameWithExtension.substr(fileNameWithExtension.length() - MODULE_SUFFIX.length()) == MODULE_SUFFIX
395
- && moduleName.find(ARKUI) != std::string::npos;
534
+ return fileNameWithExtension.length() >= MODULE_SUFFIX.length() &&
535
+ fileNameWithExtension.substr(fileNameWithExtension.length() - MODULE_SUFFIX.length()) == MODULE_SUFFIX &&
536
+ moduleName.find(ARKUI) != std::string::npos;
396
537
  }
397
538
 
398
539
  KBoolean impl_ProgramCanSkipPhases(KNativePointer context, KNativePointer program)
@@ -405,8 +546,8 @@ KBoolean impl_ProgramCanSkipPhases(KNativePointer context, KNativePointer progra
405
546
  return false;
406
547
  }
407
548
  std::size_t sourceLen;
408
- const auto externalSources = reinterpret_cast<es2panda_ExternalSource **>
409
- (GetImpl()->ProgramExternalSources(_context, _program, &sourceLen));
549
+ const auto externalSources =
550
+ reinterpret_cast<es2panda_ExternalSource**>(GetImpl()->ProgramExternalSources(_context, _program, &sourceLen));
410
551
  for (std::size_t i = 0; i < sourceLen; ++i) {
411
552
  std::size_t programLen;
412
553
  auto programs = GetImpl()->ExternalSourcePrograms(externalSources[i], &programLen);
@@ -31,21 +31,23 @@
31
31
  * limitations under the License.
32
32
  */
33
33
 
34
+ #include <iostream>
35
+ #include <string>
36
+ #include <vector>
37
+
38
+ #include "common-interop.h"
34
39
  #include "dynamic-loader.h"
35
40
  #include "es2panda_lib.h"
36
- #include "common-interop.h"
37
- #include "stdexcept"
38
41
  #include "interop-utils.h"
39
- #include <string>
40
- #include <iostream>
41
- #include <vector>
42
+ #include "stdexcept"
42
43
 
43
44
  using std::string, std::cout, std::endl, std::vector;
44
45
 
45
- extern es2panda_Impl *es2pandaImplementation;
46
+ extern es2panda_Impl* es2pandaImplementation;
46
47
 
47
- es2panda_Impl *GetImplSlow();
48
- inline es2panda_Impl *GetImpl() {
48
+ es2panda_Impl* GetImplSlow();
49
+ inline es2panda_Impl* GetImpl()
50
+ {
49
51
  if (es2pandaImplementation) {
50
52
  return es2pandaImplementation;
51
53
  }
@@ -53,6 +55,7 @@ inline es2panda_Impl *GetImpl() {
53
55
  }
54
56
 
55
57
  string getString(KStringPtr ptr);
58
+ const char** getStringArray(KStringArray& ptr);
56
59
 
57
60
  char* getStringCopy(KStringPtr& ptr);
58
61
 
@@ -66,12 +69,8 @@ inline KUInt unpackUInt(const KByte* bytes)
66
69
  const KUInt BYTE_1_SHIFT = 8;
67
70
  const KUInt BYTE_2_SHIFT = 16;
68
71
  const KUInt BYTE_3_SHIFT = 24;
69
- return (
70
- bytes[BYTE_0]
71
- | (bytes[BYTE_1] << BYTE_1_SHIFT)
72
- | (bytes[BYTE_2] << BYTE_2_SHIFT)
73
- | (bytes[BYTE_3] << BYTE_3_SHIFT)
74
- );
72
+ return (bytes[BYTE_0] | (bytes[BYTE_1] << BYTE_1_SHIFT) | (bytes[BYTE_2] << BYTE_2_SHIFT) |
73
+ (bytes[BYTE_3] << BYTE_3_SHIFT));
75
74
  }
76
75
 
77
76
  es2panda_ContextState intToState(KInt state);
@@ -79,32 +78,33 @@ es2panda_ContextState intToState(KInt state);
79
78
  class StageArena {
80
79
  std::vector<void*> allocated;
81
80
  size_t totalSize;
82
- public:
81
+
82
+ public:
83
83
  StageArena();
84
84
  ~StageArena();
85
85
  static StageArena* instance();
86
- template <typename T>
86
+ template<typename T>
87
87
  static T* alloc()
88
88
  {
89
89
  auto* arena = StageArena::instance();
90
90
  void* memory = arena->alloc(sizeof(T));
91
91
  return new (memory) T();
92
92
  }
93
- template <class T, class T1>
93
+ template<class T, class T1>
94
94
  static T* alloc(T1 arg1)
95
95
  {
96
96
  auto* arena = StageArena::instance();
97
97
  void* memory = arena->alloc(sizeof(T));
98
98
  return new (memory) T(std::forward(arg1));
99
99
  }
100
- template <class T, class T1, class T2>
100
+ template<class T, class T1, class T2>
101
101
  static T* alloc(T1 arg1, T2 arg2)
102
102
  {
103
103
  auto* arena = StageArena::instance();
104
104
  void* memory = arena->alloc(sizeof(T));
105
105
  return new (memory) T(arg1, arg2);
106
106
  }
107
- template <typename T>
107
+ template<typename T>
108
108
  static T* allocArray(size_t count)
109
109
  {
110
110
  auto* arena = StageArena::instance();
@@ -112,14 +112,14 @@ class StageArena {
112
112
  void* memory = arena->alloc(sizeof(T) * count);
113
113
  return new (memory) T();
114
114
  }
115
- template <class T>
115
+ template<class T>
116
116
  static T* clone(const T& arg)
117
117
  {
118
118
  auto* arena = StageArena::instance();
119
119
  void* memory = arena->alloc(sizeof(T));
120
120
  return new (memory) T(arg);
121
121
  }
122
- template <class T>
122
+ template<class T>
123
123
  static std::vector<const void*>* cloneVector(const T* arg, size_t count)
124
124
  {
125
125
  return alloc<std::vector<const void*>, const T*, const T*>(arg, arg + count);
@@ -130,4 +130,4 @@ class StageArena {
130
130
  void cleanup();
131
131
  };
132
132
 
133
- #endif // COMMON_H
133
+ #endif // COMMON_H