@idlizer/arktscgen 2.1.9-arktscgen-8 → 2.1.9-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 +27 -1
- package/build/libarkts-copy/native/src/bridges.cc +51 -13
- package/build/libarkts-copy/native/src/common.cc +6 -2
- package/build/libarkts-copy/native/src/common.h +1 -0
- package/build/libarkts-copy/native/src/generated/bridges.cc +30 -2
- package/build/libarkts-copy/package.json +4 -4
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +17 -5
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +0 -11
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +7 -0
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +4 -0
- package/build/libarkts-copy/src/arkts-api/plugins.ts +3 -4
- package/build/libarkts-copy/src/arkts-api/static/global.ts +1 -0
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +24 -1
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +68 -4
- package/build/libarkts-copy/src/arkts-api/visitor.ts +1 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +93 -91
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +9 -0
- package/build/libarkts-copy/src/generated/factory.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/Program.ts +2 -0
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +12 -0
- package/build/libarkts-copy/src/plugin-utils.ts +13 -3
- package/build/libarkts-copy/src/reexport-for-generated.ts +3 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +2 -1
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +2 -3
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +3 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +3 -2
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +2 -19
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +4 -2
- package/lib/index.js +159 -94
- package/package.json +2 -2
|
@@ -1024,96 +1024,97 @@ export enum Es2pandaGlobalTypeId {
|
|
|
1024
1024
|
GLOBAL_TYPE_ID_ETS_BIG_INT_BUILTIN = 92,
|
|
1025
1025
|
GLOBAL_TYPE_ID_ETS_BIG_INT = 93,
|
|
1026
1026
|
GLOBAL_TYPE_ID_ETS_ARRAY = 94,
|
|
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
|
-
|
|
1027
|
+
GLOBAL_TYPE_ID_ETS_READONLY_ARRAY = 95,
|
|
1028
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION0_CLASS = 96,
|
|
1029
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION1_CLASS = 97,
|
|
1030
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION2_CLASS = 98,
|
|
1031
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION3_CLASS = 99,
|
|
1032
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION4_CLASS = 100,
|
|
1033
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION5_CLASS = 101,
|
|
1034
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION6_CLASS = 102,
|
|
1035
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION7_CLASS = 103,
|
|
1036
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION8_CLASS = 104,
|
|
1037
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION9_CLASS = 105,
|
|
1038
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION10_CLASS = 106,
|
|
1039
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION11_CLASS = 107,
|
|
1040
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION12_CLASS = 108,
|
|
1041
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION13_CLASS = 109,
|
|
1042
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION14_CLASS = 110,
|
|
1043
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION15_CLASS = 111,
|
|
1044
|
+
GLOBAL_TYPE_ID_ETS_FUNCTION16_CLASS = 112,
|
|
1045
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONN_CLASS = 113,
|
|
1046
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA0_CLASS = 114,
|
|
1047
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA1_CLASS = 115,
|
|
1048
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA2_CLASS = 116,
|
|
1049
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA3_CLASS = 117,
|
|
1050
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA4_CLASS = 118,
|
|
1051
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA5_CLASS = 119,
|
|
1052
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA6_CLASS = 120,
|
|
1053
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA7_CLASS = 121,
|
|
1054
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA8_CLASS = 122,
|
|
1055
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA9_CLASS = 123,
|
|
1056
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA10_CLASS = 124,
|
|
1057
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA11_CLASS = 125,
|
|
1058
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA12_CLASS = 126,
|
|
1059
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA13_CLASS = 127,
|
|
1060
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA14_CLASS = 128,
|
|
1061
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA15_CLASS = 129,
|
|
1062
|
+
GLOBAL_TYPE_ID_ETS_LAMBDA16_CLASS = 130,
|
|
1063
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAN_CLASS = 131,
|
|
1064
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR0_CLASS = 132,
|
|
1065
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR1_CLASS = 133,
|
|
1066
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR2_CLASS = 134,
|
|
1067
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR3_CLASS = 135,
|
|
1068
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR4_CLASS = 136,
|
|
1069
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR5_CLASS = 137,
|
|
1070
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR6_CLASS = 138,
|
|
1071
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR7_CLASS = 139,
|
|
1072
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR8_CLASS = 140,
|
|
1073
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR9_CLASS = 141,
|
|
1074
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR10_CLASS = 142,
|
|
1075
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR11_CLASS = 143,
|
|
1076
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR12_CLASS = 144,
|
|
1077
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR13_CLASS = 145,
|
|
1078
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR14_CLASS = 146,
|
|
1079
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR15_CLASS = 147,
|
|
1080
|
+
GLOBAL_TYPE_ID_ETS_FUNCTIONR16_CLASS = 148,
|
|
1081
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR0_CLASS = 149,
|
|
1082
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR1_CLASS = 150,
|
|
1083
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR2_CLASS = 151,
|
|
1084
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR3_CLASS = 152,
|
|
1085
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR4_CLASS = 153,
|
|
1086
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR5_CLASS = 154,
|
|
1087
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR6_CLASS = 155,
|
|
1088
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR7_CLASS = 156,
|
|
1089
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR8_CLASS = 157,
|
|
1090
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR9_CLASS = 158,
|
|
1091
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR10_CLASS = 159,
|
|
1092
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR11_CLASS = 160,
|
|
1093
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR12_CLASS = 161,
|
|
1094
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR13_CLASS = 162,
|
|
1095
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR14_CLASS = 163,
|
|
1096
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR15_CLASS = 164,
|
|
1097
|
+
GLOBAL_TYPE_ID_ETS_LAMBDAR16_CLASS = 165,
|
|
1098
|
+
GLOBAL_TYPE_ID_ETS_TUPLE0_CLASS = 166,
|
|
1099
|
+
GLOBAL_TYPE_ID_ETS_TUPLE1_CLASS = 167,
|
|
1100
|
+
GLOBAL_TYPE_ID_ETS_TUPLE2_CLASS = 168,
|
|
1101
|
+
GLOBAL_TYPE_ID_ETS_TUPLE3_CLASS = 169,
|
|
1102
|
+
GLOBAL_TYPE_ID_ETS_TUPLE4_CLASS = 170,
|
|
1103
|
+
GLOBAL_TYPE_ID_ETS_TUPLE5_CLASS = 171,
|
|
1104
|
+
GLOBAL_TYPE_ID_ETS_TUPLE6_CLASS = 172,
|
|
1105
|
+
GLOBAL_TYPE_ID_ETS_TUPLE7_CLASS = 173,
|
|
1106
|
+
GLOBAL_TYPE_ID_ETS_TUPLE8_CLASS = 174,
|
|
1107
|
+
GLOBAL_TYPE_ID_ETS_TUPLE9_CLASS = 175,
|
|
1108
|
+
GLOBAL_TYPE_ID_ETS_TUPLE10_CLASS = 176,
|
|
1109
|
+
GLOBAL_TYPE_ID_ETS_TUPLE11_CLASS = 177,
|
|
1110
|
+
GLOBAL_TYPE_ID_ETS_TUPLE12_CLASS = 178,
|
|
1111
|
+
GLOBAL_TYPE_ID_ETS_TUPLE13_CLASS = 179,
|
|
1112
|
+
GLOBAL_TYPE_ID_ETS_TUPLE14_CLASS = 180,
|
|
1113
|
+
GLOBAL_TYPE_ID_ETS_TUPLE15_CLASS = 181,
|
|
1114
|
+
GLOBAL_TYPE_ID_ETS_TUPLE16_CLASS = 182,
|
|
1115
|
+
GLOBAL_TYPE_ID_ETS_TUPLEN_CLASS = 183,
|
|
1116
|
+
GLOBAL_TYPE_ID_TYPE_ERROR = 184,
|
|
1117
|
+
GLOBAL_TYPE_ID_COUNT = 185
|
|
1117
1118
|
}
|
|
1118
1119
|
export enum Es2pandaMethodDefinitionKind {
|
|
1119
1120
|
METHOD_DEFINITION_KIND_NONE = 0,
|
|
@@ -1302,7 +1303,8 @@ export enum Es2pandaTypeAnnotationParsingOptions {
|
|
|
1302
1303
|
TYPE_ANNOTATION_PARSING_OPTIONS_DISALLOW_UNION = 32768,
|
|
1303
1304
|
TYPE_ANNOTATION_PARSING_OPTIONS_POTENTIAL_NEW_ARRAY = 65536,
|
|
1304
1305
|
TYPE_ANNOTATION_PARSING_OPTIONS_ANNOTATION_NOT_ALLOW = 131072,
|
|
1305
|
-
TYPE_ANNOTATION_PARSING_OPTIONS_INSTANCEOF = 262144
|
|
1306
|
+
TYPE_ANNOTATION_PARSING_OPTIONS_INSTANCEOF = 262144,
|
|
1307
|
+
TYPE_ANNOTATION_PARSING_OPTIONS_TYPE_ALIAS_CONTEXT = 524288
|
|
1306
1308
|
}
|
|
1307
1309
|
export enum Es2pandaScriptKind {
|
|
1308
1310
|
SCRIPT_KIND_SCRIPT = 0,
|
|
@@ -1343,6 +1343,15 @@ export class Es2pandaNativeModule {
|
|
|
1343
1343
|
_ScriptFunctionFormalParamsLengthConst(context: KNativePointer, receiver: KNativePointer): KUInt {
|
|
1344
1344
|
throw new Error("This methods was not overloaded by native module initialization")
|
|
1345
1345
|
}
|
|
1346
|
+
_ScriptFunctionSetAsyncPairMethod(context: KNativePointer, receiver: KNativePointer, asyncPairFunction: KNativePointer): void {
|
|
1347
|
+
throw new Error("This methods was not overloaded by native module initialization")
|
|
1348
|
+
}
|
|
1349
|
+
_ScriptFunctionAsyncPairMethodConst(context: KNativePointer, receiver: KNativePointer): KNativePointer {
|
|
1350
|
+
throw new Error("This methods was not overloaded by native module initialization")
|
|
1351
|
+
}
|
|
1352
|
+
_ScriptFunctionAsyncPairMethod(context: KNativePointer, receiver: KNativePointer): KNativePointer {
|
|
1353
|
+
throw new Error("This methods was not overloaded by native module initialization")
|
|
1354
|
+
}
|
|
1346
1355
|
_ScriptFunctionEmplaceReturnStatements(context: KNativePointer, receiver: KNativePointer, returnStatements: KNativePointer): void {
|
|
1347
1356
|
throw new Error("This methods was not overloaded by native module initialization")
|
|
1348
1357
|
}
|
|
@@ -1052,11 +1052,11 @@ export const factory = {
|
|
|
1052
1052
|
return updateNodeByNode(TSAnyKeyword.createTSAnyKeyword(), original)
|
|
1053
1053
|
}
|
|
1054
1054
|
,
|
|
1055
|
-
createClassDeclaration(definition
|
|
1055
|
+
createClassDeclaration(definition: ClassDefinition, modifierFlags?: Es2pandaModifierFlags): ClassDeclaration {
|
|
1056
1056
|
return ClassDeclaration.createClassDeclaration(definition, modifierFlags)
|
|
1057
1057
|
}
|
|
1058
1058
|
,
|
|
1059
|
-
updateClassDeclaration(original: ClassDeclaration, definition
|
|
1059
|
+
updateClassDeclaration(original: ClassDeclaration, definition: ClassDefinition, modifierFlags?: Es2pandaModifierFlags): ClassDeclaration {
|
|
1060
1060
|
if (isSameNativeObject(definition, original.definition) && isSameNativeObject(modifierFlags, original.modifierFlags))
|
|
1061
1061
|
return original
|
|
1062
1062
|
return updateNodeByNode(ClassDeclaration.createClassDeclaration(definition, modifierFlags), original)
|
|
@@ -61,8 +61,8 @@ export class ClassDeclaration extends Statement {
|
|
|
61
61
|
result.setChildrenParentPtr()
|
|
62
62
|
return result
|
|
63
63
|
}
|
|
64
|
-
get definition(): ClassDefinition
|
|
65
|
-
return
|
|
64
|
+
get definition(): ClassDefinition {
|
|
65
|
+
return unpackNonNullableNode(global.generatedEs2panda._ClassDeclarationDefinition(global.context, this.peer))
|
|
66
66
|
}
|
|
67
67
|
/** @deprecated */
|
|
68
68
|
emplaceDecorators(decorators?: Decorator): this {
|
|
@@ -38,6 +38,7 @@ import { Es2pandaModuleKind } from "./../Es2pandaEnums"
|
|
|
38
38
|
import { Es2pandaProgramFlags } from "./../Es2pandaEnums"
|
|
39
39
|
import { Es2pandaScriptKind } from "./../Es2pandaEnums"
|
|
40
40
|
import { SourcePosition } from "./SourcePosition"
|
|
41
|
+
import { extension_ProgramGetExternalSources } from "./../../reexport-for-generated"
|
|
41
42
|
|
|
42
43
|
export class Program extends ArktsObject {
|
|
43
44
|
constructor(pointer: KNativePointer) {
|
|
@@ -190,6 +191,7 @@ export class Program extends ArktsObject {
|
|
|
190
191
|
global.generatedEs2panda._ProgramAddFileDependencies(global.context, this.peer, file, depFile)
|
|
191
192
|
return this
|
|
192
193
|
}
|
|
194
|
+
getExternalSources = extension_ProgramGetExternalSources
|
|
193
195
|
protected readonly brandProgram: undefined
|
|
194
196
|
}
|
|
195
197
|
export function isProgram(node: object | undefined): node is Program {
|
|
@@ -42,7 +42,9 @@ import { ReturnStatement } from "./ReturnStatement"
|
|
|
42
42
|
import { TSTypeParameterDeclaration } from "./TSTypeParameterDeclaration"
|
|
43
43
|
import { TypeNode } from "./TypeNode"
|
|
44
44
|
import { extension_ScriptFunctionGetPreferredReturnTypePointer } from "./../../reexport-for-generated"
|
|
45
|
+
import { extension_ScriptFunctionGetSignaturePointer } from "./../../reexport-for-generated"
|
|
45
46
|
import { extension_ScriptFunctionSetPreferredReturnTypePointer } from "./../../reexport-for-generated"
|
|
47
|
+
import { extension_ScriptFunctionSetSignaturePointer } from "./../../reexport-for-generated"
|
|
46
48
|
|
|
47
49
|
export class ScriptFunction extends AstNode {
|
|
48
50
|
constructor(pointer: KNativePointer) {
|
|
@@ -214,6 +216,14 @@ export class ScriptFunction extends AstNode {
|
|
|
214
216
|
return global.generatedEs2panda._ScriptFunctionFormalParamsLengthConst(global.context, this.peer)
|
|
215
217
|
}
|
|
216
218
|
/** @deprecated */
|
|
219
|
+
setAsyncPairMethod(asyncPairFunction?: ScriptFunction): this {
|
|
220
|
+
global.generatedEs2panda._ScriptFunctionSetAsyncPairMethod(global.context, this.peer, passNode(asyncPairFunction))
|
|
221
|
+
return this
|
|
222
|
+
}
|
|
223
|
+
get asyncPairMethod(): ScriptFunction | undefined {
|
|
224
|
+
return unpackNode(global.generatedEs2panda._ScriptFunctionAsyncPairMethod(global.context, this.peer))
|
|
225
|
+
}
|
|
226
|
+
/** @deprecated */
|
|
217
227
|
emplaceReturnStatements(returnStatements?: ReturnStatement): this {
|
|
218
228
|
global.generatedEs2panda._ScriptFunctionEmplaceReturnStatements(global.context, this.peer, passNode(returnStatements))
|
|
219
229
|
return this
|
|
@@ -282,6 +292,8 @@ export class ScriptFunction extends AstNode {
|
|
|
282
292
|
global.generatedEs2panda._ScriptFunctionAddAnnotations(global.context, this.peer, passNode(annotations))
|
|
283
293
|
return this
|
|
284
294
|
}
|
|
295
|
+
getSignaturePointer = extension_ScriptFunctionGetSignaturePointer
|
|
296
|
+
setSignaturePointer = extension_ScriptFunctionSetSignaturePointer
|
|
285
297
|
getPreferredReturnTypePointer = extension_ScriptFunctionGetPreferredReturnTypePointer
|
|
286
298
|
setPreferredReturnTypePointer = extension_ScriptFunctionSetPreferredReturnTypePointer
|
|
287
299
|
protected readonly brandScriptFunction: undefined
|
|
@@ -53,10 +53,10 @@ export class DumpingHooks implements RunTransformerHooks {
|
|
|
53
53
|
console.log(`BEFORE ${this.pluginName}:`)
|
|
54
54
|
dumpProgramSrcFormatted(program, true)
|
|
55
55
|
}
|
|
56
|
-
if (!options.
|
|
56
|
+
if (!options.isProgramForCodegeneration) arktsGlobal.profiler.transformDepStarted()
|
|
57
57
|
}
|
|
58
58
|
onProgramTransformEnd(options: CompilationOptions, program: Program) {
|
|
59
|
-
if (!options.
|
|
59
|
+
if (!options.isProgramForCodegeneration) arktsGlobal.profiler.transformDepEnded(this.state, this.pluginName)
|
|
60
60
|
if (this.dumpAst) {
|
|
61
61
|
console.log(`AFTER ${this.pluginName}:`)
|
|
62
62
|
dumpProgramSrcFormatted(program, true)
|
|
@@ -96,7 +96,7 @@ export function runTransformer(prog: Program, state: Es2pandaContextState, trans
|
|
|
96
96
|
while (currentProgram) {
|
|
97
97
|
// Options passed to plugin and hooks
|
|
98
98
|
const options: CompilationOptions = {
|
|
99
|
-
isMainProgram,
|
|
99
|
+
isProgramForCodegeneration: isProgramForCodegeneration(currentProgram, isMainProgram),
|
|
100
100
|
state,
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -115,3 +115,13 @@ function stateSpecificPostFilters(program: Program, state: Es2pandaContextState)
|
|
|
115
115
|
program.setAst(new ChainExpressionFilter().visitor(program.ast))
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
|
|
119
|
+
function isProgramForCodegeneration(
|
|
120
|
+
program: Program,
|
|
121
|
+
isMainProgram: boolean,
|
|
122
|
+
): boolean {
|
|
123
|
+
if (!arktsGlobal.isContextGenerateAbcForExternalSourceFiles) {
|
|
124
|
+
return isMainProgram
|
|
125
|
+
}
|
|
126
|
+
return program.isGenAbcForExternal
|
|
127
|
+
}
|
|
@@ -35,6 +35,9 @@ export {
|
|
|
35
35
|
extension_ETSModuleGetNamespaceFlag,
|
|
36
36
|
extension_MethodDefinitionOnUpdate,
|
|
37
37
|
extension_MethodDefinitionSetChildrenParentPtr,
|
|
38
|
+
extension_ScriptFunctionGetSignaturePointer,
|
|
39
|
+
extension_ScriptFunctionSetSignaturePointer,
|
|
38
40
|
extension_ScriptFunctionGetPreferredReturnTypePointer,
|
|
39
41
|
extension_ScriptFunctionSetPreferredReturnTypePointer,
|
|
42
|
+
extension_ProgramGetExternalSources,
|
|
40
43
|
} from "./arkts-api/utilities/extensions"
|
|
@@ -84,4 +84,5 @@ export * from "./peers/DiagnosticInfo"
|
|
|
84
84
|
export * from "./peers/DiagnosticKind"
|
|
85
85
|
export * from "./peers/SuggestionInfo"
|
|
86
86
|
export * from "./to-be-generated/MemberExpression"
|
|
87
|
-
export { global as arktsGlobal } from "
|
|
87
|
+
export { global as arktsGlobal } from "../../arkts-api/static/global"
|
|
88
|
+
export * from "../../arkts-api/static/globalUtils"
|
|
@@ -31,9 +31,8 @@ export class Diagnostic extends ArktsObject {
|
|
|
31
31
|
global.es2panda._LogDiagnostic(global.context, kind.peer, passStringArray(args), args.length, pos.peer);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static logDiagnosticWithSuggestion(diagnosticInfo: DiagnosticInfo, suggestionInfo: SuggestionInfo
|
|
35
|
-
|
|
36
|
-
global.es2panda._LogDiagnosticWithSuggestion(global.context, diagnosticInfo.peer, suggestionInfo.peer, range.peer);
|
|
34
|
+
static logDiagnosticWithSuggestion(diagnosticInfo: DiagnosticInfo, suggestionInfo: SuggestionInfo): void {
|
|
35
|
+
global.es2panda._LogDiagnosticWithSuggestion(global.context, diagnosticInfo.peer, suggestionInfo.peer);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
}
|
|
@@ -17,6 +17,7 @@ import { ArktsObject } from '../../../arkts-api/peers/ArktsObject';
|
|
|
17
17
|
import { global } from '../static/global';
|
|
18
18
|
import { KNativePointer } from '@koalaui/interop';
|
|
19
19
|
import { DiagnosticKind } from './DiagnosticKind';
|
|
20
|
+
import { SourcePosition } from "./SourcePosition";
|
|
20
21
|
import { passStringArray } from '../utilities/private';
|
|
21
22
|
|
|
22
23
|
export class DiagnosticInfo extends ArktsObject {
|
|
@@ -24,9 +25,9 @@ export class DiagnosticInfo extends ArktsObject {
|
|
|
24
25
|
super(peer);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
static create(kind: DiagnosticKind, ...args: string[]): DiagnosticInfo {
|
|
28
|
+
static create(kind: DiagnosticKind, pos: SourcePosition, ...args: string[]): DiagnosticInfo {
|
|
28
29
|
return new DiagnosticInfo(
|
|
29
|
-
global.es2panda._CreateDiagnosticInfo(global.context, kind.peer, passStringArray(args), args.length)
|
|
30
|
+
global.es2panda._CreateDiagnosticInfo(global.context, kind.peer, passStringArray(args), args.length, pos.peer)
|
|
30
31
|
);
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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
|
+
import { ArktsObject } from "../../../arkts-api/peers/ArktsObject"
|
|
17
|
+
import { global } from "../static/global"
|
|
18
|
+
import { KNativePointer } from "@koalaui/interop"
|
|
19
|
+
|
|
20
|
+
export class SourcePosition extends ArktsObject {
|
|
21
|
+
constructor(peer: KNativePointer) {
|
|
22
|
+
super(peer)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static create(index: number, line: number): SourcePosition {
|
|
26
|
+
return new SourcePosition(
|
|
27
|
+
global.es2panda._CreateSourcePosition(global.context, index, line)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
index(): number {
|
|
32
|
+
return global.es2panda._SourcePositionIndex(global.context, this.peer);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
line(): number {
|
|
36
|
+
return global.es2panda._SourcePositionLine(global.context, this.peer);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -18,15 +18,16 @@ import { global } from '../static/global';
|
|
|
18
18
|
import { KNativePointer } from '@koalaui/interop';
|
|
19
19
|
import { DiagnosticKind } from './DiagnosticKind';
|
|
20
20
|
import { passStringArray } from '../utilities/private';
|
|
21
|
+
import { SourceRange } from './SourceRange';
|
|
21
22
|
|
|
22
23
|
export class SuggestionInfo extends ArktsObject {
|
|
23
24
|
constructor(peer: KNativePointer) {
|
|
24
25
|
super(peer);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
static create(kind: DiagnosticKind, substitutionCode: string, ...args: string[]): SuggestionInfo {
|
|
28
|
+
static create(kind: DiagnosticKind, substitutionCode: string, range: SourceRange, ...args: string[]): SuggestionInfo {
|
|
28
29
|
return new SuggestionInfo(
|
|
29
|
-
global.es2panda._CreateSuggestionInfo(global.context, kind.peer, passStringArray(args), args.length, substitutionCode)
|
|
30
|
+
global.es2panda._CreateSuggestionInfo(global.context, kind.peer, passStringArray(args), args.length, substitutionCode, range.peer)
|
|
30
31
|
);
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
ArrayExpression,
|
|
46
46
|
BlockStatement,
|
|
47
47
|
ClassDefinition,
|
|
48
|
+
ETSModule,
|
|
48
49
|
ETSTypeReference,
|
|
49
50
|
ETSTypeReferencePart,
|
|
50
51
|
Expression,
|
|
@@ -57,12 +58,7 @@ import {
|
|
|
57
58
|
TypeNode,
|
|
58
59
|
} from '../../generated';
|
|
59
60
|
|
|
60
|
-
export class EtsScript extends
|
|
61
|
-
constructor(peer: KPtr) {
|
|
62
|
-
assertValidPeer(peer, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_MODULE);
|
|
63
|
-
super(peer);
|
|
64
|
-
}
|
|
65
|
-
|
|
61
|
+
export class EtsScript extends ETSModule {
|
|
66
62
|
static fromContext(): EtsScript {
|
|
67
63
|
console.log('[TS WRAPPER] GET AST FROM CONTEXT');
|
|
68
64
|
return new EtsScript(
|
|
@@ -99,19 +95,6 @@ export class EtsScript extends AstNode {
|
|
|
99
95
|
);
|
|
100
96
|
return node;
|
|
101
97
|
}
|
|
102
|
-
|
|
103
|
-
get statements(): readonly AstNode[] {
|
|
104
|
-
return unpackNodeArray(global.generatedEs2panda._BlockStatementStatements(global.context, this.peer));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
set statements(nodes: readonly AstNode[]) {
|
|
108
|
-
global.generatedEs2panda._BlockStatementSetStatements(
|
|
109
|
-
global.context,
|
|
110
|
-
this.peer,
|
|
111
|
-
passNodeArray(nodes),
|
|
112
|
-
nodes.length
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
98
|
}
|
|
116
99
|
|
|
117
100
|
export class ExpressionStatement extends AstNode {
|
|
@@ -256,14 +256,16 @@ export function generateTsDeclarationsFromContext(
|
|
|
256
256
|
outputDeclEts: string,
|
|
257
257
|
outputEts: string,
|
|
258
258
|
exportAll: boolean,
|
|
259
|
-
isolated: boolean
|
|
259
|
+
isolated: boolean,
|
|
260
|
+
recordFile: string
|
|
260
261
|
): KInt {
|
|
261
262
|
return global.es2panda._GenerateTsDeclarationsFromContext(
|
|
262
263
|
global.context,
|
|
263
264
|
passString(outputDeclEts),
|
|
264
265
|
passString(outputEts),
|
|
265
266
|
exportAll,
|
|
266
|
-
isolated
|
|
267
|
+
isolated,
|
|
268
|
+
recordFile
|
|
267
269
|
);
|
|
268
270
|
}
|
|
269
271
|
|