@idlizer/arktscgen 2.1.10-arktscgen-6 → 2.1.10-arktscgen-9

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 (41) hide show
  1. package/build/libarkts-copy/generator/options.json5 +88 -97
  2. package/build/libarkts-copy/native/meson.build +60 -7
  3. package/build/libarkts-copy/native/mingw.cross +2 -5
  4. package/build/libarkts-copy/native/src/bridges.cpp +175 -0
  5. package/build/libarkts-copy/native/src/{common.cc → common.cpp} +176 -139
  6. package/build/libarkts-copy/native/src/common.h +22 -37
  7. package/build/libarkts-copy/native/src/{memoryTracker.cc → memoryTracker.cpp} +9 -3
  8. package/build/libarkts-copy/package.json +5 -9
  9. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +0 -56
  10. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +8 -3
  11. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +4 -0
  12. package/build/libarkts-copy/src/arkts-api/index.ts +0 -2
  13. package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +1 -1
  14. package/build/libarkts-copy/src/arkts-api/node-utilities/OverloadDeclaration.ts +29 -0
  15. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +25 -59
  16. package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +8 -13
  17. package/build/libarkts-copy/src/arkts-api/plugins.ts +5 -12
  18. package/build/libarkts-copy/src/arkts-api/static/global.ts +8 -4
  19. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +4 -4
  20. package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +9 -12
  21. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +10 -34
  22. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +8 -5
  23. package/build/libarkts-copy/src/index.ts +0 -2
  24. package/build/libarkts-copy/src/plugin-utils.ts +60 -34
  25. package/build/libarkts-copy/src/reexport-for-generated.ts +3 -2
  26. package/build/libarkts-copy/tsconfig.json +0 -3
  27. package/lib/index.js +505 -216
  28. package/package.json +3 -4
  29. package/templates/Es2pandaNativeModule.ts +1 -0
  30. package/templates/{bridges.cc → bridges.cpp} +1 -1
  31. package/templates/peer.ts +1 -0
  32. package/build/libarkts-copy/native/src/bridges.cc +0 -443
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +0 -45
  34. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +0 -1250
  35. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +0 -125
  36. package/build/libarkts-copy/src/ts-api/index.ts +0 -27
  37. package/build/libarkts-copy/src/ts-api/static/enums.ts +0 -18
  38. package/build/libarkts-copy/src/ts-api/types.ts +0 -1075
  39. package/build/libarkts-copy/src/ts-api/utilities/private.ts +0 -292
  40. package/build/libarkts-copy/src/ts-api/utilities/public.ts +0 -55
  41. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +0 -139
@@ -26,9 +26,9 @@
26
26
  "es2panda_Config",
27
27
  "es2panda_Context",
28
28
  "es2panda_GlobalContext",
29
+ "es2panda_ExternalSource",
29
30
  ],
30
31
  "full": [
31
- "es2panda_ExternalSource",
32
32
  "es2panda_OverloadInfo",
33
33
 
34
34
  'NodeTransformer',
@@ -41,8 +41,14 @@
41
41
  'PropertyProcessor',
42
42
  'PropertyTraverser',
43
43
 
44
- 'checker.*',
45
- 'varbinder.*',
44
+ 'checker.ETSFunctionType', // conflict with ir
45
+ 'checker.ETSUnionType',
46
+ 'checker.ETSNullType',
47
+ 'checker.ETSUndefinedType',
48
+ 'checker.TypeParameter', // invalid args for a bridge
49
+
50
+ // ETSParser has no classInstance(receiver) argument,
51
+ // may be fixed in generator.
46
52
  'parser.*',
47
53
  'util.*',
48
54
  'gen.*',
@@ -51,21 +57,47 @@
51
57
 
52
58
  'parser.Program!',
53
59
  'es2panda.ArkTsConfig!',
54
- // Do not support node type
55
- //'varbinder.FunctionDecl!',
56
- //'varbinder.InterfaceDecl!',
57
- // MemberExpression has checker.ETSFunctionType ExtensionAccessorTypeConst(es2panda_Context context);
58
- //'checker.ETSFunctionType!',
59
- //'ir.ETSFunctionType',
60
60
 
61
- 'ir.Annotated',
62
- 'ir.AnnotationAllowed',
61
+ "varbinder.EnumVariable", // use typedef to union
62
+ "varbinder.ETSBinder", // char**
63
+ "varbinder.AnnotationUsage", // duplicate bridge
64
+ // These classes are descendants of AstNode
65
+ // and has a astTypeNode hint parameter in ctor
66
+ // because they are in another namespace (classes
67
+ // that have descendants do not have this parameter).
68
+ // Changing this behaviour in generator may cause regression.
69
+ "varbinder.InterfaceDecl",
70
+ "varbinder.FunctionDecl",
71
+ "varbinder.RecordTable",
72
+
73
+ // C api needs AstNode descendant but it isn't.
74
+ // TypedAstNode is.
63
75
  'ir.Typed',
76
+ // These are empty.
77
+ 'ir.Annotated',
64
78
  'ir.VectorIterationGuard',
65
79
 
66
80
  'VoidPtr',
67
81
  ],
68
82
  "partial": [
83
+ {
84
+ interface: "TypeNode",
85
+ methods: [
86
+ "GetType", // overlap base
87
+ ]
88
+ },
89
+ {
90
+ interface: "Scope",
91
+ methods: [
92
+ "MergeBindings", // char**
93
+ ]
94
+ },
95
+ {
96
+ interface: "ModuleScope",
97
+ methods: [
98
+ "LocalExportsConst" // char**
99
+ ]
100
+ },
69
101
  {
70
102
  interface: "es2panda_Impl",
71
103
  methods: [
@@ -74,9 +106,7 @@
74
106
 
75
107
  // Handwritten bridges
76
108
  "ConfigGetOptions", // handwritten class
77
- "ExternalSourceName", // handwritten class and used in panda API
78
109
  "SourcePositionCol", // not in idl
79
- "ExternalSourcePrograms", // Wrong args
80
110
  "LogDiagnostic", // not in idl
81
111
  "CreateDiagnosticKind",
82
112
  "GetSemanticErrors",
@@ -84,24 +114,16 @@
84
114
  "GetPluginErrors",
85
115
  "GetWarnings",
86
116
  "NumberLiteralStrConst",
87
- "MemInitialize",
88
- "MemFinalize",
89
117
  ],
90
118
  },
91
119
  {
92
120
  interface: "MethodDefinition",
93
121
  methods: [
94
- "GetOverloadInfo", // return type is wrong
95
- ]
96
- },
97
- {
98
- interface: "Decl", // handwritten bridge
99
- methods: [
100
- "Node"
122
+ "GetOverloadInfo", // returns es2panda_OverloadInfo which is data class
101
123
  ]
102
124
  },
103
125
  {
104
- interface: "ETSParser", // handwritten bridge
126
+ interface: "ETSParser", // handwritten bridge, fully ignored above.
105
127
  methods: [
106
128
  "BuildImportDeclaration",
107
129
  "CreateExpression",
@@ -109,37 +131,6 @@
109
131
  "GetImportPathManager",
110
132
  ]
111
133
  },
112
- {
113
- interface: "Program", // handwritten bridge
114
- methods: [
115
- "DirectExternalSources",
116
- "ExternalSources",
117
- ]
118
- },
119
- {
120
- interface: "Scope", // handwritten bridge
121
- methods: [
122
- "SetParent",
123
- ]
124
- },
125
- {
126
- interface: "Signature", // handwritten bridge
127
- methods: [
128
- "Function",
129
- ]
130
- },
131
- {
132
- interface: "TSInterfaceBody", // handwritten bridge
133
- methods: [
134
- "BodyPtr",
135
- ]
136
- },
137
- {
138
- interface: "AnnotationDeclaration",
139
- methods: [
140
- "PropertiesPtrConst" // interfaces create-to-param matching
141
- ]
142
- },
143
134
  {
144
135
  interface: "NumberLiteral",
145
136
  methods: [
@@ -149,33 +140,16 @@
149
140
  "SetFloat"
150
141
  ]
151
142
  },
152
- {
153
- interface: "AnnotationUsage",
154
- methods: [
155
- "PropertiesPtrConst" // interfaces create-to-param matching
156
- ]
157
- },
158
- {
159
- interface: "TSInterfaceBody",
160
- methods: [
161
- "BodyPtr" // interfaces create-to-param matching
162
- ]
163
- },
164
- {
165
- interface: "Signature",
166
- methods: [
167
- "ProtectionFlagConst" // u8
168
- ]
169
- },
170
143
  {
171
144
  interface: "ETSReExportDeclaration",
172
145
  methods: [
173
- "Create", // sequence<String>
174
- "Update", // sequence<String>
175
- "GetUserPathsConst" // sequence<String>
146
+ "Create", // char**
147
+ "Update", // char**
148
+ "GetUserPathsConst" // returns sequence<String>
176
149
  ]
177
150
  },
178
151
  {
152
+ // Unclear why it's ignored
179
153
  interface: "CharLiteral",
180
154
  methods: [
181
155
  "Create1", // KShort,
@@ -183,47 +157,61 @@
183
157
  "CharConst", // KShort
184
158
  ]
185
159
  },
186
- {
187
- interface: "ForUpdateStatement",
188
- methods: [
189
- "Update" // forbidden naming
190
- ]
191
- },
192
- {
193
- interface: "CallExpression",
194
- methods: [
195
- "Update" // differs from handwritten
196
- ]
197
- },
198
160
  {
199
161
  interface: "TryStatement",
200
162
  methods: [
201
- "AddFinalizerInsertion" // idl missing const
202
- ]
203
- },
204
- {
205
- interface: "MemberExpression",
206
- methods: [
207
- "SetExtensionAccessorType" // ETSFunction type ambiguity
163
+ "AddFinalizerInsertion" // non-const to const return conversion
208
164
  ]
209
165
  },
210
166
  {
211
167
  interface: "ArkTsConfig",
212
168
  methods: [
213
- "EntriesConst",
214
169
  "FilesConst",
215
- "Parse",
216
170
  ]
217
171
  },
218
172
  {
219
173
  interface: "ClassDefinition",
220
174
  methods: [
221
- "SetBody", // handwritten
175
+ "SetBody", // handwritten, no such method in idl.
176
+ // probably, an optimized version.
222
177
  ]
223
178
  },
224
179
  ]
225
180
  },
226
181
  nonNullable: [
182
+ {
183
+ name: "es2panda_Impl",
184
+ methods: [
185
+ {
186
+ name: "CreateContextFromString",
187
+ types: ["returnType"],
188
+ },
189
+ {
190
+ name: "CreateContextFromFile",
191
+ types: ["returnType"],
192
+ },
193
+ {
194
+ name: "CreateCacheContextFromFile",
195
+ types: ["returnType"],
196
+ },
197
+ {
198
+ name: "CreateContextGenerateAbcForExternalSourceFiles",
199
+ types: ["returnType"],
200
+ },
201
+ {
202
+ name: "CreateContextFromStringWithHistory",
203
+ types: ["returnType"],
204
+ },
205
+ {
206
+ name: "ContextProgram",
207
+ types: ["returnType"],
208
+ },
209
+ {
210
+ name: "CreateGlobalContext",
211
+ types: ["returnType"],
212
+ },
213
+ ],
214
+ },
227
215
  {
228
216
  name: "ArrowFunctionExpression",
229
217
  methods: [
@@ -601,6 +589,9 @@
601
589
  {
602
590
  name: "annotations",
603
591
  },
592
+ {
593
+ name: "modifierFlags",
594
+ },
604
595
  ],
605
596
  },
606
597
  ],
@@ -23,10 +23,10 @@ project(
23
23
  is_cross = get_option('cross_compile')
24
24
 
25
25
  sources = [
26
- './src/common.cc',
27
- './src/memoryTracker.cc',
28
- './src/bridges.cc',
29
- '../generated/native/bridges.cc',
26
+ './src/common.cpp',
27
+ './src/memoryTracker.cpp',
28
+ './src/bridges.cpp',
29
+ '../generated/native/bridges.cpp',
30
30
  get_option('interop_src_dir') / 'common-interop.cpp',
31
31
  get_option('interop_src_dir') / 'callback-resource.cpp',
32
32
  get_option('interop_src_dir') / 'interop-logging.cpp',
@@ -40,12 +40,66 @@ cflags = [
40
40
  '-DKOALA_NAPI',
41
41
  ]
42
42
 
43
+ ldflags = []
44
+
43
45
  if (host_machine.system() == 'windows')
44
46
  cflags += ['-DKOALA_WINDOWS']
45
47
  # apply node.exe symbol loading hook
46
48
  sources += [
47
49
  get_option('interop_src_dir') / 'napi/win-dynamic-node.cpp'
48
50
  ]
51
+
52
+ cflags += [
53
+ '-nostdinc++',
54
+ '-I/home/huawei/Projects/idlize/external/arkoala-arkts/tools/compiler/llvm-toolchain/include/c++/v1',
55
+ '-I/home/huawei/Projects/idlize/external/arkoala-arkts/tools/compiler/llvm-toolchain/include/x86_64-unknown-linux-gnu/c++/v1',
56
+ '-std=c++17',
57
+ '-Wall',
58
+ '-Werror',
59
+ '-Wno-unused-variable',
60
+ '-Wno-unused-command-line-argument',
61
+ '-fPIC',
62
+ '-Wno-error=deprecated-copy',
63
+ '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang',
64
+ '-ftrivial-auto-var-init=zero',
65
+ '-fcolor-diagnostics',
66
+ '-fmerge-all-constants',
67
+ '-Xclang',
68
+ '-mllvm',
69
+ '-Xclang',
70
+ '-instcombine-lower-dbg-declare=0',
71
+ '-no-canonical-prefixes',
72
+ '-fuse-ld=lld',
73
+ '-fno-stack-protector',
74
+ '-fno-strict-aliasing',
75
+ '-Wno-builtin-macro-redefined',
76
+ '-fms-extensions',
77
+ '-static',
78
+ '-rtlib=compiler-rt',
79
+ '-stdlib=libc++',
80
+ '-lunwind',
81
+ '-lpthread',
82
+ '-Qunused-arguments',
83
+ '-D__CUSTOM_SECURITY_LIBRARY',
84
+ '-fno-exceptions',
85
+ '-fno-rtti',
86
+ ]
87
+
88
+ ldflags += [
89
+ '-Wl,--fatal-warnings',
90
+ '-fPIC',
91
+ '-Wl,--as-needed',
92
+ '-fuse-ld=lld',
93
+ '-Wl,--icf=all',
94
+ '-m64',
95
+ '-static',
96
+ '-rtlib=compiler-rt',
97
+ '-stdlib=libc++',
98
+ '-std=c++17',
99
+ '-lunwind',
100
+ '-lpthread',
101
+ '-Qunused-arguments',
102
+ ]
49
103
  else
50
104
  cflags += ['-DKOALA_LINUX']
51
105
  endif
@@ -61,7 +115,6 @@ arch = target_machine.cpu()
61
115
  arch = archs.get(arch, arch)
62
116
 
63
117
  cflags_cross = []
64
- cflags_host = []
65
118
  suffix_host = '_' + os + '_' + arch
66
119
  suffix_cross = ''
67
120
 
@@ -111,8 +164,8 @@ shared_library(
111
164
  node_api_headers_dir / 'node-api-headers/include',
112
165
  node_addon_api_dir / 'node-addon-api',
113
166
  ],
114
- cpp_args: cflags + cflags_host,
115
- link_args: [cflags_host],
167
+ cpp_args: cflags,
168
+ link_args: ldflags,
116
169
  dependencies: []
117
170
  )
118
171
 
@@ -12,8 +12,8 @@
12
12
  # limitations under the License.
13
13
 
14
14
  [binaries]
15
- c = 'x86_64-w64-mingw32-gcc'
16
- cpp = 'x86_64-w64-mingw32-g++'
15
+ c = ['/home/huawei/Projects/idlize/external/arkoala-arkts/tools/compiler/llvm-toolchain/bin/clang', '-target', 'x86_64-pc-windows-gnu']
16
+ cpp = ['/home/huawei/Projects/idlize/external/arkoala-arkts/tools/compiler/llvm-toolchain/bin/clang++', '-target', 'x86_64-pc-windows-gnu', '-fuse-ld=lld', '-Wl,--icf=all']
17
17
  ar = 'x86_64-w64-mingw32-ar'
18
18
  windres = 'x86_64-w64-mingw32-windres'
19
19
  strip = 'x86_64-w64-mingw32-strip'
@@ -24,6 +24,3 @@ system = 'windows'
24
24
  cpu_family = 'x86_64'
25
25
  cpu = 'x86_64'
26
26
  endian = 'little'
27
-
28
- [properties]
29
- cpp_link_args = ['-lpsapi']
@@ -0,0 +1,175 @@
1
+ /*
2
+ * Copyright (c) 2024-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
+ #include <mutex>
17
+ #include <set>
18
+ #include <string>
19
+
20
+ #include "common.h"
21
+
22
+ /** XXX: If you add or remove methods that exist in C API,
23
+ * please change generator/options.json5 accordingly.
24
+ */
25
+
26
+ KNativePointer impl_ETSParserCreateExpression(KNativePointer contextPtr, KStringPtr& sourceCodePtr, KInt flagsT)
27
+ {
28
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
29
+ auto flags = static_cast<Es2pandaExpressionParseFlags>(flagsT);
30
+
31
+ return GetImpl()->ETSParserCreateExpression(context, getStringCopy(sourceCodePtr), flags);
32
+ }
33
+ KOALA_INTEROP_3(ETSParserCreateExpression, KNativePointer, KNativePointer, KStringPtr, KInt)
34
+
35
+ static KNativePointer impl_ProgramSourceFilePath(KNativePointer contextPtr, KNativePointer instancePtr)
36
+ {
37
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
38
+ auto&& instance = reinterpret_cast<es2panda_Program*>(instancePtr);
39
+ auto&& result = GetImpl()->ProgramSourceFilePathConst(context, instance);
40
+ return StageArena::Strdup(result);
41
+ }
42
+ KOALA_INTEROP_2(ProgramSourceFilePath, KNativePointer, KNativePointer, KNativePointer);
43
+
44
+ KNativePointer impl_ETSParserBuildImportDeclaration(KNativePointer context, KInt importKinds,
45
+ KNativePointerArray specifiers, KUInt specifiersSequenceLength, KNativePointer source, KNativePointer program,
46
+ KInt importFlag)
47
+ {
48
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
49
+ const auto _kinds = static_cast<Es2pandaImportKinds>(importKinds);
50
+ const auto _specifiers = reinterpret_cast<es2panda_AstNode**>(specifiers);
51
+ const auto _specifiersSequenceLength = static_cast<size_t>(specifiersSequenceLength);
52
+ const auto _source = reinterpret_cast<es2panda_AstNode*>(source);
53
+ const auto _program = reinterpret_cast<es2panda_Program*>(program);
54
+ const auto _importFlag = static_cast<Es2pandaImportFlags>(importFlag);
55
+
56
+ return GetImpl()->ETSParserBuildImportDeclaration(
57
+ _context, _kinds, _specifiers, _specifiersSequenceLength, _source, _program, _importFlag);
58
+ }
59
+ KOALA_INTEROP_7(ETSParserBuildImportDeclaration, KNativePointer, KNativePointer, KInt, KNativePointerArray, KUInt,
60
+ KNativePointer, KNativePointer, KInt)
61
+
62
+ KNativePointer impl_ETSParserGetImportPathManager(KNativePointer contextPtr)
63
+ {
64
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
65
+ return GetImpl()->ETSParserGetImportPathManager(context);
66
+ }
67
+ KOALA_INTEROP_1(ETSParserGetImportPathManager, KNativePointer, KNativePointer);
68
+
69
+ KInt impl_SourcePositionCol(KNativePointer context, KNativePointer instance)
70
+ {
71
+ auto&& _context_ = reinterpret_cast<es2panda_Context*>(context);
72
+ auto&& _instance_ = reinterpret_cast<es2panda_SourcePosition*>(instance);
73
+ return GetImpl()->SourcePositionCol(_context_, _instance_);
74
+ }
75
+ KOALA_INTEROP_2(SourcePositionCol, KInt, KNativePointer, KNativePointer);
76
+
77
+ KNativePointer impl_ConfigGetOptions(KNativePointer config)
78
+ {
79
+ const auto _config = reinterpret_cast<es2panda_Config*>(config);
80
+ auto result = GetImpl()->ConfigGetOptions(_config);
81
+ return (void*)result;
82
+ }
83
+ KOALA_INTEROP_1(ConfigGetOptions, KNativePointer, KNativePointer)
84
+
85
+ KNativePointer impl_OptionsArkTsConfig(KNativePointer context, KNativePointer options)
86
+ {
87
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
88
+ const auto _options = reinterpret_cast<es2panda_Options*>(options);
89
+ auto result = GetImpl()->OptionsUtilArkTSConfigConst(_context, _options);
90
+ return (void*)result;
91
+ }
92
+ KOALA_INTEROP_2(OptionsArkTsConfig, KNativePointer, KNativePointer, KNativePointer)
93
+
94
+ // From koala-wrapper
95
+ // Improve: check if some code should be generated
96
+
97
+ std::set<std::string> globalStructInfo;
98
+ #ifdef _GLIBCXX_HAS_GTHREADS
99
+ std::mutex g_structMutex;
100
+ #endif
101
+
102
+ void impl_InsertGlobalStructInfo(KNativePointer contextPtr, KStringPtr& instancePtr)
103
+ {
104
+ #ifdef _GLIBCXX_HAS_GTHREADS
105
+ std::lock_guard<std::mutex> lock(g_structMutex);
106
+ #endif
107
+ globalStructInfo.insert(getStringCopy(instancePtr));
108
+ return;
109
+ }
110
+ KOALA_INTEROP_V2(InsertGlobalStructInfo, KNativePointer, KStringPtr);
111
+
112
+ KBoolean impl_HasGlobalStructInfo(KNativePointer contextPtr, KStringPtr& instancePtr)
113
+ {
114
+ #ifdef _GLIBCXX_HAS_GTHREADS
115
+ std::lock_guard<std::mutex> lock(g_structMutex);
116
+ #endif
117
+ return globalStructInfo.count(getStringCopy(instancePtr));
118
+ }
119
+ KOALA_INTEROP_2(HasGlobalStructInfo, KBoolean, KNativePointer, KStringPtr);
120
+
121
+ KNativePointer impl_ClassVariableDeclaration(KNativePointer context, KNativePointer classInstance)
122
+ {
123
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
124
+ const auto _classInstance = reinterpret_cast<es2panda_AstNode*>(classInstance);
125
+ auto _typedTsType = GetImpl()->TypedTsType(_context, _classInstance);
126
+ if (_typedTsType == nullptr) {
127
+ return nullptr;
128
+ }
129
+ const auto _instanceType = reinterpret_cast<es2panda_Type*>(_typedTsType);
130
+ auto _typeVar = GetImpl()->TypeVariable(_context, _instanceType);
131
+ if (_typeVar == nullptr) {
132
+ return nullptr;
133
+ }
134
+ const auto result = reinterpret_cast<es2panda_Declaration*>(GetImpl()->VariableDeclaration(_context, _typeVar));
135
+ const auto declNode = GetImpl()->DeclNode(_context, result);
136
+ return declNode;
137
+ }
138
+ KOALA_INTEROP_2(ClassVariableDeclaration, KNativePointer, KNativePointer, KNativePointer)
139
+
140
+ KNativePointer impl_ETSParserGetGlobalProgramAbsName(KNativePointer contextPtr)
141
+ {
142
+ auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
143
+ auto result = GetImpl()->ETSParserGetGlobalProgramAbsName(context);
144
+ return new std::string(result); // O_o
145
+ }
146
+ KOALA_INTEROP_1(ETSParserGetGlobalProgramAbsName, KNativePointer, KNativePointer)
147
+
148
+ KNativePointer impl_CreateDiagnosticKind(KNativePointer context, KStringPtr& message, KInt type)
149
+ {
150
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
151
+ const auto _message = getStringCopy(message);
152
+ const auto _type = static_cast<es2panda_PluginDiagnosticType>(type);
153
+ return const_cast<es2panda_DiagnosticKind*>(GetImpl()->CreateDiagnosticKind(_context, _message, _type));
154
+ }
155
+ KOALA_INTEROP_3(CreateDiagnosticKind, KNativePointer, KNativePointer, KStringPtr, KInt)
156
+
157
+ void impl_LogDiagnostic(
158
+ KNativePointer context, KNativePointer kind, KStringArray& argvPtr, KInt argc, KNativePointer pos)
159
+ {
160
+ auto&& _context_ = reinterpret_cast<es2panda_Context*>(context);
161
+ auto&& _kind_ = reinterpret_cast<es2panda_DiagnosticKind*>(kind);
162
+ auto&& _pos_ = reinterpret_cast<es2panda_SourcePosition*>(pos);
163
+ GetImpl()->LogDiagnostic(_context_, _kind_, getStringArray(argvPtr), argc, _pos_);
164
+ }
165
+ KOALA_INTEROP_V5(LogDiagnostic, KNativePointer, KNativePointer, KStringArray, KInt, KNativePointer)
166
+
167
+ KNativePointer impl_AnnotationUsageIrPropertiesPtrConst(KNativePointer context, KNativePointer receiver)
168
+ {
169
+ const auto _context = reinterpret_cast<es2panda_Context*>(context);
170
+ const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
171
+ std::size_t length;
172
+ auto result = GetImpl()->AnnotationUsageIrPropertiesPtrConst(_context, _receiver, &length);
173
+ return StageArena::CloneVector(result, length);
174
+ }
175
+ KOALA_INTEROP_2(AnnotationUsageIrPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer);