@idlizer/arktscgen 2.1.10-arktscgen-7 → 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.
- package/build/libarkts-copy/generator/options.json5 +88 -97
- package/build/libarkts-copy/native/meson.build +56 -3
- package/build/libarkts-copy/native/mingw.cross +2 -5
- package/build/libarkts-copy/native/src/bridges.cpp +1 -269
- package/build/libarkts-copy/native/src/common.cpp +49 -67
- package/build/libarkts-copy/native/src/common.h +0 -15
- package/build/libarkts-copy/package.json +4 -8
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +0 -56
- package/build/libarkts-copy/src/arkts-api/index.ts +0 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +25 -58
- package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +8 -13
- package/build/libarkts-copy/src/arkts-api/plugins.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/static/global.ts +8 -1
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +9 -12
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +3 -0
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +8 -5
- package/build/libarkts-copy/src/index.ts +0 -1
- package/build/libarkts-copy/src/plugin-utils.ts +2 -1
- package/build/libarkts-copy/src/reexport-for-generated.ts +2 -1
- package/lib/index.js +305 -198
- package/package.json +3 -4
- package/templates/Es2pandaNativeModule.ts +1 -0
- package/templates/peer.ts +1 -0
|
@@ -18,71 +18,11 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include "common.h"
|
|
21
|
-
#include "memoryTracker.h"
|
|
22
21
|
|
|
23
22
|
/** XXX: If you add or remove methods that exist in C API,
|
|
24
23
|
* please change generator/options.json5 accordingly.
|
|
25
24
|
*/
|
|
26
25
|
|
|
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(
|
|
37
|
-
KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer returnLen)
|
|
38
|
-
{
|
|
39
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
40
|
-
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
41
|
-
std::size_t params_len = 0;
|
|
42
|
-
auto annotations = GetImpl()->AnnotationAllowedAnnotations(context, node, ¶ms_len);
|
|
43
|
-
return StageArena::CloneVector(annotations, params_len);
|
|
44
|
-
}
|
|
45
|
-
KOALA_INTEROP_3(AnnotationAllowedAnnotations, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
|
|
46
|
-
|
|
47
|
-
KNativePointer impl_AnnotationAllowedAnnotationsConst(
|
|
48
|
-
KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer returnLen)
|
|
49
|
-
{
|
|
50
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
51
|
-
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
52
|
-
std::size_t params_len = 0;
|
|
53
|
-
auto annotations = GetImpl()->AnnotationAllowedAnnotationsConst(context, node, ¶ms_len);
|
|
54
|
-
return StageArena::CloneVector(annotations, params_len);
|
|
55
|
-
}
|
|
56
|
-
KOALA_INTEROP_3(AnnotationAllowedAnnotationsConst, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
|
|
57
|
-
|
|
58
|
-
KNativePointer impl_VariableDeclaration(KNativePointer contextPtr, KNativePointer variablePtr)
|
|
59
|
-
{
|
|
60
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
61
|
-
auto variable = reinterpret_cast<es2panda_Variable*>(variablePtr);
|
|
62
|
-
|
|
63
|
-
return GetImpl()->VariableDeclaration(context, variable);
|
|
64
|
-
}
|
|
65
|
-
KOALA_INTEROP_2(VariableDeclaration, KNativePointer, KNativePointer, KNativePointer)
|
|
66
|
-
|
|
67
|
-
KNativePointer impl_DeclNode(KNativePointer contextPtr, KNativePointer declPtr)
|
|
68
|
-
{
|
|
69
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
70
|
-
auto decl = reinterpret_cast<es2panda_Declaration*>(declPtr);
|
|
71
|
-
|
|
72
|
-
return GetImpl()->DeclNode(context, decl);
|
|
73
|
-
}
|
|
74
|
-
KOALA_INTEROP_2(DeclNode, KNativePointer, KNativePointer, KNativePointer)
|
|
75
|
-
|
|
76
|
-
KNativePointer impl_ScopeSetParent(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer parentPtr)
|
|
77
|
-
{
|
|
78
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
79
|
-
auto node = reinterpret_cast<es2panda_Scope*>(nodePtr);
|
|
80
|
-
auto parent = reinterpret_cast<es2panda_Scope*>(parentPtr);
|
|
81
|
-
GetImpl()->ScopeSetParent(context, node, parent);
|
|
82
|
-
return node;
|
|
83
|
-
}
|
|
84
|
-
KOALA_INTEROP_3(ScopeSetParent, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
|
|
85
|
-
|
|
86
26
|
KNativePointer impl_ETSParserCreateExpression(KNativePointer contextPtr, KStringPtr& sourceCodePtr, KInt flagsT)
|
|
87
27
|
{
|
|
88
28
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
@@ -92,35 +32,6 @@ KNativePointer impl_ETSParserCreateExpression(KNativePointer contextPtr, KString
|
|
|
92
32
|
}
|
|
93
33
|
KOALA_INTEROP_3(ETSParserCreateExpression, KNativePointer, KNativePointer, KStringPtr, KInt)
|
|
94
34
|
|
|
95
|
-
KNativePointer impl_SignatureFunction(KNativePointer context, KNativePointer classInstance)
|
|
96
|
-
{
|
|
97
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
98
|
-
const auto _classInstance = reinterpret_cast<es2panda_Signature*>(classInstance);
|
|
99
|
-
const auto result = GetImpl()->SignatureFunction(_context, _classInstance);
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
KOALA_INTEROP_2(SignatureFunction, KNativePointer, KNativePointer, KNativePointer)
|
|
103
|
-
|
|
104
|
-
static KNativePointer impl_ProgramExternalSources(KNativePointer contextPtr, KNativePointer instancePtr)
|
|
105
|
-
{
|
|
106
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
107
|
-
auto&& instance = reinterpret_cast<es2panda_Program*>(instancePtr);
|
|
108
|
-
std::size_t source_len = 0;
|
|
109
|
-
auto external_sources = GetImpl()->ProgramExternalSources(context, instance, &source_len);
|
|
110
|
-
return StageArena::CloneVector(external_sources, source_len);
|
|
111
|
-
}
|
|
112
|
-
KOALA_INTEROP_2(ProgramExternalSources, KNativePointer, KNativePointer, KNativePointer);
|
|
113
|
-
|
|
114
|
-
static KNativePointer impl_ProgramDirectExternalSources(KNativePointer contextPtr, KNativePointer instancePtr)
|
|
115
|
-
{
|
|
116
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
117
|
-
auto&& instance = reinterpret_cast<es2panda_Program*>(instancePtr);
|
|
118
|
-
std::size_t sourceLen = 0;
|
|
119
|
-
auto externalSources = GetImpl()->ProgramDirectExternalSources(context, instance, &sourceLen);
|
|
120
|
-
return new std::vector<void*>(externalSources, externalSources + sourceLen);
|
|
121
|
-
}
|
|
122
|
-
KOALA_INTEROP_2(ProgramDirectExternalSources, KNativePointer, KNativePointer, KNativePointer);
|
|
123
|
-
|
|
124
35
|
static KNativePointer impl_ProgramSourceFilePath(KNativePointer contextPtr, KNativePointer instancePtr)
|
|
125
36
|
{
|
|
126
37
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
@@ -130,23 +41,6 @@ static KNativePointer impl_ProgramSourceFilePath(KNativePointer contextPtr, KNat
|
|
|
130
41
|
}
|
|
131
42
|
KOALA_INTEROP_2(ProgramSourceFilePath, KNativePointer, KNativePointer, KNativePointer);
|
|
132
43
|
|
|
133
|
-
static KNativePointer impl_ExternalSourceName(KNativePointer instance)
|
|
134
|
-
{
|
|
135
|
-
auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource*>(instance);
|
|
136
|
-
auto&& result = GetImpl()->ExternalSourceName(_instance_);
|
|
137
|
-
return StageArena::Strdup(result);
|
|
138
|
-
}
|
|
139
|
-
KOALA_INTEROP_1(ExternalSourceName, KNativePointer, KNativePointer);
|
|
140
|
-
|
|
141
|
-
static KNativePointer impl_ExternalSourcePrograms(KNativePointer instance)
|
|
142
|
-
{
|
|
143
|
-
auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource*>(instance);
|
|
144
|
-
std::size_t program_len = 0;
|
|
145
|
-
auto programs = GetImpl()->ExternalSourcePrograms(_instance_, &program_len);
|
|
146
|
-
return StageArena::CloneVector(programs, program_len);
|
|
147
|
-
}
|
|
148
|
-
KOALA_INTEROP_1(ExternalSourcePrograms, KNativePointer, KNativePointer);
|
|
149
|
-
|
|
150
44
|
KNativePointer impl_ETSParserBuildImportDeclaration(KNativePointer context, KInt importKinds,
|
|
151
45
|
KNativePointerArray specifiers, KUInt specifiersSequenceLength, KNativePointer source, KNativePointer program,
|
|
152
46
|
KInt importFlag)
|
|
@@ -197,104 +91,6 @@ KNativePointer impl_OptionsArkTsConfig(KNativePointer context, KNativePointer op
|
|
|
197
91
|
}
|
|
198
92
|
KOALA_INTEROP_2(OptionsArkTsConfig, KNativePointer, KNativePointer, KNativePointer)
|
|
199
93
|
|
|
200
|
-
// All these "Checker_" bridges are related to checker namespace in es2panda, so work with them carefully
|
|
201
|
-
// Checker.Type does reset on recheck, so modifying them makes no sence
|
|
202
|
-
// It seems that compiler does not provide API to convert Checker.Type to ir.Type
|
|
203
|
-
KNativePointer impl_Checker_CreateOpaqueTypeNode(KNativePointer context, KNativePointer type)
|
|
204
|
-
{
|
|
205
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
206
|
-
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
207
|
-
return GetImpl()->CreateOpaqueTypeNode(_context, _type);
|
|
208
|
-
}
|
|
209
|
-
KOALA_INTEROP_2(Checker_CreateOpaqueTypeNode, KNativePointer, KNativePointer, KNativePointer)
|
|
210
|
-
|
|
211
|
-
KNativePointer impl_Checker_ScriptFunctionSignature(KNativePointer context, KNativePointer node)
|
|
212
|
-
{
|
|
213
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
214
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
215
|
-
return GetImpl()->ScriptFunctionSignature(_context, _node);
|
|
216
|
-
}
|
|
217
|
-
KOALA_INTEROP_2(Checker_ScriptFunctionSignature, KNativePointer, KNativePointer, KNativePointer)
|
|
218
|
-
|
|
219
|
-
void impl_Checker_ScriptFunctionSetSignature(KNativePointer context, KNativePointer node, KNativePointer signature)
|
|
220
|
-
{
|
|
221
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
222
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
223
|
-
auto _signature = reinterpret_cast<es2panda_Signature*>(signature);
|
|
224
|
-
GetImpl()->ScriptFunctionSetSignature(_context, _node, _signature);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
KOALA_INTEROP_V3(Checker_ScriptFunctionSetSignature, KNativePointer, KNativePointer, KNativePointer)
|
|
228
|
-
|
|
229
|
-
KNativePointer impl_Checker_SignatureReturnType(KNativePointer context, KNativePointer signature)
|
|
230
|
-
{
|
|
231
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
232
|
-
auto _signature = reinterpret_cast<es2panda_Signature*>(signature);
|
|
233
|
-
return GetImpl()->SignatureReturnType(_context, _signature);
|
|
234
|
-
}
|
|
235
|
-
KOALA_INTEROP_2(Checker_SignatureReturnType, KNativePointer, KNativePointer, KNativePointer)
|
|
236
|
-
|
|
237
|
-
KNativePointer impl_Checker_ScriptFunctionGetPreferredReturnType(KNativePointer context, KNativePointer node)
|
|
238
|
-
{
|
|
239
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
240
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
241
|
-
return GetImpl()->ScriptFunctionGetPreferredReturnType(_context, _node);
|
|
242
|
-
}
|
|
243
|
-
KOALA_INTEROP_2(Checker_ScriptFunctionGetPreferredReturnType, KNativePointer, KNativePointer, KNativePointer)
|
|
244
|
-
|
|
245
|
-
void impl_Checker_ScriptFunctionSetPreferredReturnType(KNativePointer context, KNativePointer node, KNativePointer type)
|
|
246
|
-
{
|
|
247
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
248
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
249
|
-
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
250
|
-
GetImpl()->ScriptFunctionSetPreferredReturnType(_context, _node, _type);
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
KOALA_INTEROP_V3(Checker_ScriptFunctionSetPreferredReturnType, KNativePointer, KNativePointer, KNativePointer)
|
|
254
|
-
|
|
255
|
-
KNativePointer impl_Checker_ExpressionGetPreferredType(KNativePointer context, KNativePointer node)
|
|
256
|
-
{
|
|
257
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
258
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
259
|
-
return GetImpl()->ExpressionPreferredTypeConst(_context, _node);
|
|
260
|
-
}
|
|
261
|
-
KOALA_INTEROP_2(Checker_ExpressionGetPreferredType, KNativePointer, KNativePointer, KNativePointer)
|
|
262
|
-
|
|
263
|
-
void impl_Checker_ExpressionSetPreferredType(KNativePointer context, KNativePointer node, KNativePointer type)
|
|
264
|
-
{
|
|
265
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
266
|
-
auto _node = reinterpret_cast<es2panda_AstNode*>(node);
|
|
267
|
-
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
268
|
-
GetImpl()->ExpressionSetPreferredType(_context, _node, _type);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
KOALA_INTEROP_V3(Checker_ExpressionSetPreferredType, KNativePointer, KNativePointer, KNativePointer)
|
|
272
|
-
|
|
273
|
-
KNativePointer impl_Checker_TypeToString(KNativePointer context, KNativePointer type)
|
|
274
|
-
{
|
|
275
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
276
|
-
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
277
|
-
auto result = GetImpl()->TypeToStringConst(_context, _type);
|
|
278
|
-
return StageArena::Strdup(result);
|
|
279
|
-
}
|
|
280
|
-
KOALA_INTEROP_2(Checker_TypeToString, KNativePointer, KNativePointer, KNativePointer)
|
|
281
|
-
|
|
282
|
-
KNativePointer impl_Checker_TypeClone(KNativePointer context, KNativePointer type)
|
|
283
|
-
{
|
|
284
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
285
|
-
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
286
|
-
return GetImpl()->TypeClone(_context, _type);
|
|
287
|
-
}
|
|
288
|
-
KOALA_INTEROP_2(Checker_TypeClone, KNativePointer, KNativePointer, KNativePointer)
|
|
289
|
-
|
|
290
|
-
KNativePointer impl_Checker_TypeNodeGetType(KNativePointer context, KNativePointer astNode)
|
|
291
|
-
{
|
|
292
|
-
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
293
|
-
auto _astNode = reinterpret_cast<es2panda_AstNode*>(astNode);
|
|
294
|
-
return GetImpl()->TypeNodeGetType(_context, _astNode);
|
|
295
|
-
}
|
|
296
|
-
KOALA_INTEROP_2(Checker_TypeNodeGetType, KNativePointer, KNativePointer, KNativePointer)
|
|
297
|
-
|
|
298
94
|
// From koala-wrapper
|
|
299
95
|
// Improve: check if some code should be generated
|
|
300
96
|
|
|
@@ -341,31 +137,11 @@ KNativePointer impl_ClassVariableDeclaration(KNativePointer context, KNativePoin
|
|
|
341
137
|
}
|
|
342
138
|
KOALA_INTEROP_2(ClassVariableDeclaration, KNativePointer, KNativePointer, KNativePointer)
|
|
343
139
|
|
|
344
|
-
KNativePointer impl_TSInterfaceBodyBodyPtr(KNativePointer context, KNativePointer receiver)
|
|
345
|
-
{
|
|
346
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
347
|
-
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
348
|
-
std::size_t length;
|
|
349
|
-
auto result = GetImpl()->TSInterfaceBodyBodyPtr(_context, _receiver, &length);
|
|
350
|
-
return StageArena::CloneVector(result, length);
|
|
351
|
-
}
|
|
352
|
-
KOALA_INTEROP_2(TSInterfaceBodyBodyPtr, KNativePointer, KNativePointer, KNativePointer);
|
|
353
|
-
|
|
354
|
-
KNativePointer impl_AnnotationDeclarationPropertiesPtrConst(KNativePointer context, KNativePointer receiver)
|
|
355
|
-
{
|
|
356
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
357
|
-
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
358
|
-
std::size_t length;
|
|
359
|
-
auto result = GetImpl()->AnnotationDeclarationPropertiesPtrConst(_context, _receiver, &length);
|
|
360
|
-
return StageArena::CloneVector(result, length);
|
|
361
|
-
}
|
|
362
|
-
KOALA_INTEROP_2(AnnotationDeclarationPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer);
|
|
363
|
-
|
|
364
140
|
KNativePointer impl_ETSParserGetGlobalProgramAbsName(KNativePointer contextPtr)
|
|
365
141
|
{
|
|
366
142
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
367
143
|
auto result = GetImpl()->ETSParserGetGlobalProgramAbsName(context);
|
|
368
|
-
return new std::string(result);
|
|
144
|
+
return new std::string(result); // O_o
|
|
369
145
|
}
|
|
370
146
|
KOALA_INTEROP_1(ETSParserGetGlobalProgramAbsName, KNativePointer, KNativePointer)
|
|
371
147
|
|
|
@@ -397,47 +173,3 @@ KNativePointer impl_AnnotationUsageIrPropertiesPtrConst(KNativePointer context,
|
|
|
397
173
|
return StageArena::CloneVector(result, length);
|
|
398
174
|
}
|
|
399
175
|
KOALA_INTEROP_2(AnnotationUsageIrPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer);
|
|
400
|
-
|
|
401
|
-
KInt impl_GetCompilationMode(KNativePointer configPtr)
|
|
402
|
-
{
|
|
403
|
-
auto _config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
404
|
-
auto _options = const_cast<es2panda_Options*>(GetImpl()->ConfigGetOptions(_config));
|
|
405
|
-
return GetImpl()->OptionsUtilGetCompilationModeConst(nullptr, _options);
|
|
406
|
-
}
|
|
407
|
-
KOALA_INTEROP_1(GetCompilationMode, KInt, KNativePointer)
|
|
408
|
-
|
|
409
|
-
KNativePointer impl_CreateTypeNodeFromTsType(KNativePointer context, KNativePointer nodePtr)
|
|
410
|
-
{
|
|
411
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
412
|
-
const auto _nodePtr = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
413
|
-
auto _tsType = GetImpl()->TypedTsType(_context, _nodePtr);
|
|
414
|
-
if (_tsType == nullptr) {
|
|
415
|
-
_tsType = GetImpl()->ExpressionTsType(_context, _nodePtr);
|
|
416
|
-
}
|
|
417
|
-
if (_tsType == nullptr) {
|
|
418
|
-
return nullptr;
|
|
419
|
-
}
|
|
420
|
-
const auto _nodeTsType = reinterpret_cast<es2panda_Type*>(_tsType);
|
|
421
|
-
auto _typeAnnotation = GetImpl()->CreateOpaqueTypeNode(_context, _nodeTsType);
|
|
422
|
-
return _typeAnnotation;
|
|
423
|
-
}
|
|
424
|
-
KOALA_INTEROP_2(CreateTypeNodeFromTsType, KNativePointer, KNativePointer, KNativePointer)
|
|
425
|
-
|
|
426
|
-
MemoryTracker tracker;
|
|
427
|
-
void impl_MemoryTrackerReset(KNativePointer context)
|
|
428
|
-
{
|
|
429
|
-
tracker.Reset();
|
|
430
|
-
}
|
|
431
|
-
KOALA_INTEROP_V1(MemoryTrackerReset, KNativePointer);
|
|
432
|
-
|
|
433
|
-
void impl_MemoryTrackerGetDelta(KNativePointer context)
|
|
434
|
-
{
|
|
435
|
-
tracker.Report(tracker.GetDelta());
|
|
436
|
-
}
|
|
437
|
-
KOALA_INTEROP_V1(MemoryTrackerGetDelta, KNativePointer);
|
|
438
|
-
|
|
439
|
-
void impl_MemoryTrackerPrintCurrent(KNativePointer context)
|
|
440
|
-
{
|
|
441
|
-
tracker.Report(GetMemoryStats());
|
|
442
|
-
}
|
|
443
|
-
KOALA_INTEROP_V1(MemoryTrackerPrintCurrent, KNativePointer);
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
#include <bitset>
|
|
23
23
|
|
|
24
24
|
#include "interop-types.h"
|
|
25
|
+
#include "memoryTracker.h"
|
|
25
26
|
|
|
26
27
|
using std::string, std::cout, std::endl, std::vector;
|
|
27
28
|
constexpr int AST_NODE_TYPE_LIMIT = 256;
|
|
@@ -241,61 +242,6 @@ void impl_DestroyConfig(KNativePointer config)
|
|
|
241
242
|
}
|
|
242
243
|
KOALA_INTEROP_V1(DestroyConfig, KNativePointer)
|
|
243
244
|
|
|
244
|
-
// ─── Helpers to lower function size/complexity ────────────────────────────────
|
|
245
|
-
namespace {
|
|
246
|
-
template <class T, class U>
|
|
247
|
-
inline T As(U v) { return reinterpret_cast<T>(v); }
|
|
248
|
-
|
|
249
|
-
struct CallExprArgs {
|
|
250
|
-
es2panda_Context* context;
|
|
251
|
-
es2panda_AstNode* node;
|
|
252
|
-
es2panda_AstNode* callee;
|
|
253
|
-
es2panda_AstNode** arguments;
|
|
254
|
-
KInt argumentsLen;
|
|
255
|
-
es2panda_AstNode* typeParams;
|
|
256
|
-
bool optional;
|
|
257
|
-
bool trailingComma;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
inline KNativePointer DoUpdateCallExpression(const CallExprArgs& a)
|
|
261
|
-
{
|
|
262
|
-
auto nn = GetImpl()->CreateCallExpression(
|
|
263
|
-
a.context, a.callee, a.arguments, a.argumentsLen, a.typeParams, a.optional, a.trailingComma);
|
|
264
|
-
GetImpl()->AstNodeSetOriginalNode(a.context, nn, a.node);
|
|
265
|
-
return nn;
|
|
266
|
-
}
|
|
267
|
-
} // namespace
|
|
268
|
-
|
|
269
|
-
KNativePointer impl_UpdateCallExpression(KNativePointer contextPtr, KNativePointer nodePtr, KNativePointer calleePtr,
|
|
270
|
-
KNativePointerArray argumentsPtr, KInt argumentsLen, KNativePointer typeParamsPtr, KBoolean optionalT,
|
|
271
|
-
KBoolean trailingCommaT)
|
|
272
|
-
{
|
|
273
|
-
const CallExprArgs a{
|
|
274
|
-
As<es2panda_Context*>(contextPtr),
|
|
275
|
-
As<es2panda_AstNode*>(nodePtr),
|
|
276
|
-
As<es2panda_AstNode*>(calleePtr),
|
|
277
|
-
As<es2panda_AstNode**>(argumentsPtr),
|
|
278
|
-
argumentsLen,
|
|
279
|
-
As<es2panda_AstNode*>(typeParamsPtr),
|
|
280
|
-
static_cast<bool>(optionalT),
|
|
281
|
-
static_cast<bool>(trailingCommaT),
|
|
282
|
-
};
|
|
283
|
-
return DoUpdateCallExpression(a);
|
|
284
|
-
}
|
|
285
|
-
KOALA_INTEROP_8(UpdateCallExpression, KNativePointer, KNativePointer, KNativePointer, KNativePointer,
|
|
286
|
-
KNativePointerArray, KInt, KNativePointer, KBoolean, KBoolean)
|
|
287
|
-
|
|
288
|
-
KInt impl_IdentifierIdentifierFlags(KNativePointer contextPtr, KNativePointer nodePtr)
|
|
289
|
-
{
|
|
290
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
291
|
-
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
292
|
-
|
|
293
|
-
return (GetImpl()->IdentifierIsOptionalConst(context, node) ? (1 << 0) : 0) |
|
|
294
|
-
(GetImpl()->IdentifierIsReferenceConst(context, node) ? (1 << 1) : 0) |
|
|
295
|
-
(GetImpl()->IdentifierIsTdzConst(context, node) ? (1 << 2) : 0);
|
|
296
|
-
}
|
|
297
|
-
KOALA_INTEROP_2(IdentifierIdentifierFlags, KInt, KNativePointer, KNativePointer)
|
|
298
|
-
|
|
299
245
|
void impl_ClassDefinitionSetBody(
|
|
300
246
|
KNativePointer context, KNativePointer receiver, KNativePointerArray body, KUInt bodyLength)
|
|
301
247
|
{
|
|
@@ -464,6 +410,8 @@ struct Pattern {
|
|
|
464
410
|
return value == "struct";
|
|
465
411
|
case Es2pandaAstNodeType::AST_NODE_TYPE_CALL_EXPRESSION:
|
|
466
412
|
return value == "call";
|
|
413
|
+
case Es2pandaAstNodeType::AST_NODE_TYPE_ETS_IMPORT_DECLARATION:
|
|
414
|
+
return value == "import";
|
|
467
415
|
case Es2pandaAstNodeType::AST_NODE_TYPE_ASSIGNMENT_EXPRESSION:
|
|
468
416
|
return value == "assignment";
|
|
469
417
|
default:
|
|
@@ -645,18 +593,6 @@ KOALA_INTEROP_4(FilterNodes3, KNativePointer, KNativePointer, KNativePointer, KI
|
|
|
645
593
|
// From koala-wrapper
|
|
646
594
|
// Improve: check if some code should be generated
|
|
647
595
|
|
|
648
|
-
void impl_MemInitialize()
|
|
649
|
-
{
|
|
650
|
-
GetImpl()->MemInitialize();
|
|
651
|
-
}
|
|
652
|
-
KOALA_INTEROP_V0(MemInitialize)
|
|
653
|
-
|
|
654
|
-
void impl_MemFinalize()
|
|
655
|
-
{
|
|
656
|
-
GetImpl()->MemFinalize();
|
|
657
|
-
}
|
|
658
|
-
KOALA_INTEROP_V0(MemFinalize)
|
|
659
|
-
|
|
660
596
|
static bool isUIHeaderFile(es2panda_Context* context, es2panda_Program* program)
|
|
661
597
|
{
|
|
662
598
|
auto result = GetImpl()->ProgramFileNameWithExtensionConst(context, program);
|
|
@@ -705,3 +641,49 @@ KNativePointer impl_AstNodeProgram(KNativePointer contextPtr, KNativePointer ins
|
|
|
705
641
|
return impl_AstNodeProgram(_context, GetImpl()->AstNodeParent(_context, _receiver));
|
|
706
642
|
}
|
|
707
643
|
KOALA_INTEROP_2(AstNodeProgram, KNativePointer, KNativePointer, KNativePointer)
|
|
644
|
+
|
|
645
|
+
// This api could be generated (as combination of 2 briges) after namespace util is generated
|
|
646
|
+
KInt impl_GetCompilationMode(KNativePointer configPtr)
|
|
647
|
+
{
|
|
648
|
+
auto _config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
649
|
+
auto _options = const_cast<es2panda_Options*>(GetImpl()->ConfigGetOptions(_config));
|
|
650
|
+
return GetImpl()->OptionsUtilGetCompilationModeConst(nullptr, _options);
|
|
651
|
+
}
|
|
652
|
+
KOALA_INTEROP_1(GetCompilationMode, KInt, KNativePointer)
|
|
653
|
+
|
|
654
|
+
KNativePointer impl_CreateTypeNodeFromTsType(KNativePointer context, KNativePointer nodePtr)
|
|
655
|
+
{
|
|
656
|
+
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
657
|
+
const auto _nodePtr = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
658
|
+
auto _tsType = GetImpl()->TypedTsType(_context, _nodePtr);
|
|
659
|
+
if (_tsType == nullptr) {
|
|
660
|
+
_tsType = GetImpl()->ExpressionTsType(_context, _nodePtr);
|
|
661
|
+
}
|
|
662
|
+
if (_tsType == nullptr) {
|
|
663
|
+
return nullptr;
|
|
664
|
+
}
|
|
665
|
+
const auto _nodeTsType = reinterpret_cast<es2panda_Type*>(_tsType);
|
|
666
|
+
auto _typeAnnotation = GetImpl()->CreateOpaqueTypeNode(_context, _nodeTsType);
|
|
667
|
+
return _typeAnnotation;
|
|
668
|
+
}
|
|
669
|
+
KOALA_INTEROP_2(CreateTypeNodeFromTsType, KNativePointer, KNativePointer, KNativePointer)
|
|
670
|
+
|
|
671
|
+
MemoryTracker tracker;
|
|
672
|
+
void impl_MemoryTrackerReset(KNativePointer context)
|
|
673
|
+
{
|
|
674
|
+
tracker.Reset();
|
|
675
|
+
}
|
|
676
|
+
KOALA_INTEROP_V1(MemoryTrackerReset, KNativePointer);
|
|
677
|
+
|
|
678
|
+
void impl_MemoryTrackerGetDelta(KNativePointer context)
|
|
679
|
+
{
|
|
680
|
+
tracker.Report(tracker.GetDelta());
|
|
681
|
+
}
|
|
682
|
+
KOALA_INTEROP_V1(MemoryTrackerGetDelta, KNativePointer);
|
|
683
|
+
|
|
684
|
+
void impl_MemoryTrackerPrintCurrent(KNativePointer context)
|
|
685
|
+
{
|
|
686
|
+
tracker.Report(GetMemoryStats());
|
|
687
|
+
}
|
|
688
|
+
KOALA_INTEROP_V1(MemoryTrackerPrintCurrent, KNativePointer);
|
|
689
|
+
|
|
@@ -16,21 +16,6 @@
|
|
|
16
16
|
#ifndef COMMON_H
|
|
17
17
|
#define COMMON_H
|
|
18
18
|
|
|
19
|
-
/*
|
|
20
|
-
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
|
21
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22
|
-
* you may not use this file except in compliance with the License.
|
|
23
|
-
* You may obtain a copy of the License at
|
|
24
|
-
*
|
|
25
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
-
* See the License for the specific language governing permissions and
|
|
31
|
-
* limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
19
|
#include <iostream>
|
|
35
20
|
#include <string>
|
|
36
21
|
#include <vector>
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
"main": "./lib/libarkts.js",
|
|
5
5
|
"typesVersions": {
|
|
6
6
|
"*": {
|
|
7
|
-
"./compat/*": [
|
|
8
|
-
"./lib/types/wrapper-compat/index.d.ts"
|
|
9
|
-
],
|
|
10
7
|
"*": [
|
|
11
8
|
"./lib/types/src/index.d.ts"
|
|
12
9
|
]
|
|
@@ -14,7 +11,6 @@
|
|
|
14
11
|
},
|
|
15
12
|
"exports": {
|
|
16
13
|
".": "./lib/libarkts.js",
|
|
17
|
-
"./compat": "./lib/libarkts-compat.js",
|
|
18
14
|
"./plugins/*": "./lib/plugins/*.js"
|
|
19
15
|
},
|
|
20
16
|
"files": [
|
|
@@ -24,7 +20,7 @@
|
|
|
24
20
|
],
|
|
25
21
|
"config": {
|
|
26
22
|
"panda_sdk_path": "../incremental/tools/panda/node_modules/@panda/sdk",
|
|
27
|
-
"panda_sdk_version": "
|
|
23
|
+
"panda_sdk_version": "1.5.0-dev.53118"
|
|
28
24
|
},
|
|
29
25
|
"dependencies": {
|
|
30
26
|
"@koalaui/compat": "1.7.10+devel",
|
|
@@ -42,7 +38,7 @@
|
|
|
42
38
|
"tsconfig-paths": "^4.2.0",
|
|
43
39
|
"rimraf": "^6.0.1",
|
|
44
40
|
"@koalaui/fast-arktsc": "1.7.10+devel",
|
|
45
|
-
"@idlizer/arktscgen": "2.1.10-arktscgen-
|
|
41
|
+
"@idlizer/arktscgen": "2.1.10-arktscgen-8",
|
|
46
42
|
"mocha": "^9.2.2",
|
|
47
43
|
"@koalaui/harness": "1.7.10+devel",
|
|
48
44
|
"@koalaui/ets-tsc": "4.9.5-r6",
|
|
@@ -51,7 +47,7 @@
|
|
|
51
47
|
"node-api-headers": "0.0.5"
|
|
52
48
|
},
|
|
53
49
|
"scripts": {
|
|
54
|
-
"clean": "rimraf generated build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
|
|
50
|
+
"clean": "rimraf generated build native/mingw_build native/build* ./.rollup.cache tsconfig.tsbuildinfo lib",
|
|
55
51
|
"clean:plugins": "rimraf plugins/build",
|
|
56
52
|
"compile:koala:interop": "npm run --prefix ../interop compile",
|
|
57
53
|
"compile:meson": "cd native && meson setup build && meson compile -C build",
|
|
@@ -78,7 +74,7 @@
|
|
|
78
74
|
"compile:playground": "cd playground && meson setup build && meson compile -C build",
|
|
79
75
|
"run:playground": "npm run compile:playground && mkdir -p build && ./playground/build/playground _ --extension ets --stdlib ../incremental/tools/panda/node_modules/@panda/sdk/ets/stdlib --output build/playground.abc ./playground/src/main.ets",
|
|
80
76
|
"panda:sdk:clean": "cd ../incremental/tools/panda && rimraf node_modules",
|
|
81
|
-
"panda:sdk:install": "cd ../incremental/tools/panda && echo \"Installing panda sdk $npm_package_config_panda_sdk_version\" && PANDA_SDK_VERSION=$npm_package_config_panda_sdk_version npm run panda:sdk:install",
|
|
77
|
+
"panda:sdk:install": "cd ../incremental/tools/panda && echo \"Installing panda sdk $npm_package_config_panda_sdk_version\" && PANDA_SDK_VERSION=${PANDA_SDK_VERSION:-$npm_package_config_panda_sdk_version} npm run panda:sdk:install",
|
|
82
78
|
"panda:sdk:reinstall": "npm run panda:sdk:clean && npm run panda:sdk:install",
|
|
83
79
|
"regenerate:current": "rimraf -rf ./generated && npm run compile -C ../../arktscgen && node ../../arktscgen --panda-sdk-path $npm_package_config_panda_sdk_path --output-dir ../ --options-file ./generator/options.json5 --no-initialize --debug",
|
|
84
80
|
"regenerate": "rimraf -rf ./generated && arktscgen --panda-sdk-path ${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
|
|
@@ -37,9 +37,6 @@ import { Es2pandaPluginDiagnosticType } from '../generated/Es2pandaEnums';
|
|
|
37
37
|
export type KPtrArray = BigUint64Array;
|
|
38
38
|
|
|
39
39
|
export class Es2pandaNativeModule {
|
|
40
|
-
_AnnotationAllowedAnnotations(context: KPtr, node: KPtr, returnLen: KPtr): KPtr {
|
|
41
|
-
throw new Error('Not implemented');
|
|
42
|
-
}
|
|
43
40
|
_AstNodeRebind(context: KPtr, node: KPtr): void {
|
|
44
41
|
throw new Error('Not implemented');
|
|
45
42
|
}
|
|
@@ -64,9 +61,6 @@ export class Es2pandaNativeModule {
|
|
|
64
61
|
_HasGlobalStructInfo(context: KNativePointer, str: String): KBoolean {
|
|
65
62
|
throw new Error('Not implemented');
|
|
66
63
|
}
|
|
67
|
-
_DestroyContext(context: KPtr): void {
|
|
68
|
-
throw new Error('Not implemented');
|
|
69
|
-
}
|
|
70
64
|
_ProceedToState(context: KPtr, state: number): void {
|
|
71
65
|
throw new Error('Not implemented');
|
|
72
66
|
}
|
|
@@ -91,9 +85,6 @@ export class Es2pandaNativeModule {
|
|
|
91
85
|
_VariableDeclaration(context: KPtr, variable: KPtr): KPtr {
|
|
92
86
|
throw new Error('Not implemented');
|
|
93
87
|
}
|
|
94
|
-
_DeclNode(context: KPtr, decl: KPtr): KPtr {
|
|
95
|
-
throw new Error('Not implemented');
|
|
96
|
-
}
|
|
97
88
|
_ProgramSourceFilePath(context: KNativePointer, instance: KNativePointer): KNativePointer {
|
|
98
89
|
throw new Error('Not implemented');
|
|
99
90
|
}
|
|
@@ -141,47 +132,6 @@ export class Es2pandaNativeModule {
|
|
|
141
132
|
_OptionsArkTsConfig(context: KNativePointer, options: KNativePointer): KNativePointer {
|
|
142
133
|
throw new Error('Not implemented');
|
|
143
134
|
}
|
|
144
|
-
_Checker_CreateOpaqueTypeNode(context: KNativePointer, type: KNativePointer): KNativePointer {
|
|
145
|
-
throw new Error('Not implemented');
|
|
146
|
-
}
|
|
147
|
-
_Checker_ScriptFunctionSignature(context: KNativePointer, node: KNativePointer): KNativePointer {
|
|
148
|
-
throw new Error('Not implemented');
|
|
149
|
-
}
|
|
150
|
-
_Checker_ScriptFunctionSetSignature(
|
|
151
|
-
context: KNativePointer,
|
|
152
|
-
node: KNativePointer,
|
|
153
|
-
signature: KNativePointer
|
|
154
|
-
): void {
|
|
155
|
-
throw new Error('Not implemented');
|
|
156
|
-
}
|
|
157
|
-
_Checker_SignatureReturnType(context: KNativePointer, signature: KNativePointer): KNativePointer {
|
|
158
|
-
throw new Error('Not implemented');
|
|
159
|
-
}
|
|
160
|
-
_Checker_ScriptFunctionGetPreferredReturnType(context: KNativePointer, node: KNativePointer): KNativePointer {
|
|
161
|
-
throw new Error('Not implemented');
|
|
162
|
-
}
|
|
163
|
-
_Checker_ScriptFunctionSetPreferredReturnType(
|
|
164
|
-
context: KNativePointer,
|
|
165
|
-
node: KNativePointer,
|
|
166
|
-
type: KNativePointer
|
|
167
|
-
): void {
|
|
168
|
-
throw new Error('Not implemented');
|
|
169
|
-
}
|
|
170
|
-
_Checker_ExpressionGetPreferredType(context: KNativePointer, node: KNativePointer): KNativePointer {
|
|
171
|
-
throw new Error('Not implemented');
|
|
172
|
-
}
|
|
173
|
-
_Checker_ExpressionSetPreferredType(context: KNativePointer, node: KNativePointer, type: KNativePointer): void {
|
|
174
|
-
throw new Error('Not implemented');
|
|
175
|
-
}
|
|
176
|
-
_Checker_TypeToString(context: KNativePointer, type: KNativePointer): KNativePointer {
|
|
177
|
-
throw new Error('Not implemented');
|
|
178
|
-
}
|
|
179
|
-
_Checker_TypeClone(context: KNativePointer, type: KNativePointer): KNativePointer {
|
|
180
|
-
throw new Error('Not implemented');
|
|
181
|
-
}
|
|
182
|
-
_Checker_TypeNodeGetType(context: KNativePointer, node: KNativePointer): KNativePointer {
|
|
183
|
-
throw new Error('Not implemented');
|
|
184
|
-
}
|
|
185
135
|
_ScriptFunctionSetParams(
|
|
186
136
|
context: KNativePointer,
|
|
187
137
|
receiver: KNativePointer,
|
|
@@ -234,12 +184,6 @@ export class Es2pandaNativeModule {
|
|
|
234
184
|
_SetUpSoPath(soPath: string): void {
|
|
235
185
|
throw new Error('Not implemented');
|
|
236
186
|
}
|
|
237
|
-
_MemInitialize(): void {
|
|
238
|
-
throw new Error('Not implemented');
|
|
239
|
-
}
|
|
240
|
-
_MemFinalize(): void {
|
|
241
|
-
throw new Error('Not implemented');
|
|
242
|
-
}
|
|
243
187
|
_ProgramCanSkipPhases(context: KNativePointer, program: KNativePointer): KBoolean {
|
|
244
188
|
throw new Error('Not implemented');
|
|
245
189
|
}
|
|
@@ -29,7 +29,6 @@ export * from './ProgramProvider';
|
|
|
29
29
|
export * from './peers/AstNode';
|
|
30
30
|
export * from './peers/Config';
|
|
31
31
|
export * from './peers/Context';
|
|
32
|
-
export { GlobalContext } from './peers/Context';
|
|
33
32
|
export * from './peers/ExternalSource';
|
|
34
33
|
export * from './peers/Options';
|
|
35
34
|
export * from './node-utilities/ArkTsConfig';
|
|
@@ -20,7 +20,7 @@ import { Es2pandaAstNodeType } from '../../../generated/Es2pandaEnums';
|
|
|
20
20
|
|
|
21
21
|
export function createOpaqueTypeNode(typePointer: KNativePointer): OpaqueTypeNode {
|
|
22
22
|
return new OpaqueTypeNode(
|
|
23
|
-
global.
|
|
23
|
+
global.generatedEs2panda._CreateOpaqueTypeNode(global.context, typePointer),
|
|
24
24
|
Es2pandaAstNodeType.AST_NODE_TYPE_OPAQUE_TYPE_NODE
|
|
25
25
|
);
|
|
26
26
|
}
|