@idlizer/arktscgen 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/build/libarkts-copy/generator/options.json5 +155 -0
  2. package/build/libarkts-copy/native/meson.build +62 -0
  3. package/build/libarkts-copy/native/meson_options.txt +24 -0
  4. package/build/libarkts-copy/native/src/bridges.cc +265 -0
  5. package/build/libarkts-copy/native/src/common.cc +231 -0
  6. package/build/libarkts-copy/native/src/common.h +39 -0
  7. package/build/libarkts-copy/native/src/generated/bridges.cc +11979 -0
  8. package/build/libarkts-copy/package.json +51 -0
  9. package/build/libarkts-copy/src/Es2pandaEnums.ts +183 -0
  10. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +123 -0
  11. package/build/libarkts-copy/src/InteropNativeModule.ts +50 -0
  12. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +31 -0
  13. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +147 -0
  14. package/build/libarkts-copy/src/arkts-api/index.ts +28 -0
  15. package/build/libarkts-copy/src/arkts-api/node-utilities/createCallExpression.ts +40 -0
  16. package/build/libarkts-copy/src/arkts-api/node-utilities/createNumberLiteral.ts +28 -0
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/createScriptFunction.ts +55 -0
  18. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +45 -0
  19. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +121 -0
  20. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +52 -0
  21. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +46 -0
  22. package/build/libarkts-copy/src/arkts-api/peers/Program.ts +55 -0
  23. package/build/libarkts-copy/src/arkts-api/static/global.ts +67 -0
  24. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +69 -0
  25. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +156 -0
  26. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +135 -0
  27. package/build/libarkts-copy/src/arkts-api/visitor.ts +297 -0
  28. package/build/libarkts-copy/src/es2panda.ts +277 -0
  29. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +1266 -0
  30. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +3745 -0
  31. package/build/libarkts-copy/src/generated/factory.ts +1299 -0
  32. package/build/libarkts-copy/src/generated/index.ts +191 -0
  33. package/build/libarkts-copy/src/generated/node-map.ts +182 -0
  34. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +39 -0
  35. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +49 -0
  36. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +40 -0
  37. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +110 -0
  38. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +74 -0
  39. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +98 -0
  40. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +70 -0
  41. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +57 -0
  42. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +95 -0
  43. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +42 -0
  44. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +53 -0
  45. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +53 -0
  46. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +95 -0
  47. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +64 -0
  48. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +63 -0
  49. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +53 -0
  50. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +65 -0
  51. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +97 -0
  52. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +64 -0
  53. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +53 -0
  54. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +50 -0
  55. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +58 -0
  56. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +233 -0
  57. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +80 -0
  58. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +54 -0
  59. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +70 -0
  60. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +58 -0
  61. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +74 -0
  62. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +65 -0
  63. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +50 -0
  64. package/build/libarkts-copy/src/generated/peers/Decorator.ts +54 -0
  65. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +52 -0
  66. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +58 -0
  67. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +54 -0
  68. package/build/libarkts-copy/src/generated/peers/ETSDynamicFunctionType.ts +40 -0
  69. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +84 -0
  70. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +68 -0
  71. package/build/libarkts-copy/src/generated/peers/ETSLaunchExpression.ts +57 -0
  72. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +71 -0
  73. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +62 -0
  74. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +69 -0
  75. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +60 -0
  76. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +50 -0
  77. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +51 -0
  78. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +126 -0
  79. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +54 -0
  80. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +51 -0
  81. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +51 -0
  82. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +73 -0
  83. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +58 -0
  84. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +68 -0
  85. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +50 -0
  86. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +53 -0
  87. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +55 -0
  88. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +50 -0
  89. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +58 -0
  90. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +56 -0
  91. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +73 -0
  92. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +57 -0
  93. package/build/libarkts-copy/src/generated/peers/Expression.ts +75 -0
  94. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +59 -0
  95. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +61 -0
  96. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +64 -0
  97. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +61 -0
  98. package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +40 -0
  99. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +69 -0
  100. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +64 -0
  101. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +62 -0
  102. package/build/libarkts-copy/src/generated/peers/Identifier.ts +154 -0
  103. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +65 -0
  104. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +61 -0
  105. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +54 -0
  106. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +53 -0
  107. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +54 -0
  108. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +49 -0
  109. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +57 -0
  110. package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +40 -0
  111. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +60 -0
  112. package/build/libarkts-copy/src/generated/peers/Literal.ts +40 -0
  113. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +40 -0
  114. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +48 -0
  115. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +95 -0
  116. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +54 -0
  117. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +105 -0
  118. package/build/libarkts-copy/src/generated/peers/NamedType.ts +76 -0
  119. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +56 -0
  120. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +50 -0
  121. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +47 -0
  122. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +90 -0
  123. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +50 -0
  124. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +50 -0
  125. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +57 -0
  126. package/build/libarkts-copy/src/generated/peers/Property.ts +82 -0
  127. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +57 -0
  128. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +62 -0
  129. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +201 -0
  130. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +53 -0
  131. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +79 -0
  132. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +82 -0
  133. package/build/libarkts-copy/src/generated/peers/Statement.ts +39 -0
  134. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +56 -0
  135. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +50 -0
  136. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +62 -0
  137. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +63 -0
  138. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +50 -0
  139. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +53 -0
  140. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +76 -0
  141. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +50 -0
  142. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +50 -0
  143. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +60 -0
  144. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +63 -0
  145. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +65 -0
  146. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +81 -0
  147. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +66 -0
  148. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +53 -0
  149. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +67 -0
  150. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +61 -0
  151. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +64 -0
  152. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +65 -0
  153. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +56 -0
  154. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +54 -0
  155. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +53 -0
  156. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +102 -0
  157. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +54 -0
  158. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +54 -0
  159. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +54 -0
  160. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +64 -0
  161. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +71 -0
  162. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +53 -0
  163. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +63 -0
  164. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +60 -0
  165. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +50 -0
  166. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +58 -0
  167. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +50 -0
  168. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +50 -0
  169. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +50 -0
  170. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +66 -0
  171. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +54 -0
  172. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +72 -0
  173. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +63 -0
  174. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +67 -0
  175. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +50 -0
  176. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +50 -0
  177. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +53 -0
  178. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +88 -0
  179. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +63 -0
  180. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +53 -0
  181. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +63 -0
  182. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +84 -0
  183. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +62 -0
  184. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +54 -0
  185. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +60 -0
  186. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +54 -0
  187. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +62 -0
  188. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +50 -0
  189. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +53 -0
  190. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +50 -0
  191. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +50 -0
  192. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +61 -0
  193. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +59 -0
  194. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +60 -0
  195. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +50 -0
  196. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +54 -0
  197. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +75 -0
  198. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +49 -0
  199. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +39 -0
  200. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +40 -0
  201. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +53 -0
  202. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +57 -0
  203. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +50 -0
  204. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +60 -0
  205. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +42 -0
  206. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +71 -0
  207. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +69 -0
  208. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +58 -0
  209. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +56 -0
  210. package/build/libarkts-copy/src/reexport-for-generated.ts +33 -0
  211. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +1375 -0
  212. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +110 -0
  213. package/build/libarkts-copy/src/ts-api/index.ts +35 -0
  214. package/build/libarkts-copy/src/ts-api/static/enums.ts +18 -0
  215. package/build/libarkts-copy/src/ts-api/types.ts +920 -0
  216. package/build/libarkts-copy/src/ts-api/utilities/private.ts +289 -0
  217. package/build/libarkts-copy/src/ts-api/utilities/public.ts +55 -0
  218. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +155 -0
  219. package/build/libarkts-copy/src/utils.ts +89 -0
  220. package/build/libarkts-copy/tsconfig.json +15 -0
  221. package/lib/index.js +11858 -0
  222. package/package.json +54 -0
  223. package/templates/Es2pandaEnums.ts +16 -0
  224. package/templates/Es2pandaNativeModule.ts +32 -0
  225. package/templates/bridges.cc +18 -0
  226. package/templates/factory.ts +34 -0
  227. package/templates/index.ts +16 -0
  228. package/templates/node-map.ts +31 -0
  229. package/templates/peer.ts +32 -0
@@ -0,0 +1,55 @@
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 { AnnotationUsage } from "../../generated/peers/AnnotationUsage"
17
+ import { AstNode } from "../peers/AstNode"
18
+ import { Expression } from "../../generated/peers/Expression"
19
+ import { FunctionSignature } from "../../generated/peers/FunctionSignature"
20
+ import { Identifier } from "../../generated/peers/Identifier"
21
+ import { ScriptFunction } from "../../generated/peers/ScriptFunction"
22
+ import { TSTypeParameterDeclaration } from "../../generated/peers/TSTypeParameterDeclaration"
23
+ import { TypeNode } from "../../generated/peers/TypeNode"
24
+ import { Es2pandaModifierFlags, Es2pandaScriptFunctionFlags } from "../../generated/Es2pandaEnums"
25
+
26
+ export function createScriptFunction(
27
+ databody: AstNode | undefined,
28
+ typeParams: TSTypeParameterDeclaration | undefined,
29
+ params: readonly Expression[],
30
+ returnTypeAnnotation: TypeNode | undefined,
31
+ hasReceiver: boolean,
32
+ datafuncFlags: Es2pandaScriptFunctionFlags,
33
+ dataflags: Es2pandaModifierFlags,
34
+ ident: Identifier | undefined,
35
+ annotations: readonly AnnotationUsage[] | undefined,
36
+ ) {
37
+ const res = ScriptFunction.createScriptFunction(
38
+ databody,
39
+ FunctionSignature.createFunctionSignature(
40
+ typeParams,
41
+ params,
42
+ returnTypeAnnotation,
43
+ hasReceiver,
44
+ ),
45
+ datafuncFlags,
46
+ dataflags
47
+ )
48
+ if (ident) {
49
+ res.setIdent(ident)
50
+ }
51
+ if (annotations) {
52
+ res.setAnnotations(annotations)
53
+ }
54
+ return res
55
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright (c) 2024 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 { KNativePointer } from "@koalaui/interop"
17
+
18
+ export abstract class ArktsObject {
19
+ protected constructor(peer: KNativePointer) {
20
+ this.peer = peer
21
+ }
22
+
23
+ readonly peer: KNativePointer
24
+ }
25
+
26
+ export function isSameNativeObject<T extends ArktsObject | number | string | boolean | undefined>(
27
+ first: T | readonly T[],
28
+ second: T | readonly T[]
29
+ ): boolean {
30
+ if (Array.isArray(first) && Array.isArray(second)) {
31
+ if (first.length !== second.length) {
32
+ return false
33
+ }
34
+ for (let i = 0; i < first.length; i++) {
35
+ if (!isSameNativeObject(first[i], second[i])) {
36
+ return false
37
+ }
38
+ }
39
+ return true
40
+ }
41
+ if (first instanceof ArktsObject && second instanceof ArktsObject) {
42
+ return first?.peer === second?.peer
43
+ }
44
+ return first === second
45
+ }
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Copyright (c) 2024 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 { isNullPtr, KInt, KNativePointer as KPtr, KNativePointer, nullptr } from "@koalaui/interop"
17
+ import { global } from "../static/global"
18
+ import { allFlags, nodeType, unpackNodeArray, unpackNonNullableNode, unpackString } from "../utilities/private"
19
+ import { throwError } from "../../utils"
20
+ import { Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
21
+ import { ArktsObject } from "./ArktsObject"
22
+ import { Es2pandaAstNodeType } from "../../Es2pandaEnums"
23
+
24
+ export abstract class AstNode extends ArktsObject {
25
+ protected constructor(peer: KNativePointer) {
26
+ if (isNullPtr(peer)) {
27
+ throwError(`attempted to create AstNode from nullptr`)
28
+ }
29
+ super(peer)
30
+ this.updateChildren()
31
+ }
32
+
33
+ public get originalPeer(): KNativePointer {
34
+ return global.generatedEs2panda._AstNodeOriginalNodeConst(global.context, this.peer)
35
+ }
36
+
37
+ public set originalPeer(peer: KNativePointer) {
38
+ global.generatedEs2panda._AstNodeSetOriginalNode(global.context, this.peer, peer)
39
+ }
40
+
41
+ public getChildren(): readonly AstNode[] {
42
+ return unpackNodeArray(global.es2panda._AstNodeChildren(global.context, this.peer))
43
+ }
44
+
45
+ public getSubtree(): readonly AstNode[] {
46
+ return this.getChildren().reduce(
47
+ (prev: readonly AstNode[], curr) => {
48
+ return prev.concat(curr.getSubtree())
49
+ },
50
+ [this]
51
+ )
52
+ }
53
+
54
+ public updateChildren(): void {
55
+ if (this.peer === nullptr) {
56
+ throwError('updateChildren called on NULLPTR')
57
+ }
58
+ global.es2panda._AstNodeUpdateChildren(global.context, this.peer)
59
+ }
60
+
61
+ public updateModifiers(modifierFlags: KInt | undefined): this {
62
+ global.generatedEs2panda._AstNodeClearModifier(global.context, this.peer, allFlags)
63
+ global.generatedEs2panda._AstNodeAddModifier(global.context, this.peer, modifierFlags ?? Es2pandaModifierFlags.MODIFIER_FLAGS_NONE)
64
+ return this
65
+ }
66
+
67
+ public dump(indentation: number = 0): string {
68
+ const children = this.getChildren()
69
+ .map((it) => it.dump(indentation + 1))
70
+ const msg =
71
+ `${indentation}_`
72
+ + ` <mods: ${this.modifiers}>`
73
+ + this.dumpMessage()
74
+ return "> " + " ".repeat(4 * indentation) + msg + "\n" + children.join("")
75
+ }
76
+
77
+ protected dumpMessage(): string {
78
+ return ``
79
+ }
80
+
81
+ public dumpJson(): string {
82
+ return unpackString(global.generatedEs2panda._AstNodeDumpJSONConst(global.context, this.peer))
83
+ }
84
+
85
+ public dumpSrc(): string {
86
+ return unpackString(global.generatedEs2panda._AstNodeDumpEtsSrcConst(global.context, this.peer))
87
+ }
88
+
89
+ public dumpModifiers(): string {
90
+ return unpackString(global.es2panda._AstNodeDumpModifiers(global.context, this.peer))
91
+ }
92
+
93
+ public get parent(): AstNode {
94
+ const parent = global.generatedEs2panda._AstNodeParent(global.context, this.peer)
95
+ if (parent === nullptr) {
96
+ throwError(`no parent`)
97
+ }
98
+ return unpackNonNullableNode(parent)
99
+ }
100
+
101
+ public set parent(node: AstNode) {
102
+ global.generatedEs2panda._AstNodeSetParent(global.context, this.peer, node.peer)
103
+ }
104
+
105
+ public get modifiers(): KInt {
106
+ return global.generatedEs2panda._AstNodeModifiers(global.context, this.peer)
107
+ }
108
+
109
+ public set modifiers(flags: KInt | undefined) {
110
+ global.generatedEs2panda._AstNodeClearModifier(global.context, this.peer, allFlags)
111
+ global.generatedEs2panda._AstNodeAddModifier(global.context, this.peer, flags ?? Es2pandaModifierFlags.MODIFIER_FLAGS_NONE)
112
+ }
113
+ }
114
+
115
+
116
+ export class UnsupportedNode extends AstNode {
117
+ constructor(peer: KPtr) {
118
+ super(peer)
119
+ console.warn(`Warning: unsupported node ${Es2pandaAstNodeType[nodeType(this)]}`)
120
+ }
121
+ }
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright (c) 2024 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 { ArktsObject } from "./ArktsObject"
17
+ import { global } from "../static/global"
18
+ import { passStringArray } from "../utilities/private"
19
+ import { KNativePointer } from "@koalaui/interop"
20
+
21
+ export class Config extends ArktsObject {
22
+ constructor(peer: KNativePointer) {
23
+ super(peer)
24
+ // TODO: wait for getter from api
25
+ this.path = ``
26
+ }
27
+
28
+ static create(
29
+ input: readonly string[]
30
+ ): Config {
31
+ return new Config(
32
+ global.es2panda._CreateConfig(input.length, passStringArray(input))
33
+ )
34
+ }
35
+
36
+ static createDefault(): Config {
37
+ if (global.configIsInitialized()) {
38
+ console.warn(`Config already initialized`)
39
+ return new Config(
40
+ global.config
41
+ )
42
+ }
43
+ return new Config(
44
+ global.es2panda._CreateConfig(
45
+ 4,
46
+ passStringArray(["", "--arktsconfig", "./arktsconfig.json", global.filePath])
47
+ )
48
+ )
49
+ }
50
+
51
+ readonly path: string
52
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright (c) 2024 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 { ArktsObject } from "./ArktsObject"
17
+ import { Program } from "./Program"
18
+ import { global } from "../static/global"
19
+ import { throwError } from "../../utils"
20
+ import { passString } from "../utilities/private"
21
+ import { KNativePointer } from "@koalaui/interop"
22
+
23
+ export class Context extends ArktsObject {
24
+ constructor(peer: KNativePointer) {
25
+ super(peer)
26
+ }
27
+
28
+ static createFromString(
29
+ source: string
30
+ ): Context {
31
+ if (!global.configIsInitialized()) {
32
+ throwError(`Config not initialized`)
33
+ }
34
+ return new Context(
35
+ global.es2panda._CreateContextFromString(
36
+ global.config,
37
+ passString(source),
38
+ passString(global.filePath)
39
+ )
40
+ )
41
+ }
42
+
43
+ get program(): Program {
44
+ return new Program(global.es2panda._ContextProgram(this.peer));
45
+ }
46
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) 2024 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 { ArktsObject } from "./ArktsObject"
17
+ import { global } from "../static/global"
18
+ import { acceptNativeObjectArrayResult, unpackString } from "../utilities/private"
19
+ import { KNativePointer } from "@koalaui/interop"
20
+ import { ETSModule } from "../../generated"
21
+
22
+ export class Program extends ArktsObject {
23
+ constructor(peer: KNativePointer) {
24
+ super(peer)
25
+ }
26
+
27
+ get astNode(): ETSModule {
28
+ return new ETSModule(global.es2panda._ProgramAst(global.context, this.peer));
29
+ }
30
+
31
+ get externalSources(): ExternalSource[] {
32
+ return acceptNativeObjectArrayResult<ExternalSource>(
33
+ global.es2panda._ProgramExternalSources(global.context, this.peer),
34
+ (instance: KNativePointer) => new ExternalSource(instance)
35
+ );
36
+ }
37
+
38
+ }
39
+
40
+ export class ExternalSource extends ArktsObject {
41
+ constructor(peer: KNativePointer) {
42
+ super(peer)
43
+ }
44
+
45
+ getName(): string {
46
+ return unpackString(global.es2panda._ExternalSourceName(this.peer));
47
+ }
48
+
49
+ get programs(): Program[] {
50
+ return acceptNativeObjectArrayResult<Program>(
51
+ global.es2panda._ExternalSourcePrograms(this.peer),
52
+ (instance: KNativePointer) => new Program(instance)
53
+ );
54
+ }
55
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (c) 2022-2023 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 { throwError } from "../../utils"
17
+ import { KNativePointer } from "@koalaui/interop"
18
+ import { initEs2panda, Es2pandaNativeModule, initGeneratedEs2panda } from "../../Es2pandaNativeModule"
19
+ import { Es2pandaNativeModule as GeneratedEs2pandaNativeModule } from "../../generated/Es2pandaNativeModule"
20
+ import { initInterop, InteropNativeModule } from "../../InteropNativeModule"
21
+ import { Context } from "../peers/Context"
22
+
23
+ export class global {
24
+ public static filePath: string = "./plugins/input/main.ets"
25
+ public static filePathFromPackageRoot: string = global.filePath
26
+
27
+ private static _config?: KNativePointer
28
+ public static set config(config: KNativePointer) {
29
+ global._config = config
30
+ }
31
+ public static get config(): KNativePointer {
32
+ return global._config ?? throwError('Global.config not initialized')
33
+ }
34
+ public static configIsInitialized(): boolean {
35
+ return global._config !== undefined
36
+ }
37
+
38
+ // TODO: rename to contextPeer
39
+ public static get context(): KNativePointer {
40
+ return global.compilerContext.peer ?? throwError('Global.context not initialized')
41
+ }
42
+
43
+ // TODO: rename to context when the pointer valued one is eliminated
44
+ public static compilerContext: Context
45
+
46
+ private static _es2panda: Es2pandaNativeModule | undefined = undefined
47
+ public static get es2panda(): Es2pandaNativeModule {
48
+ if (this._es2panda === undefined) {
49
+ this._es2panda = initEs2panda()
50
+ }
51
+ return this._es2panda
52
+ }
53
+
54
+ private static _generatedEs2panda: GeneratedEs2pandaNativeModule | undefined = undefined
55
+ public static get generatedEs2panda(): GeneratedEs2pandaNativeModule {
56
+ if (this._generatedEs2panda === undefined) {
57
+ this._generatedEs2panda = initGeneratedEs2panda()
58
+ }
59
+ return this._generatedEs2panda
60
+ }
61
+
62
+ private static _interop: InteropNativeModule | undefined = undefined
63
+ public static get interop(): InteropNativeModule {
64
+ if (this._interop === undefined) this._interop = initInterop()
65
+ return this._interop
66
+ }
67
+ }
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright (c) 2022-2023 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 { int32 } from "@koalaui/common"
17
+ import {
18
+ Access,
19
+ ArrayDecoder,
20
+ CallbackRegistry,
21
+ NativeStringBase,
22
+ nullptr,
23
+ pointer,
24
+ providePlatformDefinedData,
25
+ withByteArray
26
+ } from "@koalaui/interop"
27
+ import { global } from "../static/global"
28
+
29
+ class NativeString extends NativeStringBase {
30
+ constructor(ptr: pointer) {
31
+ super(ptr)
32
+ }
33
+ protected bytesLength(): int32 {
34
+ return global.interop._StringLength(this.ptr)
35
+ }
36
+ protected getData(data: Uint8Array): void {
37
+ withByteArray(data, Access.WRITE, (dataPtr: pointer) => {
38
+ global.interop._StringData(this.ptr, dataPtr, data.length)
39
+ })
40
+ }
41
+ close(): void {
42
+ global.interop._InvokeFinalizer(this.ptr, global.interop._GetStringFinalizer())
43
+ this.ptr = nullptr
44
+ }
45
+ }
46
+
47
+ providePlatformDefinedData({
48
+ nativeString(ptr: pointer): NativeStringBase {
49
+ return new NativeString(ptr)
50
+ },
51
+ nativeStringArrayDecoder(): ArrayDecoder<NativeStringBase> {
52
+ throw new Error("Not yet implemented")
53
+ },
54
+ callbackRegistry(): CallbackRegistry | undefined {
55
+ return undefined
56
+ }
57
+ })
58
+
59
+ export class NativePtrDecoder extends ArrayDecoder<pointer> {
60
+ getArraySize(blob: pointer) {
61
+ return global.interop._GetPtrVectorSize(blob)
62
+ }
63
+ disposeArray(blob: pointer): void {
64
+ // TODO
65
+ }
66
+ getArrayElement(blob: pointer, index: int32): pointer {
67
+ return global.interop._GetPtrVectorElement(blob, index)
68
+ }
69
+ }
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Copyright (c) 2022-2023 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 { global } from "../static/global"
17
+ import { isNumber, throwError } from "../../utils"
18
+ import {
19
+ KInt,
20
+ KNativePointer as KPtr,
21
+ KNativePointer,
22
+ nullptr,
23
+ withString,
24
+ withStringArray,
25
+ withStringResult
26
+ } from "@koalaui/interop"
27
+ import { NativePtrDecoder } from "./nativePtrDecoder"
28
+ import { Es2pandaModifierFlags, Es2pandaScriptFunctionFlags } from "../../generated/Es2pandaEnums"
29
+ import { classByPeer } from "../class-by-peer"
30
+ import type { AstNode } from "../peers/AstNode"
31
+ import { ArktsObject } from "../peers/ArktsObject"
32
+ import { Es2pandaAstNodeType } from "../../Es2pandaEnums"
33
+
34
+ export const arrayOfNullptr = new BigUint64Array([nullptr])
35
+
36
+ export const allFlags =
37
+ Object.values(Es2pandaModifierFlags)
38
+ .filter(isNumber)
39
+ .reduce(
40
+ (prev, next) => prev | next,
41
+ 0
42
+
43
+ )
44
+
45
+ export function assertValidPeer(peer: KPtr, expectedKind: Es2pandaAstNodeType): void {
46
+ if (peer === nullptr) {
47
+ throwError(`invalid peer`)
48
+ }
49
+ const peerType = global.generatedEs2panda._AstNodeTypeConst(global.context, peer)
50
+ if (peerType === Es2pandaAstNodeType.AST_NODE_TYPE_STRUCT_DECLARATION && expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_CLASS_DECLARATION) {
51
+ // TODO: Struct is a child class of Class
52
+ return
53
+ }
54
+ if (peerType === Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION && expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_IMPORT_DECLARATION) {
55
+ // TODO: ETSImportDeclaration is a child of a ImportDeclaration
56
+ return
57
+ }
58
+ if (peerType === Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE && expectedKind === Es2pandaAstNodeType.AST_NODE_TYPE_BLOCK_STATEMENT) {
59
+ // TODO: ETSModule is a child of a BlockStatement
60
+ return
61
+ }
62
+ if (peerType !== expectedKind) {
63
+ throwError(`expected: ${Es2pandaAstNodeType[expectedKind]}, got: ${Es2pandaAstNodeType[peerType]}`)
64
+ }
65
+ }
66
+
67
+ export function acceptNativeObjectArrayResult<T extends ArktsObject>(arrayObject: KNativePointer, factory: (instance: KNativePointer) => T): T[] {
68
+ return new NativePtrDecoder().decode(arrayObject).map(factory);
69
+ }
70
+
71
+ export function unpackNonNullableNode<T extends AstNode>(peer: KNativePointer): T {
72
+ if (peer === nullptr) {
73
+ throwError('peer is NULLPTR (maybe you should use unpackNode)')
74
+ }
75
+ return classByPeer(peer) as T
76
+ }
77
+
78
+ export function unpackNode<T extends AstNode>(peer: KNativePointer): T | undefined {
79
+ if (peer === nullptr) {
80
+ return undefined
81
+ }
82
+ return classByPeer(peer) as T
83
+ }
84
+
85
+ export function passNode(node: ArktsObject | undefined): KNativePointer {
86
+ return node?.peer ?? nullptr
87
+ }
88
+
89
+ // meaning unpackNonNullableNodeArray
90
+ export function unpackNodeArray<T extends AstNode>(nodesPtr: KNativePointer): T[] {
91
+ if (nodesPtr === nullptr) {
92
+ throwError('nodesPtr is NULLPTR (maybe you should use unpackNodeArray)')
93
+ }
94
+ return new NativePtrDecoder()
95
+ .decode(nodesPtr)
96
+ .map((peer: KNativePointer) => unpackNonNullableNode(peer))
97
+ }
98
+
99
+ export function passNodeArray(nodes: readonly AstNode[] | undefined): BigUint64Array {
100
+ return new BigUint64Array(
101
+ nodes?.map(node => BigInt(node.peer)) ?? []
102
+ )
103
+ }
104
+
105
+ export function unpackNonNullableObject<T extends ArktsObject>(type: { new (peer: KNativePointer): T }, peer: KNativePointer): T {
106
+ if (peer === nullptr) {
107
+ throwError('peer is NULLPTR (maybe you should use unpackObject)')
108
+ }
109
+ return new type(peer)
110
+ }
111
+
112
+ export function unpackObject<T extends ArktsObject>(type: { new (peer: KNativePointer): T }, peer: KNativePointer): T | undefined {
113
+ if (peer === nullptr) {
114
+ return undefined
115
+ }
116
+ return new type(peer)
117
+ }
118
+
119
+ export function unpackString(peer: KNativePointer): string {
120
+ return withStringResult(peer) ?? throwError(`failed to unpack (peer shouldn't be NULLPTR)`)
121
+ }
122
+
123
+ export function passString(str: string | undefined): string {
124
+ if (str === undefined) {
125
+ return ""
126
+ }
127
+ return withString(str, (it: string) => it)
128
+ }
129
+
130
+ export function passStringArray(strings: readonly string[]): string[] {
131
+ return withStringArray(strings, (it: string[]) => it)
132
+ }
133
+
134
+ export function passNodeWithNewModifiers<T extends AstNode>(node: T, modifiers: KInt): T {
135
+ return (unpackNonNullableNode(node.peer) as T).updateModifiers(modifiers)
136
+ }
137
+
138
+ export function scriptFunctionHasBody(peer: KNativePointer): boolean {
139
+ const flags = global.generatedEs2panda._ScriptFunctionFlagsConst(global.context, peer)
140
+ return (flags & Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_EXTERNAL) === 0
141
+ && (flags & Es2pandaScriptFunctionFlags.SCRIPT_FUNCTION_FLAGS_EXTERNAL_OVERLOAD) === 0
142
+ }
143
+
144
+ export function updateNodeByNode<T extends ArktsObject>(node: T, original: T): T {
145
+ if (original.peer === nullptr) {
146
+ throwError('update called on NULLPTR')
147
+ }
148
+ global.generatedEs2panda._AstNodeSetOriginalNode(global.context, node.peer, original.peer)
149
+ global.generatedEs2panda._AstNodeSetParent(global.context, node.peer, global.generatedEs2panda._AstNodeParent(global.context, original.peer))
150
+ global.es2panda._AstNodeUpdateChildren(global.context, node.peer)
151
+ return node
152
+ }
153
+
154
+ export function nodeType(node: AstNode): Es2pandaAstNodeType {
155
+ return global.generatedEs2panda._AstNodeTypeConst(global.context, passNode(node))
156
+ }