@idlizer/arktscgen 2.1.10-arktscgen-5 → 2.1.10-arktscgen-7
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 +24 -47
- package/build/libarkts-copy/native/meson.build +29 -13
- package/build/libarkts-copy/native/meson_options.txt +9 -3
- package/build/libarkts-copy/native/mingw.cross +2 -0
- package/build/libarkts-copy/native/src/{bridges.cc → bridges.cpp} +31 -92
- package/build/libarkts-copy/native/src/{common.cc → common.cpp} +240 -107
- package/build/libarkts-copy/native/src/common.h +22 -22
- package/build/libarkts-copy/native/src/{memoryTracker.cc → memoryTracker.cpp} +45 -32
- package/build/libarkts-copy/package.json +13 -11
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +10 -63
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +9 -3
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +10 -7
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +14 -5
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +19 -1
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +4 -0
- package/build/libarkts-copy/src/arkts-api/index.ts +0 -2
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -3
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/OverloadDeclaration.ts +29 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +4 -4
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +0 -16
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +9 -9
- package/build/libarkts-copy/src/arkts-api/plugins.ts +113 -15
- package/build/libarkts-copy/src/arkts-api/static/global.ts +1 -4
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +5 -5
- package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +11 -43
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +41 -9
- package/build/libarkts-copy/src/arkts-api/visitor.ts +4 -25
- package/build/libarkts-copy/src/checkSdk.ts +1 -1
- package/build/libarkts-copy/src/index.ts +1 -2
- package/build/libarkts-copy/src/memo-node-cache.ts +143 -0
- package/build/libarkts-copy/src/plugin-utils.ts +72 -40
- package/build/libarkts-copy/src/reexport-for-generated.ts +3 -1
- package/build/libarkts-copy/src/tracer.ts +2 -2
- package/build/libarkts-copy/src/utils.ts +10 -14
- package/build/libarkts-copy/tsconfig.json +0 -3
- package/lib/index.js +5517 -10446
- package/package.json +9 -7
- package/templates/{bridges.cc → bridges.cpp} +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +0 -45
- package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +0 -23
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +0 -1250
- package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +0 -125
- package/build/libarkts-copy/src/ts-api/index.ts +0 -27
- package/build/libarkts-copy/src/ts-api/static/enums.ts +0 -18
- package/build/libarkts-copy/src/ts-api/types.ts +0 -1075
- package/build/libarkts-copy/src/ts-api/utilities/private.ts +0 -292
- package/build/libarkts-copy/src/ts-api/utilities/public.ts +0 -55
- package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +0 -139
|
@@ -22,31 +22,14 @@
|
|
|
22
22
|
"ETSUndefinedType",
|
|
23
23
|
],
|
|
24
24
|
"ignore": {
|
|
25
|
-
"
|
|
25
|
+
"peers": [
|
|
26
26
|
"es2panda_Config",
|
|
27
|
+
"es2panda_Context",
|
|
28
|
+
"es2panda_GlobalContext",
|
|
29
|
+
],
|
|
30
|
+
"full": [
|
|
27
31
|
"es2panda_ExternalSource",
|
|
28
32
|
"es2panda_OverloadInfo",
|
|
29
|
-
"es2panda_GlobalContext",
|
|
30
|
-
|
|
31
|
-
// Duplicates of types in ir namespace
|
|
32
|
-
// They will be removed in the fututre.
|
|
33
|
-
'es2panda_Signature',
|
|
34
|
-
'es2panda_CheckerContext',
|
|
35
|
-
'es2panda_Type',
|
|
36
|
-
'es2panda_TypeRelation',
|
|
37
|
-
'es2panda_GlobalTypesHolder',
|
|
38
|
-
'es2panda_Variable',
|
|
39
|
-
'es2panda_Scope',
|
|
40
|
-
'es2panda_Path',
|
|
41
|
-
'es2panda_ResolveResult',
|
|
42
|
-
'es2panda_RecordTable',
|
|
43
|
-
'es2panda_BoundContext',
|
|
44
|
-
'es2panda_ImportPathManager',
|
|
45
|
-
'es2panda_Options',
|
|
46
|
-
'es2panda_AstNode',
|
|
47
|
-
'es2panda_Program',
|
|
48
|
-
'es2panda_ArkTsConfig',
|
|
49
|
-
'es2panda_FunctionSignature',
|
|
50
33
|
|
|
51
34
|
'NodeTransformer',
|
|
52
35
|
'NodeTraverser',
|
|
@@ -87,25 +70,22 @@
|
|
|
87
70
|
interface: "es2panda_Impl",
|
|
88
71
|
methods: [
|
|
89
72
|
"LogSyntaxError", "LogWarning", "LogTypeError", // wrong idl
|
|
90
|
-
"
|
|
73
|
+
"DestroyConfig", // cleanup arena
|
|
91
74
|
|
|
92
75
|
// Handwritten bridges
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"CreateContextGenerateAbcForExternalSourceFiles",
|
|
99
|
-
"CreateDiagnosticInfo",
|
|
76
|
+
"ConfigGetOptions", // handwritten class
|
|
77
|
+
"ExternalSourceName", // handwritten class and used in panda API
|
|
78
|
+
"SourcePositionCol", // not in idl
|
|
79
|
+
"ExternalSourcePrograms", // Wrong args
|
|
80
|
+
"LogDiagnostic", // not in idl
|
|
100
81
|
"CreateDiagnosticKind",
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"LogDiagnostic",
|
|
82
|
+
"GetSemanticErrors",
|
|
83
|
+
"GetSyntaxErrors",
|
|
84
|
+
"GetPluginErrors",
|
|
85
|
+
"GetWarnings",
|
|
86
|
+
"NumberLiteralStrConst",
|
|
87
|
+
"MemInitialize",
|
|
88
|
+
"MemFinalize",
|
|
109
89
|
],
|
|
110
90
|
},
|
|
111
91
|
{
|
|
@@ -235,18 +215,15 @@
|
|
|
235
215
|
"Parse",
|
|
236
216
|
]
|
|
237
217
|
},
|
|
218
|
+
{
|
|
219
|
+
interface: "ClassDefinition",
|
|
220
|
+
methods: [
|
|
221
|
+
"SetBody", // handwritten
|
|
222
|
+
]
|
|
223
|
+
},
|
|
238
224
|
]
|
|
239
225
|
},
|
|
240
226
|
nonNullable: [
|
|
241
|
-
{
|
|
242
|
-
name: "ScriptFunction",
|
|
243
|
-
methods: [
|
|
244
|
-
{
|
|
245
|
-
name: "SetIdent",
|
|
246
|
-
types: ["id"]
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
},
|
|
250
227
|
{
|
|
251
228
|
name: "ArrowFunctionExpression",
|
|
252
229
|
methods: [
|
|
@@ -23,14 +23,14 @@ project(
|
|
|
23
23
|
is_cross = get_option('cross_compile')
|
|
24
24
|
|
|
25
25
|
sources = [
|
|
26
|
-
'./src/common.
|
|
27
|
-
'./src/memoryTracker.
|
|
28
|
-
'./src/bridges.
|
|
29
|
-
'../generated/native/bridges.
|
|
30
|
-
get_option('interop_src_dir') / 'common-interop.
|
|
31
|
-
get_option('interop_src_dir') / 'callback-resource.
|
|
32
|
-
get_option('interop_src_dir') / 'interop-logging.
|
|
33
|
-
get_option('interop_src_dir') / 'napi' / 'convertors-napi.
|
|
26
|
+
'./src/common.cpp',
|
|
27
|
+
'./src/memoryTracker.cpp',
|
|
28
|
+
'./src/bridges.cpp',
|
|
29
|
+
'../generated/native/bridges.cpp',
|
|
30
|
+
get_option('interop_src_dir') / 'common-interop.cpp',
|
|
31
|
+
get_option('interop_src_dir') / 'callback-resource.cpp',
|
|
32
|
+
get_option('interop_src_dir') / 'interop-logging.cpp',
|
|
33
|
+
get_option('interop_src_dir') / 'napi' / 'convertors-napi.cpp',
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
cflags = [
|
|
@@ -44,7 +44,7 @@ if (host_machine.system() == 'windows')
|
|
|
44
44
|
cflags += ['-DKOALA_WINDOWS']
|
|
45
45
|
# apply node.exe symbol loading hook
|
|
46
46
|
sources += [
|
|
47
|
-
get_option('interop_src_dir') / 'napi/win-dynamic-node.
|
|
47
|
+
get_option('interop_src_dir') / 'napi/win-dynamic-node.cpp'
|
|
48
48
|
]
|
|
49
49
|
else
|
|
50
50
|
cflags += ['-DKOALA_LINUX']
|
|
@@ -76,6 +76,22 @@ suffix_cross = '_' + os + '_arm64'
|
|
|
76
76
|
endif
|
|
77
77
|
endif
|
|
78
78
|
|
|
79
|
+
fs = import('fs')
|
|
80
|
+
if fs.is_dir(get_option('node_modules_dir_1') + '/node-api-headers')
|
|
81
|
+
node_api_headers_dir = get_option('node_modules_dir_1')
|
|
82
|
+
elif fs.is_dir(get_option('node_modules_dir_2') + '/node-api-headers')
|
|
83
|
+
node_api_headers_dir = get_option('node_modules_dir_2')
|
|
84
|
+
else
|
|
85
|
+
error('node-api-headers not found')
|
|
86
|
+
endif
|
|
87
|
+
if fs.is_dir(get_option('node_modules_dir_1') + '/node-addon-api')
|
|
88
|
+
node_addon_api_dir = get_option('node_modules_dir_1')
|
|
89
|
+
elif fs.is_dir(get_option('node_modules_dir_2') + '/node-addon-api')
|
|
90
|
+
node_addon_api_dir = get_option('node_modules_dir_2')
|
|
91
|
+
else
|
|
92
|
+
error('node-addon-api not found')
|
|
93
|
+
endif
|
|
94
|
+
|
|
79
95
|
shared_library(
|
|
80
96
|
get_option('lib_name') + suffix_host,
|
|
81
97
|
sources,
|
|
@@ -92,8 +108,8 @@ shared_library(
|
|
|
92
108
|
get_option('interop_src_dir'),
|
|
93
109
|
get_option('interop_src_dir') / 'types',
|
|
94
110
|
get_option('interop_src_dir') / 'napi',
|
|
95
|
-
|
|
96
|
-
|
|
111
|
+
node_api_headers_dir / 'node-api-headers/include',
|
|
112
|
+
node_addon_api_dir / 'node-addon-api',
|
|
97
113
|
],
|
|
98
114
|
cpp_args: cflags + cflags_host,
|
|
99
115
|
link_args: [cflags_host],
|
|
@@ -118,8 +134,8 @@ if is_cross
|
|
|
118
134
|
get_option('interop_src_dir'),
|
|
119
135
|
get_option('interop_src_dir') / 'types',
|
|
120
136
|
get_option('interop_src_dir') / 'napi',
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
node_api_headers_dir / 'node-api-headers/include',
|
|
138
|
+
node_addon_api_dir / 'node-addon-api',
|
|
123
139
|
],
|
|
124
140
|
cpp_args: cflags + cflags_cross,
|
|
125
141
|
link_args: [cflags_cross],
|
|
@@ -12,7 +12,13 @@
|
|
|
12
12
|
# limitations under the License.
|
|
13
13
|
|
|
14
14
|
option(
|
|
15
|
-
'
|
|
15
|
+
'node_modules_dir_1',
|
|
16
|
+
type : 'string',
|
|
17
|
+
value : '../node_modules/',
|
|
18
|
+
description : 'path to node_modules'
|
|
19
|
+
)
|
|
20
|
+
option(
|
|
21
|
+
'node_modules_dir_2',
|
|
16
22
|
type : 'string',
|
|
17
23
|
value : '../../node_modules/',
|
|
18
24
|
description : 'path to node_modules'
|
|
@@ -20,13 +26,13 @@ option(
|
|
|
20
26
|
option(
|
|
21
27
|
'interop_src_dir',
|
|
22
28
|
type : 'string',
|
|
23
|
-
value : '
|
|
29
|
+
value : '../../interop/src/cpp/',
|
|
24
30
|
description : 'path to koala interop cpp files'
|
|
25
31
|
)
|
|
26
32
|
option(
|
|
27
33
|
'panda_sdk_dir',
|
|
28
34
|
type : 'string',
|
|
29
|
-
value : '
|
|
35
|
+
value : '../../incremental/tools/panda/node_modules/@panda/sdk/',
|
|
30
36
|
description : 'path to panda sdk'
|
|
31
37
|
)
|
|
32
38
|
option(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-2025 Huawei Device Co., Ltd.
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License.
|
|
5
5
|
* You may obtain a copy of the License at
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include "common.h"
|
|
21
|
+
#include "memoryTracker.h"
|
|
21
22
|
|
|
22
23
|
/** XXX: If you add or remove methods that exist in C API,
|
|
23
24
|
* please change generator/options.json5 accordingly.
|
|
@@ -39,7 +40,7 @@ KNativePointer impl_AnnotationAllowedAnnotations(
|
|
|
39
40
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
40
41
|
std::size_t params_len = 0;
|
|
41
42
|
auto annotations = GetImpl()->AnnotationAllowedAnnotations(context, node, ¶ms_len);
|
|
42
|
-
return StageArena::
|
|
43
|
+
return StageArena::CloneVector(annotations, params_len);
|
|
43
44
|
}
|
|
44
45
|
KOALA_INTEROP_3(AnnotationAllowedAnnotations, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
|
|
45
46
|
|
|
@@ -50,7 +51,7 @@ KNativePointer impl_AnnotationAllowedAnnotationsConst(
|
|
|
50
51
|
auto node = reinterpret_cast<es2panda_AstNode*>(nodePtr);
|
|
51
52
|
std::size_t params_len = 0;
|
|
52
53
|
auto annotations = GetImpl()->AnnotationAllowedAnnotationsConst(context, node, ¶ms_len);
|
|
53
|
-
return StageArena::
|
|
54
|
+
return StageArena::CloneVector(annotations, params_len);
|
|
54
55
|
}
|
|
55
56
|
KOALA_INTEROP_3(AnnotationAllowedAnnotationsConst, KNativePointer, KNativePointer, KNativePointer, KNativePointer)
|
|
56
57
|
|
|
@@ -91,20 +92,6 @@ KNativePointer impl_ETSParserCreateExpression(KNativePointer contextPtr, KString
|
|
|
91
92
|
}
|
|
92
93
|
KOALA_INTEROP_3(ETSParserCreateExpression, KNativePointer, KNativePointer, KStringPtr, KInt)
|
|
93
94
|
|
|
94
|
-
KNativePointer impl_CreateContextFromString(KNativePointer configPtr, KStringPtr& sourcePtr, KStringPtr& filenamePtr)
|
|
95
|
-
{
|
|
96
|
-
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
97
|
-
return GetImpl()->CreateContextFromString(config, sourcePtr.data(), filenamePtr.data());
|
|
98
|
-
}
|
|
99
|
-
KOALA_INTEROP_3(CreateContextFromString, KNativePointer, KNativePointer, KStringPtr, KStringPtr)
|
|
100
|
-
|
|
101
|
-
KNativePointer impl_CreateContextFromFile(KNativePointer configPtr, KStringPtr& filenamePtr)
|
|
102
|
-
{
|
|
103
|
-
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
104
|
-
return GetImpl()->CreateContextFromFile(config, getStringCopy(filenamePtr));
|
|
105
|
-
}
|
|
106
|
-
KOALA_INTEROP_2(CreateContextFromFile, KNativePointer, KNativePointer, KStringPtr)
|
|
107
|
-
|
|
108
95
|
KNativePointer impl_SignatureFunction(KNativePointer context, KNativePointer classInstance)
|
|
109
96
|
{
|
|
110
97
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
@@ -120,7 +107,7 @@ static KNativePointer impl_ProgramExternalSources(KNativePointer contextPtr, KNa
|
|
|
120
107
|
auto&& instance = reinterpret_cast<es2panda_Program*>(instancePtr);
|
|
121
108
|
std::size_t source_len = 0;
|
|
122
109
|
auto external_sources = GetImpl()->ProgramExternalSources(context, instance, &source_len);
|
|
123
|
-
return StageArena::
|
|
110
|
+
return StageArena::CloneVector(external_sources, source_len);
|
|
124
111
|
}
|
|
125
112
|
KOALA_INTEROP_2(ProgramExternalSources, KNativePointer, KNativePointer, KNativePointer);
|
|
126
113
|
|
|
@@ -139,7 +126,7 @@ static KNativePointer impl_ProgramSourceFilePath(KNativePointer contextPtr, KNat
|
|
|
139
126
|
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
140
127
|
auto&& instance = reinterpret_cast<es2panda_Program*>(instancePtr);
|
|
141
128
|
auto&& result = GetImpl()->ProgramSourceFilePathConst(context, instance);
|
|
142
|
-
return StageArena::
|
|
129
|
+
return StageArena::Strdup(result);
|
|
143
130
|
}
|
|
144
131
|
KOALA_INTEROP_2(ProgramSourceFilePath, KNativePointer, KNativePointer, KNativePointer);
|
|
145
132
|
|
|
@@ -147,7 +134,7 @@ static KNativePointer impl_ExternalSourceName(KNativePointer instance)
|
|
|
147
134
|
{
|
|
148
135
|
auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource*>(instance);
|
|
149
136
|
auto&& result = GetImpl()->ExternalSourceName(_instance_);
|
|
150
|
-
return StageArena::
|
|
137
|
+
return StageArena::Strdup(result);
|
|
151
138
|
}
|
|
152
139
|
KOALA_INTEROP_1(ExternalSourceName, KNativePointer, KNativePointer);
|
|
153
140
|
|
|
@@ -156,7 +143,7 @@ static KNativePointer impl_ExternalSourcePrograms(KNativePointer instance)
|
|
|
156
143
|
auto&& _instance_ = reinterpret_cast<es2panda_ExternalSource*>(instance);
|
|
157
144
|
std::size_t program_len = 0;
|
|
158
145
|
auto programs = GetImpl()->ExternalSourcePrograms(_instance_, &program_len);
|
|
159
|
-
return StageArena::
|
|
146
|
+
return StageArena::CloneVector(programs, program_len);
|
|
160
147
|
}
|
|
161
148
|
KOALA_INTEROP_1(ExternalSourcePrograms, KNativePointer, KNativePointer);
|
|
162
149
|
|
|
@@ -210,30 +197,6 @@ KNativePointer impl_OptionsArkTsConfig(KNativePointer context, KNativePointer op
|
|
|
210
197
|
}
|
|
211
198
|
KOALA_INTEROP_2(OptionsArkTsConfig, KNativePointer, KNativePointer, KNativePointer)
|
|
212
199
|
|
|
213
|
-
KNativePointer impl_CreateCacheContextFromFile(
|
|
214
|
-
KNativePointer configPtr, KStringPtr& source_file_namePtr, KNativePointer globalContextPtr, KBoolean isExternal)
|
|
215
|
-
{
|
|
216
|
-
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
217
|
-
auto globalContext = reinterpret_cast<es2panda_GlobalContext*>(globalContextPtr);
|
|
218
|
-
return GetImpl()->CreateCacheContextFromFile(config, getStringCopy(source_file_namePtr), globalContext, isExternal);
|
|
219
|
-
}
|
|
220
|
-
KOALA_INTEROP_4(CreateCacheContextFromFile, KNativePointer, KNativePointer, KStringPtr, KNativePointer, KBoolean)
|
|
221
|
-
|
|
222
|
-
KNativePointer impl_CreateGlobalContext(
|
|
223
|
-
KNativePointer configPtr, KStringArray& externalFileListPtr, KUInt fileNum, KBoolean LspUsage)
|
|
224
|
-
{
|
|
225
|
-
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
226
|
-
return GetImpl()->CreateGlobalContext(config, getStringArray(externalFileListPtr), fileNum, LspUsage);
|
|
227
|
-
}
|
|
228
|
-
KOALA_INTEROP_4(CreateGlobalContext, KNativePointer, KNativePointer, KStringArray, KUInt, KBoolean)
|
|
229
|
-
|
|
230
|
-
void impl_DestroyGlobalContext(KNativePointer globalContextPtr)
|
|
231
|
-
{
|
|
232
|
-
auto globalContext = reinterpret_cast<es2panda_GlobalContext*>(globalContextPtr);
|
|
233
|
-
GetImpl()->DestroyGlobalContext(globalContext);
|
|
234
|
-
}
|
|
235
|
-
KOALA_INTEROP_V1(DestroyGlobalContext, KNativePointer)
|
|
236
|
-
|
|
237
200
|
// All these "Checker_" bridges are related to checker namespace in es2panda, so work with them carefully
|
|
238
201
|
// Checker.Type does reset on recheck, so modifying them makes no sence
|
|
239
202
|
// It seems that compiler does not provide API to convert Checker.Type to ir.Type
|
|
@@ -312,7 +275,7 @@ KNativePointer impl_Checker_TypeToString(KNativePointer context, KNativePointer
|
|
|
312
275
|
auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
313
276
|
auto _type = reinterpret_cast<es2panda_Type*>(type);
|
|
314
277
|
auto result = GetImpl()->TypeToStringConst(_context, _type);
|
|
315
|
-
return StageArena::
|
|
278
|
+
return StageArena::Strdup(result);
|
|
316
279
|
}
|
|
317
280
|
KOALA_INTEROP_2(Checker_TypeToString, KNativePointer, KNativePointer, KNativePointer)
|
|
318
281
|
|
|
@@ -384,7 +347,7 @@ KNativePointer impl_TSInterfaceBodyBodyPtr(KNativePointer context, KNativePointe
|
|
|
384
347
|
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
385
348
|
std::size_t length;
|
|
386
349
|
auto result = GetImpl()->TSInterfaceBodyBodyPtr(_context, _receiver, &length);
|
|
387
|
-
return StageArena::
|
|
350
|
+
return StageArena::CloneVector(result, length);
|
|
388
351
|
}
|
|
389
352
|
KOALA_INTEROP_2(TSInterfaceBodyBodyPtr, KNativePointer, KNativePointer, KNativePointer);
|
|
390
353
|
|
|
@@ -394,7 +357,7 @@ KNativePointer impl_AnnotationDeclarationPropertiesPtrConst(KNativePointer conte
|
|
|
394
357
|
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
395
358
|
std::size_t length;
|
|
396
359
|
auto result = GetImpl()->AnnotationDeclarationPropertiesPtrConst(_context, _receiver, &length);
|
|
397
|
-
return StageArena::
|
|
360
|
+
return StageArena::CloneVector(result, length);
|
|
398
361
|
}
|
|
399
362
|
KOALA_INTEROP_2(AnnotationDeclarationPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer);
|
|
400
363
|
|
|
@@ -415,31 +378,6 @@ KNativePointer impl_CreateDiagnosticKind(KNativePointer context, KStringPtr& mes
|
|
|
415
378
|
}
|
|
416
379
|
KOALA_INTEROP_3(CreateDiagnosticKind, KNativePointer, KNativePointer, KStringPtr, KInt)
|
|
417
380
|
|
|
418
|
-
KNativePointer impl_CreateDiagnosticInfo(
|
|
419
|
-
KNativePointer context, KNativePointer kind, KStringArray& argsPtr, KInt argc, KNativePointer pos)
|
|
420
|
-
{
|
|
421
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
422
|
-
const auto _kind = reinterpret_cast<es2panda_DiagnosticKind*>(kind);
|
|
423
|
-
const auto _pos = reinterpret_cast<es2panda_SourcePosition*>(pos);
|
|
424
|
-
return GetImpl()->CreateDiagnosticInfo(_context, _kind, getStringArray(argsPtr), argc, _pos);
|
|
425
|
-
}
|
|
426
|
-
KOALA_INTEROP_5(
|
|
427
|
-
CreateDiagnosticInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt, KNativePointer)
|
|
428
|
-
|
|
429
|
-
KNativePointer impl_CreateSuggestionInfo(KNativePointer context, KNativePointer kind, KStringArray& argsPtr, KInt argc,
|
|
430
|
-
KStringPtr& substitutionCode, KStringPtr& title, KNativePointer range)
|
|
431
|
-
{
|
|
432
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
433
|
-
const auto _kind = reinterpret_cast<es2panda_DiagnosticKind*>(kind);
|
|
434
|
-
const auto _title = getStringCopy(title);
|
|
435
|
-
const auto _range = reinterpret_cast<es2panda_SourceRange*>(range);
|
|
436
|
-
const auto _substitutionCode = getStringCopy(substitutionCode);
|
|
437
|
-
return GetImpl()->CreateSuggestionInfo(
|
|
438
|
-
_context, _kind, getStringArray(argsPtr), argc, _substitutionCode, _title, _range);
|
|
439
|
-
}
|
|
440
|
-
KOALA_INTEROP_7(CreateSuggestionInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt, KStringPtr,
|
|
441
|
-
KStringPtr, KNativePointer)
|
|
442
|
-
|
|
443
381
|
void impl_LogDiagnostic(
|
|
444
382
|
KNativePointer context, KNativePointer kind, KStringArray& argvPtr, KInt argc, KNativePointer pos)
|
|
445
383
|
{
|
|
@@ -456,28 +394,10 @@ KNativePointer impl_AnnotationUsageIrPropertiesPtrConst(KNativePointer context,
|
|
|
456
394
|
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
457
395
|
std::size_t length;
|
|
458
396
|
auto result = GetImpl()->AnnotationUsageIrPropertiesPtrConst(_context, _receiver, &length);
|
|
459
|
-
return StageArena::
|
|
397
|
+
return StageArena::CloneVector(result, length);
|
|
460
398
|
}
|
|
461
399
|
KOALA_INTEROP_2(AnnotationUsageIrPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer);
|
|
462
400
|
|
|
463
|
-
KInt impl_GenerateTsDeclarationsFromContext(KNativePointer contextPtr, KStringPtr& outputDeclEts, KStringPtr& outputEts,
|
|
464
|
-
KBoolean exportAll, KBoolean isolated, KStringPtr& recordFile, KBoolean genAnnotations)
|
|
465
|
-
{
|
|
466
|
-
auto context = reinterpret_cast<es2panda_Context*>(contextPtr);
|
|
467
|
-
return GetImpl()->GenerateTsDeclarationsFromContext(
|
|
468
|
-
context, outputDeclEts.data(), outputEts.data(), exportAll, isolated, recordFile.data(), genAnnotations);
|
|
469
|
-
}
|
|
470
|
-
KOALA_INTEROP_7(GenerateTsDeclarationsFromContext, KInt, KNativePointer, KStringPtr, KStringPtr, KBoolean, KBoolean,
|
|
471
|
-
KStringPtr, KBoolean)
|
|
472
|
-
|
|
473
|
-
KNativePointer impl_CreateContextGenerateAbcForExternalSourceFiles(
|
|
474
|
-
KNativePointer configPtr, KInt fileNamesCount, KStringArray& fileNames)
|
|
475
|
-
{
|
|
476
|
-
auto config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
477
|
-
return GetImpl()->CreateContextGenerateAbcForExternalSourceFiles(config, fileNamesCount, getStringArray(fileNames));
|
|
478
|
-
}
|
|
479
|
-
KOALA_INTEROP_3(CreateContextGenerateAbcForExternalSourceFiles, KNativePointer, KNativePointer, KInt, KStringArray)
|
|
480
|
-
|
|
481
401
|
KInt impl_GetCompilationMode(KNativePointer configPtr)
|
|
482
402
|
{
|
|
483
403
|
auto _config = reinterpret_cast<es2panda_Config*>(configPtr);
|
|
@@ -502,3 +422,22 @@ KNativePointer impl_CreateTypeNodeFromTsType(KNativePointer context, KNativePoin
|
|
|
502
422
|
return _typeAnnotation;
|
|
503
423
|
}
|
|
504
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);
|