arkanalyzer 1.0.93 → 1.0.95
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/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +1 -2
- package/lib/core/base/Expr.d.ts +9 -0
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +10 -0
- package/lib/core/base/Stmt.d.ts +8 -0
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +25 -2
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +10 -9
- package/lib/core/common/ArkValueTransformer.d.ts +2 -0
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +40 -7
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +22 -6
- package/lib/core/common/StmtUseReplacer.d.ts +1 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -1
- package/lib/core/common/StmtUseReplacer.js +9 -0
- package/lib/core/common/StringUtils.d.ts +10 -1
- package/lib/core/common/StringUtils.d.ts.map +1 -1
- package/lib/core/common/StringUtils.js +29 -16
- package/lib/core/graph/builder/CfgBuilder.d.ts +1 -0
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +16 -7
- package/lib/core/graph/builder/TrapBuilder.d.ts +27 -0
- package/lib/core/graph/builder/TrapBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/TrapBuilder.js +417 -62
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +1 -2
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +1 -2
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +1 -2
- package/lib/core/model/ArkFile.d.ts +12 -0
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +20 -0
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +1 -2
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +2 -3
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +2 -3
- package/lib/core/model/builder/ArkClassBuilder.js +3 -2
- package/package.json +1 -1
- package/lib/node_modules/ohos-typescript/README.OpenSource +0 -11
- package/lib/node_modules/ohos-typescript/README.md +0 -81
- package/lib/node_modules/ohos-typescript/SECURITY.md +0 -41
- package/lib/node_modules/ohos-typescript/ThirdPartyNoticeText.txt +0 -193
- package/lib/node_modules/ohos-typescript/bin/tsc +0 -2
- package/lib/node_modules/ohos-typescript/bin/tsserver +0 -2
- package/lib/node_modules/ohos-typescript/lib/README.md +0 -5
- package/lib/node_modules/ohos-typescript/lib/cancellationToken.js +0 -86
- package/lib/node_modules/ohos-typescript/lib/cs/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/de/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/es/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/fr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/it/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ja/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ko/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/lib.dom.d.ts +0 -18505
- package/lib/node_modules/ohos-typescript/lib/lib.dom.iterable.d.ts +0 -341
- package/lib/node_modules/ohos-typescript/lib/lib.scripthost.d.ts +0 -327
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.d.ts +0 -6192
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.importscripts.d.ts +0 -26
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.iterable.d.ts +0 -175
- package/lib/node_modules/ohos-typescript/lib/pl/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/pt-br/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ru/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tsc.js +0 -114551
- package/lib/node_modules/ohos-typescript/lib/tsserver.js +0 -179691
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.d.ts +0 -13648
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.js +0 -178688
- package/lib/node_modules/ohos-typescript/lib/typesMap.json +0 -497
- package/lib/node_modules/ohos-typescript/lib/typingsInstaller.js +0 -39871
- package/lib/node_modules/ohos-typescript/lib/watchGuard.js +0 -49
- package/lib/node_modules/ohos-typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -1880
|
@@ -41,8 +41,11 @@ exports.TrapBuilder = void 0;
|
|
|
41
41
|
const BasicBlock_1 = require("../BasicBlock");
|
|
42
42
|
const Trap_1 = require("../../base/Trap");
|
|
43
43
|
const Ref_1 = require("../../base/Ref");
|
|
44
|
+
const Local_1 = require("../../base/Local");
|
|
44
45
|
const Type_1 = require("../../base/Type");
|
|
45
46
|
const Position_1 = require("../../base/Position");
|
|
47
|
+
const Const_1 = require("../../common/Const");
|
|
48
|
+
const ValueUtil_1 = require("../../common/ValueUtil");
|
|
46
49
|
const Stmt_1 = require("../../base/Stmt");
|
|
47
50
|
const CfgBuilder_1 = require("./CfgBuilder");
|
|
48
51
|
const logger_1 = __importStar(require("../../../utils/logger"));
|
|
@@ -52,6 +55,7 @@ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER,
|
|
|
52
55
|
*/
|
|
53
56
|
class TrapBuilder {
|
|
54
57
|
constructor(blockBuildersBeforeTry, blockBuilderToCfgBlock, arkIRTransformer, basicBlockSet) {
|
|
58
|
+
this.pendingFinallyPrunes = [];
|
|
55
59
|
this.blockBuildersBeforeTry = blockBuildersBeforeTry;
|
|
56
60
|
this.processedBlockBuildersBeforeTry = new Set();
|
|
57
61
|
this.arkIRTransformer = arkIRTransformer;
|
|
@@ -64,8 +68,43 @@ class TrapBuilder {
|
|
|
64
68
|
for (const blockBuilderBeforeTry of blockBuildersBeforeTry) {
|
|
65
69
|
traps.push(...this.buildTrapGroup(blockBuilderBeforeTry).traps);
|
|
66
70
|
}
|
|
71
|
+
for (const finallyBlocks of this.pendingFinallyPrunes) {
|
|
72
|
+
this.pruneOriginalFinallyIfUnreachable(finallyBlocks);
|
|
73
|
+
}
|
|
74
|
+
this.pendingFinallyPrunes = [];
|
|
67
75
|
return traps;
|
|
68
76
|
}
|
|
77
|
+
retainLiveTraps(traps) {
|
|
78
|
+
const liveTraps = [];
|
|
79
|
+
for (const trap of traps) {
|
|
80
|
+
const originalTryBlocks = trap.getTryBlocks();
|
|
81
|
+
const tryBlocks = [];
|
|
82
|
+
for (const block of originalTryBlocks) {
|
|
83
|
+
if (this.basicBlockSet.has(block)) {
|
|
84
|
+
tryBlocks.push(block);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (tryBlocks.length === 0) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const originalCatchBlocks = trap.getCatchBlocks();
|
|
91
|
+
const catchBlocks = [];
|
|
92
|
+
for (const block of originalCatchBlocks) {
|
|
93
|
+
if (this.basicBlockSet.has(block)) {
|
|
94
|
+
catchBlocks.push(block);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (catchBlocks.length === 0) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (tryBlocks.length === originalTryBlocks.length && catchBlocks.length === originalCatchBlocks.length) {
|
|
101
|
+
liveTraps.push(trap);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
liveTraps.push(new Trap_1.Trap(tryBlocks, catchBlocks));
|
|
105
|
+
}
|
|
106
|
+
return liveTraps;
|
|
107
|
+
}
|
|
69
108
|
buildTrapGroup(blockBuilderBeforeTry) {
|
|
70
109
|
if (this.shouldSkipProcessing(blockBuilderBeforeTry)) {
|
|
71
110
|
return { traps: [], headBlockBuilder: null };
|
|
@@ -86,7 +125,7 @@ class TrapBuilder {
|
|
|
86
125
|
const tryResult = this.processTryBlock(headBlockBuilderWithinTry, finallyBlockBuilder);
|
|
87
126
|
traps.push(...tryResult.traps);
|
|
88
127
|
const updatedHeadBlock = tryResult.newStartBlockBuilder;
|
|
89
|
-
const catchResult = this.processCatchBlock(tryStmtBuilder);
|
|
128
|
+
const catchResult = this.processCatchBlock(tryStmtBuilder, finallyBlockBuilder);
|
|
90
129
|
traps.push(...catchResult.traps);
|
|
91
130
|
const blockBuilderAfterFinally = this.getAfterFinallyBlock(tryStmtBuilder);
|
|
92
131
|
const singleTraps = this.buildSingleTraps(tryResult.bfsBlocks, tryResult.tailBlocks, catchResult.bfsBlocks, catchResult.tailBlocks, finallyBlockBuilder, blockBuilderAfterFinally);
|
|
@@ -141,14 +180,14 @@ class TrapBuilder {
|
|
|
141
180
|
tailBlocks
|
|
142
181
|
};
|
|
143
182
|
}
|
|
144
|
-
processCatchBlock(tryStmtBuilder) {
|
|
183
|
+
processCatchBlock(tryStmtBuilder, finallyBlockBuilder) {
|
|
145
184
|
var _a;
|
|
146
185
|
const catchBlockBuilder = (_a = tryStmtBuilder.catchStatement) === null || _a === void 0 ? void 0 : _a.block;
|
|
147
186
|
if (!catchBlockBuilder) {
|
|
148
187
|
return { traps: [], bfsBlocks: [], tailBlocks: [] };
|
|
149
188
|
}
|
|
150
|
-
const result = this.buildTrapsRecursively(catchBlockBuilder);
|
|
151
|
-
const { bfsBlocks, tailBlocks } = this.getAllBlocksBFS(result.newStartBlockBuilder);
|
|
189
|
+
const result = this.buildTrapsRecursively(catchBlockBuilder, finallyBlockBuilder);
|
|
190
|
+
const { bfsBlocks, tailBlocks } = this.getAllBlocksBFS(result.newStartBlockBuilder, finallyBlockBuilder);
|
|
152
191
|
return {
|
|
153
192
|
traps: result.traps,
|
|
154
193
|
bfsBlocks,
|
|
@@ -222,24 +261,54 @@ class TrapBuilder {
|
|
|
222
261
|
return [];
|
|
223
262
|
}
|
|
224
263
|
const dummyFinallyBlock = this.blockBuilderToCfgBlock.get(dummyFinallyBlockBuilder);
|
|
264
|
+
const fallThroughSources = [...dummyFinallyBlock.getPredecessors()];
|
|
225
265
|
CfgBuilder_1.CfgBuilder.pruneBasicBlock(dummyFinallyBlock);
|
|
226
266
|
this.basicBlockSet.delete(dummyFinallyBlock);
|
|
227
267
|
const blockBuilderAfterFinally = dummyFinallyBlockBuilder.nexts[0];
|
|
228
|
-
|
|
268
|
+
const mappedAfterFinally = blockBuilderAfterFinally ? this.blockBuilderToCfgBlock.get(blockBuilderAfterFinally) : undefined;
|
|
269
|
+
const blockAfterFinally = mappedAfterFinally !== null && mappedAfterFinally !== void 0 ? mappedAfterFinally : this.findUniqueCatchTailTarget(catchTailBlocks);
|
|
229
270
|
if (!this.blockBuilderToCfgBlock.has(dummyFinallyBlockBuilder)) {
|
|
230
271
|
logger.error(`can't find basicBlock corresponding to the blockBuilder.`);
|
|
231
272
|
return [];
|
|
232
273
|
}
|
|
233
274
|
if (blockAfterFinally) {
|
|
275
|
+
for (const source of fallThroughSources) {
|
|
276
|
+
if (!this.basicBlockSet.has(source) || source.getSuccessors().length !== 0 || this.isReturnTerminator(source) || this.endsWithThrow(source)) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
CfgBuilder_1.CfgBuilder.linkBasicBlock(source, blockAfterFinally);
|
|
280
|
+
}
|
|
234
281
|
for (const catchTailBlock of catchTailBlocks) {
|
|
235
|
-
|
|
282
|
+
if (!this.endsWithThrow(catchTailBlock) && !catchTailBlock.getSuccessors().includes(blockAfterFinally)) {
|
|
283
|
+
CfgBuilder_1.CfgBuilder.linkBasicBlock(catchTailBlock, blockAfterFinally);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for (const catchBlock of catchBfsBlocks) {
|
|
287
|
+
if (!this.basicBlockSet.has(catchBlock) || catchBlock.getSuccessors().length !== 0 ||
|
|
288
|
+
this.isReturnTerminator(catchBlock) || this.endsWithThrow(catchBlock)) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
CfgBuilder_1.CfgBuilder.linkBasicBlock(catchBlock, blockAfterFinally);
|
|
236
292
|
}
|
|
237
293
|
}
|
|
238
|
-
|
|
239
|
-
CfgBuilder_1.CfgBuilder.linkExceptionalBasicBlock(tryTailBlock, catchBfsBlocks[0]);
|
|
240
|
-
}
|
|
294
|
+
this.linkUnprotectedTails(tryTailBlocks, catchBfsBlocks[0]);
|
|
241
295
|
return [new Trap_1.Trap(tryBfsBlocks, catchBfsBlocks)];
|
|
242
296
|
}
|
|
297
|
+
findUniqueCatchTailTarget(catchTailBlocks) {
|
|
298
|
+
const targets = new Set();
|
|
299
|
+
for (const catchTailBlock of catchTailBlocks) {
|
|
300
|
+
if (this.isReturnTerminator(catchTailBlock) || this.endsWithThrow(catchTailBlock)) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
for (const successor of catchTailBlock.getSuccessors()) {
|
|
304
|
+
targets.add(successor);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (targets.size !== 1) {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
return [...targets][0];
|
|
311
|
+
}
|
|
243
312
|
buildTrapsIfFinallyExist(tryBfsBlocks, tryTailBlocks, catchBfsBlocks, catchTailBlocks, finallyBlockBuilder, blockBuilderAfterFinally) {
|
|
244
313
|
const traps = [];
|
|
245
314
|
const endBlock = blockBuilderAfterFinally !== null && blockBuilderAfterFinally !== void 0 ? blockBuilderAfterFinally : undefined;
|
|
@@ -250,35 +319,43 @@ class TrapBuilder {
|
|
|
250
319
|
const { bfsBlocks: finallyBfsBlocks, tailBlocks: finallyTailBlocks } = this.getAllBlocksBFS(finallyBlockBuilder, endBlock);
|
|
251
320
|
if (finallyBfsBlocks.length === 0) {
|
|
252
321
|
if (catchBfsBlocks.length !== 0) {
|
|
253
|
-
|
|
254
|
-
CfgBuilder_1.CfgBuilder.linkExceptionalBasicBlock(tryTailBlock, catchBfsBlocks[0]);
|
|
255
|
-
}
|
|
322
|
+
this.linkUnprotectedTails(tryTailBlocks, catchBfsBlocks[0]);
|
|
256
323
|
traps.push(new Trap_1.Trap(tryBfsBlocks, catchBfsBlocks));
|
|
257
324
|
}
|
|
258
325
|
return traps;
|
|
259
326
|
}
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
327
|
+
const finallyEnd = endBlock ? this.blockBuilderToCfgBlock.get(endBlock) : undefined;
|
|
328
|
+
const exceptionalFinally = this.copyFinallyBlocks(finallyBfsBlocks, finallyTailBlocks, finallyEnd);
|
|
329
|
+
traps.push(...this.connectExits(tryBfsBlocks, tryTailBlocks, catchBfsBlocks, catchTailBlocks, finallyBfsBlocks, finallyTailBlocks, finallyEnd, exceptionalFinally));
|
|
330
|
+
this.pendingFinallyPrunes.push(finallyBfsBlocks);
|
|
331
|
+
return traps;
|
|
332
|
+
}
|
|
333
|
+
connectExits(tryBfsBlocks, tryTailBlocks, catchBfsBlocks, catchTailBlocks, finallyBfsBlocks, finallyTailBlocks, finallyEnd, exceptionalFinally) {
|
|
334
|
+
this.unlinkTryThrowFallThrough(tryBfsBlocks);
|
|
335
|
+
const abortTails = this.spliceFinallyAfterAbort(tryTailBlocks, catchTailBlocks, finallyBfsBlocks, finallyTailBlocks, new Set([...tryBfsBlocks, ...catchBfsBlocks]), finallyEnd);
|
|
336
|
+
const tryBlocks = this.liveBlocks(tryBfsBlocks);
|
|
337
|
+
const tryTails = this.liveBlocks(tryTailBlocks);
|
|
338
|
+
const catchBlocks = this.liveBlocks(catchBfsBlocks);
|
|
339
|
+
const catchTails = this.liveBlocks(catchTailBlocks);
|
|
340
|
+
const sharedFinally = finallyBfsBlocks[0];
|
|
341
|
+
const exceptionalHandler = exceptionalFinally[0];
|
|
342
|
+
const traps = [];
|
|
343
|
+
if (catchBlocks.length !== 0) {
|
|
344
|
+
const fallThroughCatchTails = [];
|
|
345
|
+
for (const tail of catchTails) {
|
|
346
|
+
if (!abortTails.has(tail) && !this.endsWithThrow(tail)) {
|
|
347
|
+
fallThroughCatchTails.push(tail);
|
|
348
|
+
}
|
|
273
349
|
}
|
|
274
|
-
|
|
350
|
+
CfgBuilder_1.CfgBuilder.linkPredecessorsOfBasicBlock(sharedFinally, fallThroughCatchTails);
|
|
275
351
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
352
|
+
const tryHandler = catchBlocks.length !== 0 ? catchBlocks[0] : exceptionalHandler;
|
|
353
|
+
const tryHandlerBlocks = catchBlocks.length !== 0 ? catchBlocks : exceptionalFinally;
|
|
354
|
+
this.linkUnprotectedTails(tryTails, tryHandler);
|
|
355
|
+
traps.push(new Trap_1.Trap(tryBlocks, tryHandlerBlocks));
|
|
356
|
+
if (catchBlocks.length !== 0) {
|
|
357
|
+
this.linkUnprotectedTails(catchTails, exceptionalHandler);
|
|
358
|
+
traps.push(new Trap_1.Trap(catchBlocks, exceptionalFinally));
|
|
282
359
|
}
|
|
283
360
|
return traps;
|
|
284
361
|
}
|
|
@@ -290,6 +367,8 @@ class TrapBuilder {
|
|
|
290
367
|
return { bfsBlocks, tailBlocks };
|
|
291
368
|
}
|
|
292
369
|
const endBlock = endBlockBuilder ? this.blockBuilderToCfgBlock.get(endBlockBuilder) : undefined;
|
|
370
|
+
const region = endBlockBuilder ? this.collectRegionBasicBlocks(startBlockBuilder, endBlockBuilder) : undefined;
|
|
371
|
+
const sourceBlocks = new Set(this.blockBuilderToCfgBlock.values());
|
|
293
372
|
const queue = [];
|
|
294
373
|
const visitedBlocks = new Set();
|
|
295
374
|
queue.push(startBlock);
|
|
@@ -301,47 +380,316 @@ class TrapBuilder {
|
|
|
301
380
|
visitedBlocks.add(currBlock);
|
|
302
381
|
bfsBlocks.push(currBlock);
|
|
303
382
|
const successors = currBlock.getSuccessors();
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
383
|
+
const exceptionalSuccessors = currBlock.getExceptionalSuccessorBlocks();
|
|
384
|
+
if (successors.length === 0 && (!exceptionalSuccessors || exceptionalSuccessors.length === 0)) {
|
|
385
|
+
tailBlocks.push(currBlock);
|
|
386
|
+
}
|
|
387
|
+
for (const successor of successors) {
|
|
388
|
+
if (!this.successorLeavesTryRegion(successor, endBlock, region, sourceBlocks)) {
|
|
389
|
+
queue.push(successor);
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (!tailBlocks.includes(currBlock)) {
|
|
393
|
+
tailBlocks.push(currBlock);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (exceptionalSuccessors) {
|
|
397
|
+
for (const successor of exceptionalSuccessors) {
|
|
398
|
+
if (successor !== endBlock) {
|
|
311
399
|
queue.push(successor);
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
if (!tailBlocks.includes(currBlock)) {
|
|
403
|
+
tailBlocks.push(currBlock);
|
|
312
404
|
}
|
|
313
405
|
}
|
|
314
406
|
}
|
|
315
|
-
else {
|
|
316
|
-
tailBlocks.push(currBlock);
|
|
317
|
-
}
|
|
318
407
|
}
|
|
319
408
|
return { bfsBlocks, tailBlocks };
|
|
320
409
|
}
|
|
321
|
-
|
|
322
|
-
|
|
410
|
+
linkUnprotectedTails(tails, handler) {
|
|
411
|
+
var _a, _b;
|
|
412
|
+
for (const tail of tails) {
|
|
413
|
+
if (((_b = (_a = tail.getExceptionalSuccessorBlocks()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) !== 0) {
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
CfgBuilder_1.CfgBuilder.linkExceptionalBasicBlock(tail, handler);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
collectRegionBasicBlocks(startBlockBuilder, endBlockBuilder) {
|
|
420
|
+
const tentative = new Set();
|
|
421
|
+
const queue = [startBlockBuilder];
|
|
422
|
+
while (queue.length !== 0) {
|
|
423
|
+
const curr = queue.splice(0, 1)[0];
|
|
424
|
+
if (tentative.has(curr) || curr === endBlockBuilder) {
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
tentative.add(curr);
|
|
428
|
+
for (const child of curr.nexts) {
|
|
429
|
+
if (child !== endBlockBuilder) {
|
|
430
|
+
queue.push(child);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
const region = new Set();
|
|
435
|
+
for (const builder of tentative) {
|
|
436
|
+
if (builder !== startBlockBuilder && this.hasPredecessorOutside(builder.lasts, tentative)) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
const basicBlock = this.blockBuilderToCfgBlock.get(builder);
|
|
440
|
+
if (basicBlock) {
|
|
441
|
+
region.add(basicBlock);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return region;
|
|
445
|
+
}
|
|
446
|
+
successorLeavesTryRegion(successor, endBlock, region, sourceBlocks) {
|
|
447
|
+
if (successor === endBlock) {
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
if (!region || region.has(successor)) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
return sourceBlocks.has(successor);
|
|
454
|
+
}
|
|
455
|
+
liveBlocks(blocks) {
|
|
456
|
+
const live = [];
|
|
457
|
+
for (const block of blocks) {
|
|
458
|
+
if (this.basicBlockSet.has(block)) {
|
|
459
|
+
live.push(block);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return live;
|
|
463
|
+
}
|
|
464
|
+
hasPredecessorOutside(lasts, tentative) {
|
|
465
|
+
for (const predecessor of lasts) {
|
|
466
|
+
if (!tentative.has(predecessor)) {
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
unlinkTryThrowFallThrough(tryBlocks) {
|
|
473
|
+
for (const block of tryBlocks) {
|
|
474
|
+
if (!this.basicBlockSet.has(block) || !this.endsWithThrow(block) || block.getSuccessors().length === 0) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
CfgBuilder_1.CfgBuilder.unlinkSuccessorsOfBasicBlock(block);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
spliceFinallyAfterAbort(tryTailBlocks, catchTailBlocks, finallyBfsBlocks, finallyTailBlocks, tryCatchRegion, finallyEnd) {
|
|
481
|
+
const abortTails = new Set();
|
|
482
|
+
const finallyHead = finallyBfsBlocks[0];
|
|
483
|
+
for (const tail of [...tryTailBlocks, ...catchTailBlocks]) {
|
|
484
|
+
if (!this.isAbortTail(tail, finallyHead, tryCatchRegion)) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
abortTails.add(tail);
|
|
488
|
+
this.linkFinallyCopyAfter(tail, finallyBfsBlocks, finallyTailBlocks, finallyEnd);
|
|
489
|
+
}
|
|
490
|
+
return abortTails;
|
|
491
|
+
}
|
|
492
|
+
isAbortTail(block, finallyHead, tryCatchRegion) {
|
|
493
|
+
const successors = block.getSuccessors();
|
|
494
|
+
if (successors.includes(finallyHead)) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
if (successors.length === 0) {
|
|
498
|
+
return this.isReturnTerminator(block);
|
|
499
|
+
}
|
|
500
|
+
for (const successor of successors) {
|
|
501
|
+
if (tryCatchRegion.has(successor)) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return true;
|
|
506
|
+
}
|
|
507
|
+
isReturnTerminator(block) {
|
|
508
|
+
const stmts = block.getStmts();
|
|
509
|
+
if (stmts.length === 0) {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
const last = stmts[stmts.length - 1];
|
|
513
|
+
return last instanceof Stmt_1.ArkReturnStmt || last instanceof Stmt_1.ArkReturnVoidStmt;
|
|
514
|
+
}
|
|
515
|
+
endsWithThrow(block) {
|
|
516
|
+
const stmts = block.getStmts();
|
|
517
|
+
return stmts.length > 0 && stmts[stmts.length - 1] instanceof Stmt_1.ArkThrowStmt;
|
|
518
|
+
}
|
|
519
|
+
linkFinallyCopyAfter(abortTail, finallyBfsBlocks, finallyTailBlocks, finallyEnd) {
|
|
520
|
+
const originalSuccessors = [...abortTail.getSuccessors()];
|
|
521
|
+
CfgBuilder_1.CfgBuilder.unlinkSuccessorsOfBasicBlock(abortTail);
|
|
522
|
+
const { blocks: copiedBlocks, tails: copiedTails } = this.duplicateFinally(finallyBfsBlocks, finallyTailBlocks, finallyEnd);
|
|
523
|
+
const sourceReturn = this.takeReturnStmt(abortTail);
|
|
524
|
+
const slot = sourceReturn ? this.returnValueSlot(abortTail, sourceReturn) : undefined;
|
|
525
|
+
this.attachFinallyCopy(abortTail, copiedBlocks[0]);
|
|
526
|
+
if (sourceReturn && slot) {
|
|
527
|
+
this.placeReturnAfterFinally(copiedTails, copiedBlocks, slot, sourceReturn);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
this.linkFallThrough(this.fallThroughCopies(copiedTails, copiedBlocks), originalSuccessors);
|
|
531
|
+
}
|
|
532
|
+
attachFinallyCopy(abortTail, copyHead) {
|
|
533
|
+
if (abortTail.getStmts().length !== 0) {
|
|
534
|
+
CfgBuilder_1.CfgBuilder.linkBasicBlock(abortTail, copyHead);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
CfgBuilder_1.CfgBuilder.replaceBasicBlockInPredecessors(abortTail, copyHead);
|
|
538
|
+
this.retargetBlock(abortTail, copyHead);
|
|
539
|
+
this.basicBlockSet.delete(abortTail);
|
|
540
|
+
}
|
|
541
|
+
retargetBlock(from, to) {
|
|
542
|
+
for (const [builder, block] of this.blockBuilderToCfgBlock) {
|
|
543
|
+
if (block === from) {
|
|
544
|
+
this.blockBuilderToCfgBlock.set(builder, to);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
takeReturnStmt(block) {
|
|
549
|
+
if (!this.isReturnTerminator(block)) {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
const last = block.getTail();
|
|
553
|
+
block.removeTail();
|
|
554
|
+
return last;
|
|
555
|
+
}
|
|
556
|
+
returnValueSlot(block, sourceReturn) {
|
|
557
|
+
if (sourceReturn instanceof Stmt_1.ArkReturnStmt) {
|
|
558
|
+
const operand = sourceReturn.getOp();
|
|
559
|
+
if (operand instanceof Local_1.Local && operand.getName().startsWith(Const_1.TEMP_LOCAL_PREFIX)) {
|
|
560
|
+
return operand;
|
|
561
|
+
}
|
|
562
|
+
return this.assignReturnSlot(block, operand, sourceReturn);
|
|
563
|
+
}
|
|
564
|
+
return this.assignReturnSlot(block, ValueUtil_1.ValueUtil.getUndefinedConst(), sourceReturn);
|
|
565
|
+
}
|
|
566
|
+
assignReturnSlot(block, value, sourceReturn) {
|
|
567
|
+
const { value: slot, stmts } = this.arkIRTransformer.generateAssignStmtForValue(value, this.returnPositions(sourceReturn));
|
|
568
|
+
for (const stmt of stmts) {
|
|
569
|
+
this.copyOriginPosition(sourceReturn, stmt);
|
|
570
|
+
block.addStmt(stmt);
|
|
571
|
+
}
|
|
572
|
+
return slot;
|
|
573
|
+
}
|
|
574
|
+
duplicateFinally(sources, sourceTails, finallyEnd) {
|
|
575
|
+
const blocks = this.copyBlocks(sources, finallyEnd);
|
|
576
|
+
for (const block of blocks) {
|
|
577
|
+
this.basicBlockSet.add(block);
|
|
578
|
+
}
|
|
579
|
+
return { blocks, tails: this.getCopiedTails(blocks, sources, sourceTails) };
|
|
580
|
+
}
|
|
581
|
+
fallThroughCopies(tails, copiedBlocks) {
|
|
582
|
+
const copied = new Set(copiedBlocks);
|
|
583
|
+
const fallThrough = [];
|
|
584
|
+
for (const tail of tails) {
|
|
585
|
+
if (this.isReturnTerminator(tail) || tail.getTail() instanceof Stmt_1.ArkThrowStmt) {
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
const successors = tail.getSuccessors();
|
|
589
|
+
let staysInCopy = true;
|
|
590
|
+
for (const successor of successors) {
|
|
591
|
+
if (!copied.has(successor)) {
|
|
592
|
+
staysInCopy = false;
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (staysInCopy) {
|
|
597
|
+
fallThrough.push(tail);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return fallThrough;
|
|
601
|
+
}
|
|
602
|
+
linkFallThrough(tails, targets) {
|
|
603
|
+
for (const target of targets) {
|
|
604
|
+
CfgBuilder_1.CfgBuilder.linkPredecessorsOfBasicBlock(target, tails);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
placeReturnAfterFinally(copiedTails, copiedBlocks, slot, sourceReturn) {
|
|
608
|
+
const aliveTails = this.fallThroughCopies(copiedTails, copiedBlocks);
|
|
609
|
+
if (aliveTails.length === 0) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const returnBlock = new BasicBlock_1.BasicBlock();
|
|
613
|
+
const returnStmt = new Stmt_1.ArkReturnStmt(slot);
|
|
614
|
+
this.copyOriginPosition(sourceReturn, returnStmt);
|
|
615
|
+
const operandPositions = sourceReturn.getOperandOriginalPositions();
|
|
616
|
+
if (operandPositions) {
|
|
617
|
+
returnStmt.setOperandOriginalPositions(operandPositions);
|
|
618
|
+
}
|
|
619
|
+
returnBlock.addStmt(returnStmt);
|
|
620
|
+
this.basicBlockSet.add(returnBlock);
|
|
621
|
+
this.linkFallThrough(aliveTails, [returnBlock]);
|
|
622
|
+
}
|
|
623
|
+
returnPositions(stmt) {
|
|
624
|
+
const operandPositions = stmt.getOperandOriginalPositions();
|
|
625
|
+
if (operandPositions && operandPositions.length > 0) {
|
|
626
|
+
return operandPositions;
|
|
627
|
+
}
|
|
628
|
+
const origin = stmt.getOriginFullPosition();
|
|
629
|
+
if (origin) {
|
|
630
|
+
return [origin];
|
|
631
|
+
}
|
|
632
|
+
return [Position_1.FullPosition.DEFAULT];
|
|
633
|
+
}
|
|
634
|
+
getCopiedTails(copiedBlocks, sourceBlocks, sourceTails) {
|
|
635
|
+
const indexBySource = new Map();
|
|
636
|
+
for (let index = 0; index < sourceBlocks.length; index++) {
|
|
637
|
+
indexBySource.set(sourceBlocks[index], index);
|
|
638
|
+
}
|
|
639
|
+
const copiedTails = [];
|
|
640
|
+
for (const tail of sourceTails) {
|
|
641
|
+
copiedTails.push(copiedBlocks[indexBySource.get(tail)]);
|
|
642
|
+
}
|
|
643
|
+
return copiedTails;
|
|
644
|
+
}
|
|
645
|
+
pruneOriginalFinallyIfUnreachable(finallyBfsBlocks) {
|
|
646
|
+
var _a, _b;
|
|
647
|
+
if (finallyBfsBlocks.length === 0) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const head = finallyBfsBlocks[0];
|
|
651
|
+
if (head.getPredecessors().length > 0) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const finallySet = new Set(finallyBfsBlocks);
|
|
655
|
+
const outgoing = [];
|
|
656
|
+
for (const block of finallyBfsBlocks) {
|
|
657
|
+
for (const successor of block.getSuccessors()) {
|
|
658
|
+
if (!finallySet.has(successor)) {
|
|
659
|
+
outgoing.push(successor);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
CfgBuilder_1.CfgBuilder.unlinkPredecessorsAndSuccessorsOfBasicBlock(block);
|
|
663
|
+
this.basicBlockSet.delete(block);
|
|
664
|
+
}
|
|
665
|
+
for (const successor of outgoing) {
|
|
666
|
+
if (successor.getPredecessors().length === 0 && ((_b = (_a = successor.getExceptionalPredecessorBlocks()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0) {
|
|
667
|
+
CfgBuilder_1.CfgBuilder.unlinkPredecessorsAndSuccessorsOfBasicBlock(successor);
|
|
668
|
+
this.basicBlockSet.delete(successor);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
copyFinallyBlocks(finallyBfsBlocks, finallyTailBlocks, finallyEnd) {
|
|
673
|
+
const { blocks: copyFinallyBfsBlocks, tails: copiedTails } = this.duplicateFinally(finallyBfsBlocks, finallyTailBlocks, finallyEnd);
|
|
323
674
|
const caughtExceptionRef = new Ref_1.ArkCaughtExceptionRef(Type_1.UnknownType.getInstance());
|
|
324
675
|
const { value: exceptionValue, stmts: exceptionAssignStmts, } = this.arkIRTransformer.generateAssignStmtForValue(caughtExceptionRef, [Position_1.FullPosition.DEFAULT]);
|
|
325
676
|
copyFinallyBfsBlocks[0].addHead(exceptionAssignStmts);
|
|
326
677
|
CfgBuilder_1.CfgBuilder.unlinkPredecessorsOfBasicBlock(copyFinallyBfsBlocks[0]);
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
copyFinallyBfsBlocks.push(...copyFinallyTailBlocks);
|
|
339
|
-
copyFinallyBfsBlocks.forEach((copyFinallyBfsBlock) => {
|
|
340
|
-
this.basicBlockSet.add(copyFinallyBfsBlock);
|
|
341
|
-
});
|
|
678
|
+
const fallThroughTails = this.fallThroughCopies(copiedTails, copyFinallyBfsBlocks);
|
|
679
|
+
if (fallThroughTails.length === 1 && fallThroughTails[0].getSuccessors().length === 0) {
|
|
680
|
+
fallThroughTails[0].addStmt(new Stmt_1.ArkThrowStmt(exceptionValue));
|
|
681
|
+
}
|
|
682
|
+
else if (fallThroughTails.length > 0) {
|
|
683
|
+
const join = new BasicBlock_1.BasicBlock();
|
|
684
|
+
join.addStmt(new Stmt_1.ArkThrowStmt(exceptionValue));
|
|
685
|
+
this.basicBlockSet.add(join);
|
|
686
|
+
this.linkFallThrough(fallThroughTails, [join]);
|
|
687
|
+
copyFinallyBfsBlocks.push(join);
|
|
688
|
+
}
|
|
342
689
|
return copyFinallyBfsBlocks;
|
|
343
690
|
}
|
|
344
|
-
copyBlocks(sourceBlocks) {
|
|
691
|
+
copyBlocks(sourceBlocks, fallThroughTarget) {
|
|
692
|
+
var _a;
|
|
345
693
|
const sourceToTarget = new Map();
|
|
346
694
|
const targetBlocks = [];
|
|
347
695
|
for (const sourceBlock of sourceBlocks) {
|
|
@@ -356,8 +704,6 @@ class TrapBuilder {
|
|
|
356
704
|
const targetBlock = sourceToTarget.get(sourceBlock);
|
|
357
705
|
for (const predecessor of sourceBlock.getPredecessors()) {
|
|
358
706
|
const targetPredecessor = sourceToTarget.get(predecessor);
|
|
359
|
-
// Only include blocks within the copy range, so that predecessor and successor relationships to
|
|
360
|
-
// external blocks can be trimmed
|
|
361
707
|
if (targetPredecessor) {
|
|
362
708
|
targetBlock.addPredecessorBlock(targetPredecessor);
|
|
363
709
|
}
|
|
@@ -367,6 +713,15 @@ class TrapBuilder {
|
|
|
367
713
|
if (targetSuccessor) {
|
|
368
714
|
targetBlock.addSuccessorBlock(targetSuccessor);
|
|
369
715
|
}
|
|
716
|
+
else if (successor !== fallThroughTarget) {
|
|
717
|
+
CfgBuilder_1.CfgBuilder.linkBasicBlock(targetBlock, successor);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
for (const exceptional of (_a = sourceBlock.getExceptionalSuccessorBlocks()) !== null && _a !== void 0 ? _a : []) {
|
|
721
|
+
const targetExceptional = sourceToTarget.get(exceptional);
|
|
722
|
+
if (targetExceptional) {
|
|
723
|
+
CfgBuilder_1.CfgBuilder.linkExceptionalBasicBlock(targetBlock, targetExceptional);
|
|
724
|
+
}
|
|
370
725
|
}
|
|
371
726
|
}
|
|
372
727
|
return targetBlocks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkClass.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkClass.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,WAAW,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA4B,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkClass.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkClass.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,WAAW,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OA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G,CAAC,aAAa,GAAG,kBAAkB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE;IAOvF,wBAAwB,IAAI,MAAM;IAIlC,uBAAuB,IAAI,MAAM;IAIxC,aAAa,IAAI,UAAU;IAIpB,qBAAqB,IAAI,SAAS;IAIlC,mBAAmB,IAAI,SAAS;IAIhC,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIjD,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAI/C,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAOrC,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO;IAWxC,QAAQ,IAAI,QAAQ;IAIpB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI;IAIrE,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAI5C,mBAAmB,IAAI,cAAc,GAAG,SAAS;IAIjD,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAInD,kBAAkB,IAAI,IAAI;CAyBpC"}
|
|
@@ -46,7 +46,6 @@ const Const_1 = require("../common/Const");
|
|
|
46
46
|
const Position_1 = require("../base/Position");
|
|
47
47
|
const ArkBaseModel_1 = require("./ArkBaseModel");
|
|
48
48
|
const ModelUtils_1 = require("../common/ModelUtils");
|
|
49
|
-
const StringUtils_1 = require("../common/StringUtils");
|
|
50
49
|
const logger_1 = __importStar(require("../../utils/logger"));
|
|
51
50
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkClass');
|
|
52
51
|
var ClassCategory;
|
|
@@ -118,7 +117,7 @@ class ArkClass extends ArkBaseModel_1.ArkBaseModel {
|
|
|
118
117
|
if (this.sourceCode !== undefined) {
|
|
119
118
|
return this.sourceCode;
|
|
120
119
|
}
|
|
121
|
-
const code =
|
|
120
|
+
const code = this.getDeclaringArkFile().getSourceTextByFullPosition(this.originFullPosition);
|
|
122
121
|
if (code !== undefined) {
|
|
123
122
|
this.sourceCode = code;
|
|
124
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkExport.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkExport.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEnH,OAAO,EAAE,YAAY,EAA4B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArkExport.d.ts","sourceRoot":"","sources":["../../../src/core/model/ArkExport.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEnH,OAAO,EAAE,YAAY,EAA4B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAA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