@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,155 @@
1
+ {
2
+ "ignore": {
3
+ "interfaces": {
4
+ "es2panda_Impl": [
5
+ "*"
6
+ ],
7
+ "es2panda_SourcePosition": [ // until idl is fixed
8
+ "*"
9
+ ],
10
+ "es2panda_LabelPair": [
11
+ "*"
12
+ ],
13
+ "AnnotationDeclaration": [
14
+ "PropertiesPtrConst" // interferes create-to-param matching
15
+ ],
16
+ "AnnotationUsage": [
17
+ "PropertiesPtrConst" // interferes create-to-param matching
18
+ ],
19
+ "TSInterfaceBody": [
20
+ "BodyPtr" // interferes create-to-param matching
21
+ ],
22
+ "Signature": [
23
+ "ProtectionFlagConst", // u8
24
+ ],
25
+ "ETSReExportDeclaration": [
26
+ "Create", // sequence<String>
27
+ "Update", // sequence<String>
28
+ "GetUserPathsConst" // sequence<String>
29
+ ],
30
+ "CharLiteral": [
31
+ "Create1", // KShort,
32
+ "Update1", // KShort
33
+ "CharConst", // KShort
34
+ ],
35
+ "ForUpdateStatement": [ // forbidden naming
36
+ "Update"
37
+ ],
38
+ "CallExpression": [
39
+ "Update" // differs from handwritten
40
+ ],
41
+ "TryStatement": [
42
+ "AddFinalizerInsertion" // idl missing const
43
+ ],
44
+ }
45
+ },
46
+ nonNullable: [
47
+ {
48
+ name: "ScriptFunction",
49
+ methods: [
50
+ {
51
+ name: "SetIdent",
52
+ types: ["id"]
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ name: "ArrowFunctionExpression",
58
+ methods: [
59
+ {
60
+ name: "FunctionConst",
61
+ types: ["returnType"]
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ name : "FunctionDeclaration",
67
+ methods: [
68
+ {
69
+ name: "FunctionConst",
70
+ types: ["returnType"]
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ name: "CallExpression",
76
+ methods: [
77
+ {
78
+ name: "CalleeConst",
79
+ types: ["returnType"]
80
+ }
81
+ ]
82
+ },
83
+ {
84
+ name : "ExpressionStatement",
85
+ methods: [
86
+ {
87
+ name: "GetExpressionConst",
88
+ types: ["returnType"]
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ name: "IfStatement",
94
+ methods: [
95
+ {
96
+ name: "TestConst",
97
+ types: ["returnType"]
98
+ },
99
+ {
100
+ name: "ConsequentConst",
101
+ types: ["returnType"]
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ name: "MemberExpression",
107
+ methods: [
108
+ {
109
+ name: "ObjectConst",
110
+ types: ["returnType"]
111
+ },
112
+ {
113
+ name: "PropertyConst",
114
+ types: ["returnType"]
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ name: "ETSParameterExpression",
120
+ methods: [
121
+ {
122
+ name: "IdentConst",
123
+ types: ["returnType"]
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ name: "VariableDeclarator",
129
+ methods: [
130
+ {
131
+ name: "IdConst",
132
+ types: ["returnType"]
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ name: "ClassElement",
138
+ methods: [
139
+ {
140
+ name: "IdConst",
141
+ types: ["returnType"]
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ name: "MethodDefinition",
147
+ methods: [
148
+ {
149
+ name: "FunctionConst",
150
+ types: ["returnType"]
151
+ }
152
+ ]
153
+ },
154
+ ]
155
+ }
@@ -0,0 +1,62 @@
1
+ project(
2
+ 'es2panda_interop',
3
+ 'cpp',
4
+ version: '1.0',
5
+ default_options: [
6
+ 'cpp_std=c++17',
7
+ 'buildtype=debug',
8
+ ],
9
+ )
10
+
11
+ sources = [
12
+ './src/common.cc',
13
+ './src/bridges.cc',
14
+ './src/generated/bridges.cc',
15
+ get_option('interop_src_dir') / 'common-interop.cc',
16
+ get_option('interop_src_dir') / 'callback-resource.cc',
17
+ get_option('interop_src_dir') / 'interop-logging.cc',
18
+ get_option('interop_src_dir') / 'napi/convertors-napi.cc',
19
+ ]
20
+
21
+ cflags = [
22
+ '-DKOALA_INTEROP_MODULE=NativeModule',
23
+ '-DINTEROP_LIBRARY_NAME=' + get_option('lib_name'),
24
+ '-DKOALA_USE_NODE_VM',
25
+ '-DKOALA_NAPI',
26
+ ]
27
+
28
+ if (target_machine.system() == 'windows')
29
+ cflags += ['-DKOALA_WINDOWS']
30
+ if (meson.get_compiler('cpp').get_id() == 'msvc')
31
+ # apply node.exe symbol loading hook
32
+ sources += [
33
+ get_option('interop_src_dir') / 'napi/win-dynamic-node.cc'
34
+ ]
35
+ endif
36
+ else
37
+ cflags += ['-DKOALA_LINUX']
38
+ endif
39
+
40
+ shared_library(
41
+ get_option('lib_name'),
42
+ sources,
43
+ override_options: [
44
+ 'b_lundef=false',
45
+ ],
46
+ install: true,
47
+ name_prefix: '',
48
+ name_suffix: 'node',
49
+ include_directories: [
50
+ './src/',
51
+ get_option('panda_sdk_dir') / 'ohos_arm64/include/tools/es2panda/public',
52
+ get_option('panda_sdk_dir') / 'ohos_arm64/include/tools/es2panda',
53
+ get_option('interop_src_dir'),
54
+ get_option('interop_src_dir') / 'types',
55
+ get_option('interop_src_dir') / 'napi',
56
+ get_option('node_modules_dir') / 'node-api-headers/include',
57
+ get_option('node_modules_dir') / 'node-addon-api',
58
+ ],
59
+ cpp_args: cflags,
60
+ link_args: [],
61
+ dependencies: []
62
+ )
@@ -0,0 +1,24 @@
1
+ option(
2
+ 'node_modules_dir',
3
+ type : 'string',
4
+ value : '../../node_modules/',
5
+ description : 'path to node_modules'
6
+ )
7
+ option(
8
+ 'interop_src_dir',
9
+ type : 'string',
10
+ value : '../../../interop/src/cpp/',
11
+ description : 'path to koala interop cpp files'
12
+ )
13
+ option(
14
+ 'panda_sdk_dir',
15
+ type : 'string',
16
+ value : '../../../incremental/tools/panda/node_modules/@panda/sdk/',
17
+ description : 'path to panda sdk'
18
+ )
19
+ option(
20
+ 'lib_name',
21
+ type : 'string',
22
+ value : 'es2panda',
23
+ description : 'name of shared library'
24
+ )
@@ -0,0 +1,265 @@
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
+ #include "common.h"
17
+
18
+ KNativePointer impl_AstNodeRecheck(KNativePointer contextPtr, KNativePointer nodePtr)
19
+ {
20
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
21
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
22
+ GetImpl()->AstNodeRecheck(context, node);
23
+ return nullptr;
24
+ }
25
+ KOALA_INTEROP_2(AstNodeRecheck, KNativePointer, KNativePointer, KNativePointer)
26
+
27
+ KNativePointer impl_AstNodeRebind(KNativePointer contextPtr, KNativePointer nodePtr)
28
+ {
29
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
30
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
31
+ GetImpl()->AstNodeRebind(context, node);
32
+ return nullptr;
33
+ }
34
+ KOALA_INTEROP_2(AstNodeRebind, KNativePointer, KNativePointer, KNativePointer)
35
+
36
+ KNativePointer impl_AnnotationAllowedAnnotations(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer returnLen)
37
+ {
38
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
39
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
40
+ std::size_t params_len = 0;
41
+ auto annotations = GetImpl()->AnnotationAllowedAnnotations(context, node, &params_len);
42
+ return new std::vector<void*>(annotations, annotations + params_len);
43
+ }
44
+ KOALA_INTEROP_3(AnnotationAllowedAnnotations, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
45
+
46
+ KNativePointer impl_AnnotationAllowedAnnotationsConst(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer returnLen)
47
+ {
48
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
49
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
50
+ std::size_t params_len = 0;
51
+ auto annotations = GetImpl()->AnnotationAllowedAnnotationsConst(context, node, &params_len);
52
+ return new std::vector<void*>(annotations, annotations + params_len);
53
+ }
54
+ KOALA_INTEROP_3(AnnotationAllowedAnnotationsConst, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
55
+
56
+ KNativePointer impl_AstNodeVariableConst(KNativePointer contextPtr, KNativePointer nodePtr)
57
+ {
58
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
59
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
60
+
61
+ return GetImpl()->AstNodeVariableConst(context, node);
62
+ }
63
+ KOALA_INTEROP_2(AstNodeVariableConst, KNativePointer, KNativePointer, KNativePointer)
64
+
65
+ KNativePointer impl_VariableDeclaration(KNativePointer contextPtr, KNativePointer variablePtr)
66
+ {
67
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
68
+ auto variable = reinterpret_cast<es2panda_Variable*>(variablePtr);
69
+
70
+ return GetImpl()->VariableDeclaration(context, variable);
71
+ }
72
+ KOALA_INTEROP_2(VariableDeclaration, KNativePointer, KNativePointer, KNativePointer)
73
+
74
+ KNativePointer impl_DeclNode(KNativePointer contextPtr, KNativePointer declPtr)
75
+ {
76
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
77
+ auto decl = reinterpret_cast<es2panda_Declaration*>(declPtr);
78
+
79
+ return GetImpl()->DeclNode(context, decl);
80
+ }
81
+ KOALA_INTEROP_2(DeclNode, KNativePointer, KNativePointer, KNativePointer)
82
+
83
+ KNativePointer impl_AstNodeScopeConst(KNativePointer contextPtr, KNativePointer nodePtr)
84
+ {
85
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
86
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
87
+ return GetImpl()->AstNodeScopeConst(context, node);
88
+ }
89
+ KOALA_INTEROP_2(AstNodeScopeConst, KNativePointer, KNativePointer, KNativePointer)
90
+
91
+ KNativePointer impl_ScopeSetParent(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer parentPtr)
92
+ {
93
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
94
+ auto node = reinterpret_cast<es2panda_Scope*>(nodePtr);
95
+ auto parent = reinterpret_cast<es2panda_Scope*>(parentPtr);
96
+ GetImpl()->ScopeSetParent(context, node, parent);
97
+ return node;
98
+ }
99
+ KOALA_INTEROP_3(ScopeSetParent, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
100
+
101
+ KNativePointer impl_CreateNumberLiteral(KNativePointer contextPtr, KDouble value)
102
+ {
103
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
104
+
105
+ return GetImpl()->CreateNumberLiteral(context, value);
106
+ }
107
+ KOALA_INTEROP_2(CreateNumberLiteral, KNativePointer, KNativePointer, KDouble)
108
+
109
+ KNativePointer impl_ETSParserCreateExpression(KNativePointer contextPtr, KStringPtr& sourceCodePtr, KInt flagsT)
110
+ {
111
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
112
+ auto flags = static_cast<Es2pandaExpressionParseFlags>(flagsT);
113
+
114
+ return GetImpl()->ETSParserCreateExpression(context, getStringCopy(sourceCodePtr), flags);
115
+ }
116
+ KOALA_INTEROP_3(ETSParserCreateExpression, KNativePointer, KNativePointer, KStringPtr, KInt)
117
+
118
+ KBoolean impl_IsProgram(KNativePointer contextPtr, KNativePointer nodePtr)
119
+ {
120
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
121
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
122
+ return GetImpl()->AstNodeIsProgramConst(context, node);
123
+ }
124
+ KOALA_INTEROP_2(IsProgram, KBoolean, KNativePointer, KNativePointer)
125
+
126
+ KBoolean impl_IsBlockStatement(KNativePointer nodePtr)
127
+ {
128
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
129
+ return GetImpl()->IsBlockStatement(node);
130
+ }
131
+ KOALA_INTEROP_1(IsBlockStatement, KBoolean, KNativePointer)
132
+
133
+ KNativePointer impl_ProceedToState(KNativePointer contextPtr, KInt state)
134
+ {
135
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
136
+ return GetImpl()->ProceedToState(context, intToState(state));
137
+ }
138
+ KOALA_INTEROP_2(ProceedToState, KNativePointer, KNativePointer, KInt)
139
+
140
+ KNativePointer impl_ContextProgram(KNativePointer contextPtr)
141
+ {
142
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
143
+ return GetImpl()->ContextProgram(context);
144
+ }
145
+ KOALA_INTEROP_1(ContextProgram, KNativePointer, KNativePointer)
146
+
147
+ KNativePointer impl_ProgramAst(KNativePointer contextPtr, KNativePointer programPtr)
148
+ {
149
+ auto context = reinterpret_cast<es2panda_Context*>(programPtr);
150
+ auto program = reinterpret_cast<es2panda_Program*>(programPtr);
151
+ return GetImpl()->ProgramAst(context, program);
152
+ }
153
+ KOALA_INTEROP_2(ProgramAst, KNativePointer, KNativePointer, KNativePointer)
154
+
155
+ KBoolean impl_IsIdentifier(KNativePointer nodePtr)
156
+ {
157
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
158
+ return GetImpl()->IsIdentifier(node);
159
+ }
160
+ KOALA_INTEROP_1(IsIdentifier, KBoolean, KNativePointer)
161
+
162
+ KNativePointer impl_CreateContextFromString(KNativePointer configPtr, KStringPtr& sourcePtr, KStringPtr& filenamePtr)
163
+ {
164
+ auto config = reinterpret_cast<es2panda_Config*>(configPtr);
165
+ return GetImpl()->CreateContextFromString(config, sourcePtr.data(), filenamePtr.data());
166
+ }
167
+ KOALA_INTEROP_3(CreateContextFromString, KNativePointer, KNativePointer, KStringPtr, KStringPtr)
168
+
169
+ KNativePointer impl_CreateContextFromFile(KNativePointer configPtr, KStringPtr& filenamePtr)
170
+ {
171
+ auto config = reinterpret_cast<es2panda_Config*>(configPtr);
172
+ return GetImpl()->CreateContextFromFile(config, getStringCopy(filenamePtr));
173
+ }
174
+ KOALA_INTEROP_2(CreateContextFromFile, KNativePointer, KNativePointer, KStringPtr)
175
+
176
+ KInt impl_ContextState(KNativePointer contextPtr)
177
+ {
178
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
179
+
180
+ return static_cast<KInt>(GetImpl()->ContextState(context));
181
+ }
182
+ KOALA_INTEROP_1(ContextState, KInt, KNativePointer)
183
+
184
+ KNativePointer impl_ContextErrorMessage(KNativePointer contextPtr)
185
+ {
186
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
187
+
188
+ return new string(GetImpl()->ContextErrorMessage(context));
189
+ }
190
+ KOALA_INTEROP_1(ContextErrorMessage, KNativePointer, KNativePointer)
191
+
192
+ KNativePointer impl_CallExpressionSignature(KNativePointer context, KNativePointer classInstance)
193
+ {
194
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
195
+ const auto _classInstance = reinterpret_cast<es2panda_AstNode*>(classInstance);
196
+ const auto result = GetImpl()->CallExpressionSignature(_context, _classInstance);
197
+ return result;
198
+ }
199
+ KOALA_INTEROP_2(CallExpressionSignature, KNativePointer, KNativePointer, KNativePointer)
200
+
201
+ KNativePointer impl_SignatureFunction(KNativePointer context, KNativePointer classInstance)
202
+ {
203
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
204
+ const auto _classInstance = reinterpret_cast<es2panda_Signature*>(classInstance);
205
+ const auto result = GetImpl()->SignatureFunction(_context, _classInstance);
206
+ return result;
207
+ }
208
+ KOALA_INTEROP_2(SignatureFunction, KNativePointer, KNativePointer, KNativePointer)
209
+
210
+ KNativePointer impl_DeclarationFromIdentifier(KNativePointer context, KNativePointer identifier)
211
+ {
212
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
213
+ const auto _identifier = reinterpret_cast<es2panda_AstNode*>(identifier);
214
+ const auto result = GetImpl()->DeclarationFromIdentifier(_context, _identifier);
215
+ return result;
216
+ }
217
+ KOALA_INTEROP_2(DeclarationFromIdentifier, KNativePointer, KNativePointer, KNativePointer)
218
+
219
+ static KNativePointer impl_ProgramExternalSources(KNativePointer contextPtr, KNativePointer instancePtr)
220
+ {
221
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
222
+ auto&& instance = reinterpret_cast<es2panda_Program *>(instancePtr);
223
+ std::size_t source_len = 0;
224
+ auto external_sources = GetImpl()->ProgramExternalSources(context, instance, &source_len);
225
+ return new std::vector<void*>(external_sources, external_sources + source_len);
226
+ }
227
+ KOALA_INTEROP_2(ProgramExternalSources, KNativePointer, KNativePointer, KNativePointer);
228
+
229
+ static KNativePointer impl_ExternalSourceName(KNativePointer instance)
230
+ {
231
+ auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource *>(instance);
232
+ auto&& _result_ = GetImpl()->ExternalSourceName(_instance_);
233
+ return new std::string(_result_);
234
+ }
235
+ KOALA_INTEROP_1(ExternalSourceName, KNativePointer, KNativePointer);
236
+
237
+ static KNativePointer impl_ExternalSourcePrograms(KNativePointer instance)
238
+ {
239
+ auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource *>(instance);
240
+ std::size_t program_len = 0;
241
+ auto programs = GetImpl()->ExternalSourcePrograms(_instance_, &program_len);
242
+ return new std::vector<void*>(programs, programs + program_len);
243
+ }
244
+ KOALA_INTEROP_1(ExternalSourcePrograms, KNativePointer, KNativePointer);
245
+
246
+ KBoolean impl_IsClassProperty(KNativePointer nodePtr)
247
+ {
248
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
249
+ return GetImpl()->IsClassProperty(node);
250
+ }
251
+ KOALA_INTEROP_1(IsClassProperty, KBoolean, KNativePointer)
252
+
253
+ KBoolean impl_IsETSUnionType(KNativePointer nodePtr)
254
+ {
255
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
256
+ return GetImpl()->IsETSUnionType(node);
257
+ }
258
+ KOALA_INTEROP_1(IsETSUnionType, KBoolean, KNativePointer)
259
+
260
+ KBoolean impl_IsETSFunctionType(KNativePointer nodePtr)
261
+ {
262
+ auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
263
+ return GetImpl()->IsETSFunctionType(node);
264
+ }
265
+ KOALA_INTEROP_1(IsETSFunctionType, KBoolean, KNativePointer)