@idlizer/arktscgen 2.1.10-arktscgen-3 → 2.1.10-arktscgen-4
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/native/src/generated/bridges.cc +39 -37
- package/build/libarkts-copy/package.json +10 -10
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +8 -2
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +11 -7
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +33 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +46 -0
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +22 -2
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +103 -109
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +10 -10
- package/build/libarkts-copy/src/generated/factory.ts +5 -6
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +3 -0
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +9 -15
- package/build/libarkts-copy/src/utils.ts +0 -3
- package/lib/index.js +338 -99
- package/package.json +4 -5
- package/templates/factory.ts +1 -1
- package/templates/peer.ts +1 -1
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
#include <common.h>
|
|
17
17
|
|
|
18
18
|
/*
|
|
19
|
-
* THIS FILE IS AUTOGENERATED BY arktscgen v2.1.10
|
|
20
|
-
* es2panda
|
|
19
|
+
* THIS FILE IS AUTOGENERATED BY arktscgen v2.1.10-arktscgen-3a. DO NOT EDIT MANUALLY!
|
|
20
|
+
* es2panda b1eea1e8c27124f2f9195f99735c91bcbfb5523a(2025-08-26) sdk v1.5.0-dev.43047
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
KNativePointer impl_GetAllErrorMessages(KNativePointer context)
|
|
@@ -9945,73 +9945,56 @@ KNativePointer impl_UpdateCharLiteral(KNativePointer context, KNativePointer ori
|
|
|
9945
9945
|
}
|
|
9946
9946
|
KOALA_INTEROP_2(UpdateCharLiteral, KNativePointer, KNativePointer, KNativePointer);
|
|
9947
9947
|
|
|
9948
|
-
KNativePointer impl_CreateETSIntrinsicNode(KNativePointer context)
|
|
9949
|
-
{
|
|
9950
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9951
|
-
auto result = GetImpl()->CreateETSIntrinsicNode(_context);
|
|
9952
|
-
return result;
|
|
9953
|
-
}
|
|
9954
|
-
KOALA_INTEROP_1(CreateETSIntrinsicNode, KNativePointer, KNativePointer);
|
|
9955
|
-
|
|
9956
|
-
KNativePointer impl_UpdateETSIntrinsicNode(KNativePointer context, KNativePointer original)
|
|
9957
|
-
{
|
|
9958
|
-
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9959
|
-
const auto _original = reinterpret_cast<es2panda_AstNode*>(original);
|
|
9960
|
-
auto result = GetImpl()->UpdateETSIntrinsicNode(_context, _original);
|
|
9961
|
-
return result;
|
|
9962
|
-
}
|
|
9963
|
-
KOALA_INTEROP_2(UpdateETSIntrinsicNode, KNativePointer, KNativePointer, KNativePointer);
|
|
9964
|
-
|
|
9965
|
-
KNativePointer impl_CreateETSIntrinsicNode1(KNativePointer context, KNativePointer other)
|
|
9948
|
+
KNativePointer impl_CreateETSIntrinsicNode(KNativePointer context, KNativePointer other)
|
|
9966
9949
|
{
|
|
9967
9950
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9968
9951
|
const auto _other = reinterpret_cast<es2panda_AstNode*>(other);
|
|
9969
|
-
auto result = GetImpl()->
|
|
9952
|
+
auto result = GetImpl()->CreateETSIntrinsicNode(_context, _other);
|
|
9970
9953
|
return result;
|
|
9971
9954
|
}
|
|
9972
|
-
KOALA_INTEROP_2(
|
|
9955
|
+
KOALA_INTEROP_2(CreateETSIntrinsicNode, KNativePointer, KNativePointer, KNativePointer);
|
|
9973
9956
|
|
|
9974
|
-
KNativePointer
|
|
9957
|
+
KNativePointer impl_UpdateETSIntrinsicNode(KNativePointer context, KNativePointer original, KNativePointer other)
|
|
9975
9958
|
{
|
|
9976
9959
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9977
9960
|
const auto _original = reinterpret_cast<es2panda_AstNode*>(original);
|
|
9978
9961
|
const auto _other = reinterpret_cast<es2panda_AstNode*>(other);
|
|
9979
|
-
auto result = GetImpl()->
|
|
9962
|
+
auto result = GetImpl()->UpdateETSIntrinsicNode(_context, _original, _other);
|
|
9980
9963
|
return result;
|
|
9981
9964
|
}
|
|
9982
|
-
KOALA_INTEROP_3(
|
|
9965
|
+
KOALA_INTEROP_3(UpdateETSIntrinsicNode, KNativePointer, KNativePointer, KNativePointer, KNativePointer);
|
|
9983
9966
|
|
|
9984
|
-
KNativePointer
|
|
9967
|
+
KNativePointer impl_CreateETSIntrinsicNode1(KNativePointer context, KStringPtr& id, KNativePointerArray _arguments, KUInt _argumentsSequenceLength)
|
|
9985
9968
|
{
|
|
9986
9969
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9987
|
-
const auto
|
|
9970
|
+
const auto _id = getStringCopy(id);
|
|
9988
9971
|
const auto __arguments = reinterpret_cast<es2panda_AstNode**>(_arguments);
|
|
9989
9972
|
const auto __argumentsSequenceLength = static_cast<KUInt>(_argumentsSequenceLength);
|
|
9990
|
-
auto result = GetImpl()->
|
|
9973
|
+
auto result = GetImpl()->CreateETSIntrinsicNode1(_context, _id, __arguments, __argumentsSequenceLength);
|
|
9991
9974
|
return result;
|
|
9992
9975
|
}
|
|
9993
|
-
KOALA_INTEROP_4(
|
|
9976
|
+
KOALA_INTEROP_4(CreateETSIntrinsicNode1, KNativePointer, KNativePointer, KStringPtr, KNativePointerArray, KUInt);
|
|
9994
9977
|
|
|
9995
|
-
KNativePointer
|
|
9978
|
+
KNativePointer impl_UpdateETSIntrinsicNode1(KNativePointer context, KNativePointer original, KStringPtr& id, KNativePointerArray _arguments, KUInt _argumentsSequenceLength)
|
|
9996
9979
|
{
|
|
9997
9980
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
9998
9981
|
const auto _original = reinterpret_cast<es2panda_AstNode*>(original);
|
|
9999
|
-
const auto
|
|
9982
|
+
const auto _id = getStringCopy(id);
|
|
10000
9983
|
const auto __arguments = reinterpret_cast<es2panda_AstNode**>(_arguments);
|
|
10001
9984
|
const auto __argumentsSequenceLength = static_cast<KUInt>(_argumentsSequenceLength);
|
|
10002
|
-
auto result = GetImpl()->
|
|
9985
|
+
auto result = GetImpl()->UpdateETSIntrinsicNode1(_context, _original, _id, __arguments, __argumentsSequenceLength);
|
|
10003
9986
|
return result;
|
|
10004
9987
|
}
|
|
10005
|
-
KOALA_INTEROP_5(
|
|
9988
|
+
KOALA_INTEROP_5(UpdateETSIntrinsicNode1, KNativePointer, KNativePointer, KNativePointer, KStringPtr, KNativePointerArray, KUInt);
|
|
10006
9989
|
|
|
10007
|
-
|
|
9990
|
+
KNativePointer impl_ETSIntrinsicNodeIdConst(KNativePointer context, KNativePointer receiver)
|
|
10008
9991
|
{
|
|
10009
9992
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
10010
9993
|
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
10011
|
-
auto result = GetImpl()->
|
|
10012
|
-
return result;
|
|
9994
|
+
auto result = GetImpl()->ETSIntrinsicNodeIdConst(_context, _receiver);
|
|
9995
|
+
return StageArena::strdup(result);
|
|
10013
9996
|
}
|
|
10014
|
-
KOALA_INTEROP_2(
|
|
9997
|
+
KOALA_INTEROP_2(ETSIntrinsicNodeIdConst, KNativePointer, KNativePointer, KNativePointer);
|
|
10015
9998
|
|
|
10016
9999
|
KNativePointer impl_ETSIntrinsicNodeArgumentsConst(KNativePointer context, KNativePointer receiver)
|
|
10017
10000
|
{
|
|
@@ -10023,6 +10006,16 @@ KNativePointer impl_ETSIntrinsicNodeArgumentsConst(KNativePointer context, KNati
|
|
|
10023
10006
|
}
|
|
10024
10007
|
KOALA_INTEROP_2(ETSIntrinsicNodeArgumentsConst, KNativePointer, KNativePointer, KNativePointer);
|
|
10025
10008
|
|
|
10009
|
+
KNativePointer impl_ETSIntrinsicNodeArguments(KNativePointer context, KNativePointer receiver)
|
|
10010
|
+
{
|
|
10011
|
+
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
10012
|
+
const auto _receiver = reinterpret_cast<es2panda_AstNode*>(receiver);
|
|
10013
|
+
std::size_t length;
|
|
10014
|
+
auto result = GetImpl()->ETSIntrinsicNodeArguments(_context, _receiver, &length);
|
|
10015
|
+
return length ? StageArena::cloneVector(result, length) : nullptr;
|
|
10016
|
+
}
|
|
10017
|
+
KOALA_INTEROP_2(ETSIntrinsicNodeArguments, KNativePointer, KNativePointer, KNativePointer);
|
|
10018
|
+
|
|
10026
10019
|
KNativePointer impl_CreateETSPackageDeclaration(KNativePointer context, KNativePointer name)
|
|
10027
10020
|
{
|
|
10028
10021
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
@@ -16362,6 +16355,15 @@ KNativePointer impl_ArkTsConfigOutDirConst(KNativePointer context, KNativePointe
|
|
|
16362
16355
|
}
|
|
16363
16356
|
KOALA_INTEROP_2(ArkTsConfigOutDirConst, KNativePointer, KNativePointer, KNativePointer);
|
|
16364
16357
|
|
|
16358
|
+
KNativePointer impl_ArkTsConfigCacheDirConst(KNativePointer context, KNativePointer receiver)
|
|
16359
|
+
{
|
|
16360
|
+
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
16361
|
+
const auto _receiver = reinterpret_cast<es2panda_ArkTsConfig*>(receiver);
|
|
16362
|
+
auto result = GetImpl()->ArkTsConfigCacheDirConst(_context, _receiver);
|
|
16363
|
+
return StageArena::strdup(result);
|
|
16364
|
+
}
|
|
16365
|
+
KOALA_INTEROP_2(ArkTsConfigCacheDirConst, KNativePointer, KNativePointer, KNativePointer);
|
|
16366
|
+
|
|
16365
16367
|
KBoolean impl_ArkTsConfigUseUrlConst(KNativePointer context, KNativePointer receiver)
|
|
16366
16368
|
{
|
|
16367
16369
|
const auto _context = reinterpret_cast<es2panda_Context*>(context);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaui/libarkts",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10+devel",
|
|
4
4
|
"bin": "./lib/es2panda",
|
|
5
5
|
"typesVersions": {
|
|
6
6
|
"*": {
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@koalaui/ets-tsc": "4.9.5-r6",
|
|
31
|
-
"@koalaui/build-common": "1.7.
|
|
32
|
-
"@koalaui/compat": "1.7.
|
|
33
|
-
"@koalaui/common": "1.7.
|
|
34
|
-
"@koalaui/harness": "1.7.
|
|
35
|
-
"@koalaui/interop": "1.7.
|
|
36
|
-
"@koalaui/fast-arktsc": "1.7.
|
|
37
|
-
"@idlizer/arktscgen": "2.1.10-arktscgen-
|
|
31
|
+
"@koalaui/build-common": "1.7.10+devel",
|
|
32
|
+
"@koalaui/compat": "1.7.10+devel",
|
|
33
|
+
"@koalaui/common": "1.7.10+devel",
|
|
34
|
+
"@koalaui/harness": "1.7.10+devel",
|
|
35
|
+
"@koalaui/interop": "1.7.10+devel",
|
|
36
|
+
"@koalaui/fast-arktsc": "1.7.10+devel",
|
|
37
|
+
"@idlizer/arktscgen": "2.1.10-arktscgen-3a",
|
|
38
38
|
"@types/mocha": "^9.1.0",
|
|
39
39
|
"mocha": "^9.2.2",
|
|
40
40
|
"node-addon-api": "8.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"direct": "fast-arktsc --config arktsconfig.json --compiler ../../incremental/tools/panda/arkts/ui2abc --link-name ./build/abc/main.abc && ninja -f build/abc/build.ninja",
|
|
67
67
|
"simultaneous": "mkdir -p build/abc && bash ../../incremental/tools/panda/arkts/ui2abc --simultaneous --arktsconfig arktsconfig.json --output ./build/abc/main.abc:./build/abc/library.abc plugins/input/main.ets:plugins/input/library.ets",
|
|
68
68
|
"run": "npm run compile && npm run compile:plugins && npm run simultaneous",
|
|
69
|
-
"run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin && npm run memo",
|
|
69
|
+
"run:memo": "npm run compile && npm run compile:plugins && npm run compile --prefix ../memo-plugin-ng && npm run memo",
|
|
70
70
|
"run:abc": "$npm_package_config_panda_sdk_path/linux_host_tools/bin/ark --load-runtimes=ets --boot-panda-files=$npm_package_config_panda_sdk_path/ets/etsstdlib.abc ./main.abc main.ETSGLOBAL::main",
|
|
71
71
|
"mocha": "PANDA_SDK_PATH=${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} TS_NODE_PROJECT=./test/tsconfig.json mocha -r tsconfig-paths/register --reporter-option maxDiffSize=0",
|
|
72
72
|
"test:light": "npm run mocha",
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
"regenerate": "rimraf -rf src/generated && arktscgen --panda-sdk-path ${PANDA_SDK_PATH:=$npm_package_config_panda_sdk_path} --output-dir ../ --options-file ./generator/options.json5 --no-initialize",
|
|
82
82
|
"reinstall:regenerate": "npm run panda:sdk:reinstall && npm run regenerate && git diff --shortstat"
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
CallExpression,
|
|
19
19
|
ClassDefinition,
|
|
20
20
|
ClassProperty,
|
|
21
|
+
ClassStaticBlock,
|
|
21
22
|
ETSImportDeclaration,
|
|
22
23
|
ETSModule,
|
|
23
24
|
ETSStructDeclaration,
|
|
@@ -30,8 +31,8 @@ import {
|
|
|
30
31
|
VariableDeclarator,
|
|
31
32
|
} from "../../generated"
|
|
32
33
|
import { factory as generatedFactory } from "../../generated/factory"
|
|
33
|
-
import { createScriptFunction, updateScriptFunction } from "../node-utilities/ScriptFunction"
|
|
34
|
-
import { updateCallExpression } from "../node-utilities/CallExpression"
|
|
34
|
+
import { createScriptFunction, inplaceUpdateScriptFunction, updateScriptFunction } from "../node-utilities/ScriptFunction"
|
|
35
|
+
import { inplaceUpdateCallExpression, updateCallExpression } from "../node-utilities/CallExpression"
|
|
35
36
|
import { createNumberLiteral, updateNumberLiteral } from "../node-utilities/NumberLiteral"
|
|
36
37
|
import { updateMemberExpression } from "../node-utilities/MemberExpression"
|
|
37
38
|
import { createETSParameterExpression, updateETSParameterExpression } from "../node-utilities/ETSParameterExpression"
|
|
@@ -62,12 +63,14 @@ export const factory = {
|
|
|
62
63
|
|
|
63
64
|
createCallExpression: CallExpression.createCallExpression,
|
|
64
65
|
updateCallExpression,
|
|
66
|
+
inplaceUpdateCallExpression,
|
|
65
67
|
|
|
66
68
|
createMemberExpression: MemberExpression.createMemberExpression,
|
|
67
69
|
updateMemberExpression,
|
|
68
70
|
|
|
69
71
|
createScriptFunction,
|
|
70
72
|
updateScriptFunction,
|
|
73
|
+
inplaceUpdateScriptFunction,
|
|
71
74
|
|
|
72
75
|
createNumberLiteral,
|
|
73
76
|
updateNumberLiteral,
|
|
@@ -125,5 +128,8 @@ export const factory = {
|
|
|
125
128
|
|
|
126
129
|
updateInterfaceBody : generatedFactory.updateTSInterfaceBody,
|
|
127
130
|
|
|
131
|
+
createClassStaticBlock: ClassStaticBlock.createClassStaticBlock,
|
|
132
|
+
updateClassStaticBlock: ClassStaticBlock.updateClassStaticBlock,
|
|
133
|
+
|
|
128
134
|
createOpaqueTypeNode,
|
|
129
135
|
}
|
|
@@ -15,25 +15,29 @@
|
|
|
15
15
|
|
|
16
16
|
import { KNativePointer } from "@koalaui/interop"
|
|
17
17
|
import { AstNode } from "./peers/AstNode"
|
|
18
|
-
import { Es2pandaAstNodeType } from "src/generated/Es2pandaEnums"
|
|
19
18
|
|
|
20
19
|
export class NodeCache {
|
|
21
20
|
private static cache = new Map<KNativePointer, AstNode>()
|
|
22
21
|
|
|
22
|
+
static cached<T extends AstNode>(pointer: KNativePointer, factory: (pointer: KNativePointer) => AstNode): T {
|
|
23
|
+
const cached = NodeCache.cache.get(pointer)
|
|
24
|
+
if (cached !== undefined) {
|
|
25
|
+
return cached as T
|
|
26
|
+
}
|
|
27
|
+
const node = factory(pointer)
|
|
28
|
+
NodeCache.addToCache(pointer, node)
|
|
29
|
+
return node as T
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
static get<T extends AstNode>(pointer: KNativePointer): T | undefined {
|
|
24
33
|
return NodeCache.cache.get(pointer) as T | undefined
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
public static addToCache(pointer: KNativePointer, node: AstNode) {
|
|
28
|
-
|
|
29
|
-
|| node.astNodeType == Es2pandaAstNodeType.AST_NODE_TYPE_ETS_FUNCTION_TYPE
|
|
30
|
-
|| node.astNodeType == Es2pandaAstNodeType.AST_NODE_TYPE_CALL_EXPRESSION) {
|
|
31
|
-
NodeCache.cache.set(pointer, node)
|
|
32
|
-
}
|
|
37
|
+
NodeCache.cache.set(pointer, node)
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
public static clear(): void {
|
|
36
|
-
console.log("SIZE WAS", NodeCache.cache.size, "ON CLEAR")
|
|
37
41
|
NodeCache.cache.clear()
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -39,4 +39,36 @@ export function updateCallExpression(
|
|
|
39
39
|
CallExpression.createCallExpression(callee, _arguments, typeParams, optional_arg, trailingComma, trailingBlock),
|
|
40
40
|
original
|
|
41
41
|
)
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function inplaceUpdateCallExpression(
|
|
45
|
+
original: CallExpression,
|
|
46
|
+
callee: Expression | undefined,
|
|
47
|
+
_arguments: readonly Expression[],
|
|
48
|
+
typeParams: TSTypeParameterInstantiation | undefined,
|
|
49
|
+
optional_arg: boolean = false,
|
|
50
|
+
trailingComma: boolean = false,
|
|
51
|
+
trailingBlock: BlockStatement | undefined = undefined,
|
|
52
|
+
) {
|
|
53
|
+
if (!isSameNativeObject(optional_arg, original.isOptional)
|
|
54
|
+
|| !isSameNativeObject(trailingComma, original.hasTrailingComma)
|
|
55
|
+
) {
|
|
56
|
+
// unlikely
|
|
57
|
+
console.log(`Did not managed to update call expression ${callee?.dumpSrc()} inplace!`)
|
|
58
|
+
const result = CallExpression.createCallExpression(
|
|
59
|
+
callee,
|
|
60
|
+
_arguments,
|
|
61
|
+
typeParams,
|
|
62
|
+
optional_arg,
|
|
63
|
+
trailingComma,
|
|
64
|
+
trailingBlock
|
|
65
|
+
)
|
|
66
|
+
result.onUpdate(original)
|
|
67
|
+
return result
|
|
68
|
+
}
|
|
69
|
+
original.setCallee(callee)
|
|
70
|
+
original.setArguments(_arguments)
|
|
71
|
+
original.setTypeParams(typeParams)
|
|
72
|
+
original.setTrailingBlock(trailingBlock)
|
|
73
|
+
return original
|
|
74
|
+
}
|
|
@@ -108,3 +108,49 @@ export function updateScriptFunction(
|
|
|
108
108
|
original
|
|
109
109
|
)
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
export function inplaceUpdateScriptFunction(
|
|
113
|
+
original: ScriptFunction,
|
|
114
|
+
databody: AstNode | undefined,
|
|
115
|
+
typeParams: TSTypeParameterDeclaration | undefined,
|
|
116
|
+
params: readonly Expression[],
|
|
117
|
+
returnTypeAnnotation: TypeNode | undefined,
|
|
118
|
+
hasReceiver: boolean,
|
|
119
|
+
datafuncFlags: Es2pandaScriptFunctionFlags,
|
|
120
|
+
dataflags: Es2pandaModifierFlags,
|
|
121
|
+
ident: Identifier | undefined,
|
|
122
|
+
annotations: readonly AnnotationUsage[] | undefined,
|
|
123
|
+
signaturePointer?: KNativePointer,
|
|
124
|
+
preferredReturnTypePointer?: KNativePointer,
|
|
125
|
+
) {
|
|
126
|
+
if (!isSameNativeObject(typeParams, original.typeParams)
|
|
127
|
+
|| !isSameNativeObject(hasReceiver, original.hasReceiver)
|
|
128
|
+
|| !isSameNativeObject(datafuncFlags, original.flags)) {
|
|
129
|
+
// unlikely
|
|
130
|
+
console.log(`Did not managed to update script function ${ident?.name} inplace!`)
|
|
131
|
+
const result = createScriptFunction(
|
|
132
|
+
databody,
|
|
133
|
+
typeParams,
|
|
134
|
+
params,
|
|
135
|
+
returnTypeAnnotation,
|
|
136
|
+
hasReceiver,
|
|
137
|
+
datafuncFlags,
|
|
138
|
+
dataflags,
|
|
139
|
+
ident,
|
|
140
|
+
annotations,
|
|
141
|
+
signaturePointer,
|
|
142
|
+
preferredReturnTypePointer,
|
|
143
|
+
)
|
|
144
|
+
result.onUpdate(original)
|
|
145
|
+
return result
|
|
146
|
+
}
|
|
147
|
+
original.setBody(databody)
|
|
148
|
+
original.setParams(params)
|
|
149
|
+
original.setReturnTypeAnnotation(returnTypeAnnotation)
|
|
150
|
+
original.modifierFlags = dataflags
|
|
151
|
+
if (ident) original.setIdent(ident)
|
|
152
|
+
if (annotations) original.setAnnotations(annotations)
|
|
153
|
+
if (signaturePointer) original.setSignaturePointer(signaturePointer)
|
|
154
|
+
if (preferredReturnTypePointer) original.setPreferredReturnTypePointer(preferredReturnTypePointer)
|
|
155
|
+
return original
|
|
156
|
+
}
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import { global } from "../static/global"
|
|
17
17
|
import { isNumber, throwError, withWarning } from "../../utils"
|
|
18
18
|
import { KNativePointer, nullptr, KInt, KUInt} from "@koalaui/interop"
|
|
19
|
-
import { passNode, unpackNodeArray, unpackNonNullableNode, passString, unpackString, passStringArray } from "./private"
|
|
19
|
+
import { passNode, unpackNodeArray, unpackNonNullableNode, passString, unpackString, passStringArray, unpackNode } from "./private"
|
|
20
20
|
import { Es2pandaContextState, Es2pandaModifierFlags, Es2pandaMethodDefinitionKind, Es2pandaAstNodeType, Es2pandaPluginDiagnosticType } from "../../generated/Es2pandaEnums"
|
|
21
21
|
import type { AstNode } from "../peers/AstNode"
|
|
22
|
-
import { DiagnosticInfo, SourcePosition, SourceRange, SuggestionInfo } from "../../generated"
|
|
22
|
+
import { DiagnosticInfo, Identifier, isConditionalExpression, SourcePosition, SourceRange, SuggestionInfo, VariableDeclarator } from "../../generated"
|
|
23
23
|
import {
|
|
24
24
|
type AnnotationUsage,
|
|
25
25
|
ClassDefinition,
|
|
@@ -230,6 +230,26 @@ export function getPeerDecl(peer: KNativePointer): AstNode | undefined {
|
|
|
230
230
|
return unpackNonNullableNode(decl)
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
export function declarationFromIdentifier(node: Identifier): AstNode | undefined {
|
|
234
|
+
return unpackNode(global.generatedEs2panda._DeclarationFromIdentifier(global.context, node.peer))
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function resolveGensymVariableDeclaratorForDefaultParam(node: VariableDeclarator): Identifier | undefined {
|
|
238
|
+
const init = node.init
|
|
239
|
+
if (isConditionalExpression(init) && isIdentifier(init.consequent) && init.consequent.name.startsWith("gensym%%_")) {
|
|
240
|
+
return init.consequent
|
|
241
|
+
}
|
|
242
|
+
return undefined
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function resolveGensymVariableDeclaratorForOptionalCall(node: VariableDeclarator): Identifier | undefined {
|
|
246
|
+
const init = node.init
|
|
247
|
+
if (isIdentifier(node.id) && node.id.name.startsWith("gensym%%_") && isIdentifier(init)) {
|
|
248
|
+
return init
|
|
249
|
+
}
|
|
250
|
+
return undefined
|
|
251
|
+
}
|
|
252
|
+
|
|
233
253
|
export function getPeerObjectDecl(peer: KNativePointer): AstNode | undefined {
|
|
234
254
|
const decl = global.es2panda._ClassVariableDeclaration(global.context, peer);
|
|
235
255
|
if (decl === nullptr) {
|
|
@@ -849,10 +849,6 @@ export enum Es2pandaPrimitiveType {
|
|
|
849
849
|
PRIMITIVE_TYPE_CHAR = 7,
|
|
850
850
|
PRIMITIVE_TYPE_VOID = 8
|
|
851
851
|
}
|
|
852
|
-
export enum Es2pandaIntrinsicNodeType {
|
|
853
|
-
INTRINSIC_NODE_TYPE_NONE = 0,
|
|
854
|
-
INTRINSIC_NODE_TYPE_TYPE_REFERENCE = 1
|
|
855
|
-
}
|
|
856
852
|
export enum Es2pandaObjectFlags {
|
|
857
853
|
OBJECT_FLAGS_NO_OPTS = 0,
|
|
858
854
|
OBJECT_FLAGS_CHECK_EXCESS_PROPS = 1,
|
|
@@ -1016,111 +1012,109 @@ export enum Es2pandaGlobalTypeId {
|
|
|
1016
1012
|
GLOBAL_TYPE_ID_ETS_FUNCTION_BUILTIN = 78,
|
|
1017
1013
|
GLOBAL_TYPE_ID_ETS_REGEXP_BUILTIN = 79,
|
|
1018
1014
|
GLOBAL_TYPE_ID_ETS_ARRAY_BUILTIN = 80,
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
GLOBAL_TYPE_ID_TYPE_ERROR = 184,
|
|
1123
|
-
GLOBAL_TYPE_ID_COUNT = 185
|
|
1015
|
+
GLOBAL_TYPE_ID_ETS_BOX_BUILTIN = 81,
|
|
1016
|
+
GLOBAL_TYPE_ID_ETS_BOOLEAN_BOX_BUILTIN = 82,
|
|
1017
|
+
GLOBAL_TYPE_ID_ETS_BYTE_BOX_BUILTIN = 83,
|
|
1018
|
+
GLOBAL_TYPE_ID_ETS_CHAR_BOX_BUILTIN = 84,
|
|
1019
|
+
GLOBAL_TYPE_ID_ETS_SHORT_BOX_BUILTIN = 85,
|
|
1020
|
+
GLOBAL_TYPE_ID_ETS_INT_BOX_BUILTIN = 86,
|
|
1021
|
+
GLOBAL_TYPE_ID_ETS_LONG_BOX_BUILTIN = 87,
|
|
1022
|
+
GLOBAL_TYPE_ID_ETS_FLOAT_BOX_BUILTIN = 88,
|
|
1023
|
+
GLOBAL_TYPE_ID_ETS_DOUBLE_BOX_BUILTIN = 89,
|
|
1024
|
+
GLOBAL_TYPE_ID_ETS_BIG_INT_BUILTIN = 90,
|
|
1025
|
+
GLOBAL_TYPE_ID_ETS_BIG_INT = 91,
|
|
1026
|
+
GLOBAL_TYPE_ID_ETS_ARRAY = 92,
|
|
1027
|
+
GLOBAL_TYPE_ID_ETS_READONLY_ARRAY = 93,
|
|
1028
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION0_CLASS = 94,
|
|
1029
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION1_CLASS = 95,
|
|
1030
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION2_CLASS = 96,
|
|
1031
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION3_CLASS = 97,
|
|
1032
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION4_CLASS = 98,
|
|
1033
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION5_CLASS = 99,
|
|
1034
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION6_CLASS = 100,
|
|
1035
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION7_CLASS = 101,
|
|
1036
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION8_CLASS = 102,
|
|
1037
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION9_CLASS = 103,
|
|
1038
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION10_CLASS = 104,
|
|
1039
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION11_CLASS = 105,
|
|
1040
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION12_CLASS = 106,
|
|
1041
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION13_CLASS = 107,
|
|
1042
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION14_CLASS = 108,
|
|
1043
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION15_CLASS = 109,
|
|
1044
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION16_CLASS = 110,
|
|
1045
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONN_CLASS = 111,
|
|
1046
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA0_CLASS = 112,
|
|
1047
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA1_CLASS = 113,
|
|
1048
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA2_CLASS = 114,
|
|
1049
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA3_CLASS = 115,
|
|
1050
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA4_CLASS = 116,
|
|
1051
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA5_CLASS = 117,
|
|
1052
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA6_CLASS = 118,
|
|
1053
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA7_CLASS = 119,
|
|
1054
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA8_CLASS = 120,
|
|
1055
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA9_CLASS = 121,
|
|
1056
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA10_CLASS = 122,
|
|
1057
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA11_CLASS = 123,
|
|
1058
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA12_CLASS = 124,
|
|
1059
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA13_CLASS = 125,
|
|
1060
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA14_CLASS = 126,
|
|
1061
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA15_CLASS = 127,
|
|
1062
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA16_CLASS = 128,
|
|
1063
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAN_CLASS = 129,
|
|
1064
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR0_CLASS = 130,
|
|
1065
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR1_CLASS = 131,
|
|
1066
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR2_CLASS = 132,
|
|
1067
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR3_CLASS = 133,
|
|
1068
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR4_CLASS = 134,
|
|
1069
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR5_CLASS = 135,
|
|
1070
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR6_CLASS = 136,
|
|
1071
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR7_CLASS = 137,
|
|
1072
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR8_CLASS = 138,
|
|
1073
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR9_CLASS = 139,
|
|
1074
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR10_CLASS = 140,
|
|
1075
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR11_CLASS = 141,
|
|
1076
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR12_CLASS = 142,
|
|
1077
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR13_CLASS = 143,
|
|
1078
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR14_CLASS = 144,
|
|
1079
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR15_CLASS = 145,
|
|
1080
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR16_CLASS = 146,
|
|
1081
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR0_CLASS = 147,
|
|
1082
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR1_CLASS = 148,
|
|
1083
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR2_CLASS = 149,
|
|
1084
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR3_CLASS = 150,
|
|
1085
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR4_CLASS = 151,
|
|
1086
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR5_CLASS = 152,
|
|
1087
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR6_CLASS = 153,
|
|
1088
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR7_CLASS = 154,
|
|
1089
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR8_CLASS = 155,
|
|
1090
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR9_CLASS = 156,
|
|
1091
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR10_CLASS = 157,
|
|
1092
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR11_CLASS = 158,
|
|
1093
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR12_CLASS = 159,
|
|
1094
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR13_CLASS = 160,
|
|
1095
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR14_CLASS = 161,
|
|
1096
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR15_CLASS = 162,
|
|
1097
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR16_CLASS = 163,
|
|
1098
|
+
GLOBAL_TYPE_ID_ETS_TUPLE0_CLASS = 164,
|
|
1099
|
+
GLOBAL_TYPE_ID_ETS_TUPLE1_CLASS = 165,
|
|
1100
|
+
GLOBAL_TYPE_ID_ETS_TUPLE2_CLASS = 166,
|
|
1101
|
+
GLOBAL_TYPE_ID_ETS_TUPLE3_CLASS = 167,
|
|
1102
|
+
GLOBAL_TYPE_ID_ETS_TUPLE4_CLASS = 168,
|
|
1103
|
+
GLOBAL_TYPE_ID_ETS_TUPLE5_CLASS = 169,
|
|
1104
|
+
GLOBAL_TYPE_ID_ETS_TUPLE6_CLASS = 170,
|
|
1105
|
+
GLOBAL_TYPE_ID_ETS_TUPLE7_CLASS = 171,
|
|
1106
|
+
GLOBAL_TYPE_ID_ETS_TUPLE8_CLASS = 172,
|
|
1107
|
+
GLOBAL_TYPE_ID_ETS_TUPLE9_CLASS = 173,
|
|
1108
|
+
GLOBAL_TYPE_ID_ETS_TUPLE10_CLASS = 174,
|
|
1109
|
+
GLOBAL_TYPE_ID_ETS_TUPLE11_CLASS = 175,
|
|
1110
|
+
GLOBAL_TYPE_ID_ETS_TUPLE12_CLASS = 176,
|
|
1111
|
+
GLOBAL_TYPE_ID_ETS_TUPLE13_CLASS = 177,
|
|
1112
|
+
GLOBAL_TYPE_ID_ETS_TUPLE14_CLASS = 178,
|
|
1113
|
+
GLOBAL_TYPE_ID_ETS_TUPLE15_CLASS = 179,
|
|
1114
|
+
GLOBAL_TYPE_ID_ETS_TUPLE16_CLASS = 180,
|
|
1115
|
+
GLOBAL_TYPE_ID_ETS_TUPLEN_CLASS = 181,
|
|
1116
|
+
GLOBAL_TYPE_ID_TYPE_ERROR = 182,
|
|
1117
|
+
GLOBAL_TYPE_ID_COUNT = 183
|
|
1124
1118
|
}
|
|
1125
1119
|
export enum Es2pandaMethodDefinitionKind {
|
|
1126
1120
|
METHOD_DEFINITION_KIND_NONE = 0,
|