@rollup/wasm-node 4.63.0 → 4.63.2
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/dist/bin/rollup +21 -12
- package/dist/es/getLogFilter.js +3 -3
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +247 -299
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +54 -6
- package/dist/getLogFilter.js +3 -3
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +54 -6
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +246 -298
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +3 -3
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +24 -24
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.2
|
|
4
|
+
Sat, 12 Sep 2026 06:36:48 GMT - commit 43ed4ec364940fbce7054d8da1f92c695d1e6808
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
|
|
|
42
42
|
|
|
43
43
|
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
|
44
44
|
|
|
45
|
-
var version = "4.63.
|
|
45
|
+
var version = "4.63.2";
|
|
46
46
|
const package_ = {
|
|
47
47
|
version: version};
|
|
48
48
|
|
|
@@ -1309,7 +1309,7 @@ function requireScan () {
|
|
|
1309
1309
|
const opts = options || {};
|
|
1310
1310
|
|
|
1311
1311
|
const length = input.length - 1;
|
|
1312
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1312
|
+
const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
|
|
1313
1313
|
const slashes = [];
|
|
1314
1314
|
const tokens = [];
|
|
1315
1315
|
const parts = [];
|
|
@@ -1443,15 +1443,21 @@ function requireScan () {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
|
|
1445
1445
|
if (scanToEnd === true) {
|
|
1446
|
+
let parens = 0;
|
|
1447
|
+
|
|
1446
1448
|
while (eos() !== true && (code = advance())) {
|
|
1447
1449
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
1448
1450
|
backslashes = token.backslashes = true;
|
|
1449
|
-
|
|
1451
|
+
advance();
|
|
1452
|
+
continue;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1456
|
+
parens++;
|
|
1450
1457
|
continue;
|
|
1451
1458
|
}
|
|
1452
1459
|
|
|
1453
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1454
|
-
isGlob = token.isGlob = true;
|
|
1460
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1455
1461
|
finished = true;
|
|
1456
1462
|
break;
|
|
1457
1463
|
}
|
|
@@ -1516,14 +1522,21 @@ function requireScan () {
|
|
|
1516
1522
|
isGlob = token.isGlob = true;
|
|
1517
1523
|
|
|
1518
1524
|
if (scanToEnd === true) {
|
|
1525
|
+
let parens = 1;
|
|
1526
|
+
|
|
1519
1527
|
while (eos() !== true && (code = advance())) {
|
|
1520
|
-
if (code ===
|
|
1528
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1521
1529
|
backslashes = token.backslashes = true;
|
|
1522
|
-
|
|
1530
|
+
advance();
|
|
1523
1531
|
continue;
|
|
1524
1532
|
}
|
|
1525
1533
|
|
|
1526
|
-
if (code ===
|
|
1534
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1535
|
+
parens++;
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1527
1540
|
finished = true;
|
|
1528
1541
|
break;
|
|
1529
1542
|
}
|
|
@@ -1610,7 +1623,7 @@ function requireScan () {
|
|
|
1610
1623
|
let prevIndex;
|
|
1611
1624
|
|
|
1612
1625
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1613
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
1626
|
+
const n = prevIndex !== undefined ? prevIndex + 1 : start;
|
|
1614
1627
|
const i = slashes[idx];
|
|
1615
1628
|
const value = input.slice(n, i);
|
|
1616
1629
|
if (opts.tokens) {
|
|
@@ -1623,21 +1636,20 @@ function requireScan () {
|
|
|
1623
1636
|
depth(tokens[idx]);
|
|
1624
1637
|
state.maxDepth += tokens[idx].depth;
|
|
1625
1638
|
}
|
|
1626
|
-
if (
|
|
1639
|
+
if (i >= start) {
|
|
1627
1640
|
parts.push(value);
|
|
1641
|
+
prevIndex = i;
|
|
1628
1642
|
}
|
|
1629
|
-
prevIndex = i;
|
|
1630
1643
|
}
|
|
1631
1644
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1645
|
+
const n = prevIndex !== undefined ? prevIndex + 1 : start;
|
|
1646
|
+
const value = input.slice(n);
|
|
1647
|
+
parts.push(value);
|
|
1635
1648
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1649
|
+
if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
|
|
1650
|
+
tokens[tokens.length - 1].value = value;
|
|
1651
|
+
depth(tokens[tokens.length - 1]);
|
|
1652
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1641
1653
|
}
|
|
1642
1654
|
|
|
1643
1655
|
state.slashes = slashes;
|
|
@@ -2188,9 +2200,33 @@ function requireParse () {
|
|
|
2188
2200
|
};
|
|
2189
2201
|
|
|
2190
2202
|
const extglobClose = token => {
|
|
2191
|
-
input.slice(token.startIndex, state.index + 1);
|
|
2203
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
2192
2204
|
const body = input.slice(token.startIndex + 2, state.index);
|
|
2193
|
-
analyzeRepeatedExtglob(body, opts);
|
|
2205
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
2206
|
+
|
|
2207
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
2208
|
+
const safeOutput = analysis.safeOutput
|
|
2209
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
2210
|
+
: undefined;
|
|
2211
|
+
const open = tokens[token.tokensIndex];
|
|
2212
|
+
|
|
2213
|
+
open.type = 'text';
|
|
2214
|
+
open.value = literal;
|
|
2215
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
2216
|
+
|
|
2217
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
2218
|
+
tokens[i].value = '';
|
|
2219
|
+
tokens[i].output = '';
|
|
2220
|
+
delete tokens[i].suffix;
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
state.output = token.output + open.output;
|
|
2224
|
+
state.backtrack = true;
|
|
2225
|
+
|
|
2226
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
2227
|
+
decrement('parens');
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2194
2230
|
|
|
2195
2231
|
let output = token.close + (opts.capture ? ')' : '');
|
|
2196
2232
|
let rest;
|
|
@@ -2802,6 +2838,15 @@ function requireParse () {
|
|
|
2802
2838
|
consume('/**', 3);
|
|
2803
2839
|
}
|
|
2804
2840
|
|
|
2841
|
+
// A globstar followed only by balanced closing parens is at the logical end of patterns like
|
|
2842
|
+
// `test(/utils/**)` and `test?(/utils/**)`. Treat it as EOS so the trailing `/**` can match its
|
|
2843
|
+
// parent path, except in negated extglobs where that would change the exclusion semantics.
|
|
2844
|
+
const isEnd = eos() || (
|
|
2845
|
+
state.parens > 0
|
|
2846
|
+
&& rest === ')'.repeat(state.parens)
|
|
2847
|
+
&& !extglobs.some(extglob => extglob.type === 'negate')
|
|
2848
|
+
);
|
|
2849
|
+
|
|
2805
2850
|
if (prior.type === 'bos' && eos()) {
|
|
2806
2851
|
prev.type = 'globstar';
|
|
2807
2852
|
prev.value += value;
|
|
@@ -2812,7 +2857,7 @@ function requireParse () {
|
|
|
2812
2857
|
continue;
|
|
2813
2858
|
}
|
|
2814
2859
|
|
|
2815
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar &&
|
|
2860
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && isEnd) {
|
|
2816
2861
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2817
2862
|
prior.output = `(?:${prior.output}`;
|
|
2818
2863
|
|
|
@@ -4187,7 +4232,7 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
4187
4232
|
intToChar[i] = c;
|
|
4188
4233
|
charToInt[c] = i;
|
|
4189
4234
|
}
|
|
4190
|
-
function decodeInteger(reader
|
|
4235
|
+
function decodeInteger(reader) {
|
|
4191
4236
|
let value = 0;
|
|
4192
4237
|
let shift = 0;
|
|
4193
4238
|
let integer = 0;
|
|
@@ -4197,23 +4242,21 @@ function decodeInteger(reader, relative) {
|
|
|
4197
4242
|
value |= (integer & 31) << shift;
|
|
4198
4243
|
shift += 5;
|
|
4199
4244
|
} while (integer & 32);
|
|
4200
|
-
|
|
4201
|
-
value >>>= 1;
|
|
4202
|
-
if (shouldNegate) {
|
|
4203
|
-
value = -2147483648 | -value;
|
|
4204
|
-
}
|
|
4205
|
-
return relative + value;
|
|
4245
|
+
return value;
|
|
4206
4246
|
}
|
|
4207
|
-
function
|
|
4208
|
-
|
|
4209
|
-
|
|
4247
|
+
function decodeSign(num) {
|
|
4248
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
4249
|
+
}
|
|
4250
|
+
function encodeInteger(builder, num) {
|
|
4210
4251
|
do {
|
|
4211
|
-
let clamped =
|
|
4212
|
-
|
|
4213
|
-
if (
|
|
4252
|
+
let clamped = num & 31;
|
|
4253
|
+
num >>>= 5;
|
|
4254
|
+
if (num > 0) clamped |= 32;
|
|
4214
4255
|
builder.write(intToChar[clamped]);
|
|
4215
|
-
} while (
|
|
4216
|
-
|
|
4256
|
+
} while (num > 0);
|
|
4257
|
+
}
|
|
4258
|
+
function encodeSign(num) {
|
|
4259
|
+
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
4217
4260
|
}
|
|
4218
4261
|
function hasMoreVlq(reader, max) {
|
|
4219
4262
|
if (reader.pos >= max) return false;
|
|
@@ -4291,15 +4334,15 @@ function decode(mappings) {
|
|
|
4291
4334
|
genColumn = 0;
|
|
4292
4335
|
while (reader.pos < semi) {
|
|
4293
4336
|
let seg;
|
|
4294
|
-
genColumn
|
|
4337
|
+
genColumn += decodeSign(decodeInteger(reader));
|
|
4295
4338
|
if (genColumn < lastCol) sorted = false;
|
|
4296
4339
|
lastCol = genColumn;
|
|
4297
4340
|
if (hasMoreVlq(reader, semi)) {
|
|
4298
|
-
sourcesIndex
|
|
4299
|
-
sourceLine
|
|
4300
|
-
sourceColumn
|
|
4341
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
4342
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
4343
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
4301
4344
|
if (hasMoreVlq(reader, semi)) {
|
|
4302
|
-
namesIndex
|
|
4345
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
4303
4346
|
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
4304
4347
|
} else {
|
|
4305
4348
|
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
@@ -4336,13 +4379,18 @@ function encode(decoded) {
|
|
|
4336
4379
|
for (let j = 0; j < line.length; j++) {
|
|
4337
4380
|
const segment = line[j];
|
|
4338
4381
|
if (j > 0) writer.write(comma);
|
|
4339
|
-
|
|
4382
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
4383
|
+
genColumn = segment[0];
|
|
4340
4384
|
if (segment.length === 1) continue;
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4385
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
4386
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
4387
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
4388
|
+
sourcesIndex = segment[1];
|
|
4389
|
+
sourceLine = segment[2];
|
|
4390
|
+
sourceColumn = segment[3];
|
|
4344
4391
|
if (segment.length === 4) continue;
|
|
4345
|
-
|
|
4392
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
4393
|
+
namesIndex = segment[4];
|
|
4346
4394
|
}
|
|
4347
4395
|
}
|
|
4348
4396
|
return writer.flush();
|
|
@@ -5067,8 +5115,8 @@ var MagicString = class MagicString {
|
|
|
5067
5115
|
end = end + this.offset;
|
|
5068
5116
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
5069
5117
|
if (this.original.length !== 0) {
|
|
5070
|
-
|
|
5071
|
-
|
|
5118
|
+
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
5119
|
+
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
5072
5120
|
}
|
|
5073
5121
|
if (start < 0) throw new MagicStringError(`start ${start} is out of bounds`);
|
|
5074
5122
|
if (end > this.original.length) throw new MagicStringError(`end ${end} is out of bounds`);
|
|
@@ -5151,8 +5199,8 @@ var MagicString = class MagicString {
|
|
|
5151
5199
|
start = start + this.offset;
|
|
5152
5200
|
end = end + this.offset;
|
|
5153
5201
|
if (this.original.length !== 0) {
|
|
5154
|
-
|
|
5155
|
-
|
|
5202
|
+
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
5203
|
+
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
5156
5204
|
}
|
|
5157
5205
|
if (start === end) return this;
|
|
5158
5206
|
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
@@ -5175,8 +5223,8 @@ var MagicString = class MagicString {
|
|
|
5175
5223
|
start = start + this.offset;
|
|
5176
5224
|
end = end + this.offset;
|
|
5177
5225
|
if (this.original.length !== 0) {
|
|
5178
|
-
|
|
5179
|
-
|
|
5226
|
+
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
5227
|
+
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
5180
5228
|
}
|
|
5181
5229
|
if (start === end) return this;
|
|
5182
5230
|
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
@@ -5237,8 +5285,8 @@ var MagicString = class MagicString {
|
|
|
5237
5285
|
start = start + this.offset;
|
|
5238
5286
|
end = end + this.offset;
|
|
5239
5287
|
if (this.original.length !== 0) {
|
|
5240
|
-
|
|
5241
|
-
|
|
5288
|
+
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
5289
|
+
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
5242
5290
|
}
|
|
5243
5291
|
let result = "";
|
|
5244
5292
|
let chunk = this.firstChunk;
|
|
@@ -5424,27 +5472,19 @@ var MagicString = class MagicString {
|
|
|
5424
5472
|
});
|
|
5425
5473
|
else return replacement(match[0], ...match.slice(1), match.index, str, match.groups);
|
|
5426
5474
|
}
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
const replacement = getReplacement(match, this.original);
|
|
5439
|
-
if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
5440
|
-
}
|
|
5441
|
-
});
|
|
5442
|
-
else {
|
|
5475
|
+
const replaceMatch = (match) => {
|
|
5476
|
+
if (match.index == null) return;
|
|
5477
|
+
const replacement = getReplacement(match, this.original);
|
|
5478
|
+
if (replacement === match[0]) return;
|
|
5479
|
+
if (match[0].length === 0) this.appendRight(match.index, replacement);
|
|
5480
|
+
else this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
5481
|
+
};
|
|
5482
|
+
if (searchValue.global) {
|
|
5483
|
+
searchValue.lastIndex = 0;
|
|
5484
|
+
for (const match of this.original.matchAll(searchValue)) replaceMatch(match);
|
|
5485
|
+
} else {
|
|
5443
5486
|
const match = this.original.match(searchValue);
|
|
5444
|
-
if (match
|
|
5445
|
-
const replacement = getReplacement(match, this.original);
|
|
5446
|
-
if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
5447
|
-
}
|
|
5487
|
+
if (match) replaceMatch(match);
|
|
5448
5488
|
}
|
|
5449
5489
|
return this;
|
|
5450
5490
|
}
|
|
@@ -5454,7 +5494,8 @@ var MagicString = class MagicString {
|
|
|
5454
5494
|
const index = original.indexOf(string);
|
|
5455
5495
|
if (index !== -1) {
|
|
5456
5496
|
if (typeof replacement === "function") replacement = replacement(string, index, original);
|
|
5457
|
-
if (string !== replacement)
|
|
5497
|
+
if (string !== replacement) if (string.length === 0) this.appendRight(index, replacement);
|
|
5498
|
+
else this.overwrite(index, index + string.length, replacement);
|
|
5458
5499
|
}
|
|
5459
5500
|
return this;
|
|
5460
5501
|
}
|
|
@@ -5469,6 +5510,13 @@ var MagicString = class MagicString {
|
|
|
5469
5510
|
_replaceAllString(string, replacement) {
|
|
5470
5511
|
const { original } = this;
|
|
5471
5512
|
const stringLength = string.length;
|
|
5513
|
+
if (stringLength === 0) {
|
|
5514
|
+
for (let index = 0; index <= original.length; index += 1) {
|
|
5515
|
+
const _replacement = typeof replacement === "function" ? replacement("", index, original) : replacement;
|
|
5516
|
+
if (_replacement !== "") this.appendRight(index, _replacement);
|
|
5517
|
+
}
|
|
5518
|
+
return this;
|
|
5519
|
+
}
|
|
5472
5520
|
for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
5473
5521
|
const previous = original.slice(index, index + stringLength);
|
|
5474
5522
|
const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : replacement;
|
|
@@ -5613,7 +5661,7 @@ var Bundle$1 = class Bundle {
|
|
|
5613
5661
|
indentStringCounts[indentStr] += 1;
|
|
5614
5662
|
});
|
|
5615
5663
|
return Object.keys(indentStringCounts).sort((a, b) => {
|
|
5616
|
-
return indentStringCounts[
|
|
5664
|
+
return indentStringCounts[b] - indentStringCounts[a];
|
|
5617
5665
|
})[0] || " ";
|
|
5618
5666
|
}
|
|
5619
5667
|
indent(indentStr) {
|
|
@@ -5668,27 +5716,27 @@ var Bundle$1 = class Bundle {
|
|
|
5668
5716
|
trimStart(charType) {
|
|
5669
5717
|
const rx = new RegExp(`^${charType || "\\s"}+`);
|
|
5670
5718
|
this.intro = this.intro.replace(rx, "");
|
|
5671
|
-
if (!this.intro) {
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
source
|
|
5676
|
-
|
|
5677
|
-
|
|
5719
|
+
if (!this.intro) for (let i = 0; i < this.sources.length; i += 1) {
|
|
5720
|
+
const source = this.sources[i];
|
|
5721
|
+
if (i > 0) {
|
|
5722
|
+
source.separator = (source.separator !== void 0 ? source.separator : this.separator).replace(rx, "");
|
|
5723
|
+
if (source.separator) break;
|
|
5724
|
+
}
|
|
5725
|
+
if (source.content.trimStartAborted(charType)) break;
|
|
5678
5726
|
}
|
|
5679
5727
|
return this;
|
|
5680
5728
|
}
|
|
5681
5729
|
trimEnd(charType) {
|
|
5682
5730
|
const rx = new RegExp(`${charType || "\\s"}+$`);
|
|
5683
|
-
let
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
break;
|
|
5731
|
+
for (let i = this.sources.length - 1; i >= 0; i -= 1) {
|
|
5732
|
+
const source = this.sources[i];
|
|
5733
|
+
if (source.content.trimEndAborted(charType)) return this;
|
|
5734
|
+
if (i > 0) {
|
|
5735
|
+
source.separator = (source.separator !== void 0 ? source.separator : this.separator).replace(rx, "");
|
|
5736
|
+
if (source.separator) return this;
|
|
5690
5737
|
}
|
|
5691
|
-
}
|
|
5738
|
+
}
|
|
5739
|
+
this.intro = this.intro.replace(rx, "");
|
|
5692
5740
|
return this;
|
|
5693
5741
|
}
|
|
5694
5742
|
};
|
|
@@ -6202,17 +6250,8 @@ class ExpressionEntity {
|
|
|
6202
6250
|
return true;
|
|
6203
6251
|
}
|
|
6204
6252
|
}
|
|
6205
|
-
class
|
|
6206
|
-
|
|
6207
|
-
super();
|
|
6208
|
-
this.value = value;
|
|
6209
|
-
this.parent = parent;
|
|
6210
|
-
}
|
|
6211
|
-
getLiteralValueAtPath(path) {
|
|
6212
|
-
return path.length > 0 ? UnknownValue : this.value;
|
|
6213
|
-
}
|
|
6214
|
-
}
|
|
6215
|
-
const UNKNOWN_EXPRESSION = new LiteralExpression(UnknownValue);
|
|
6253
|
+
const UNKNOWN_EXPRESSION = new (class UnknownExpression extends ExpressionEntity {
|
|
6254
|
+
})();
|
|
6216
6255
|
const UNKNOWN_RETURN_EXPRESSION = [
|
|
6217
6256
|
UNKNOWN_EXPRESSION,
|
|
6218
6257
|
false
|
|
@@ -6942,7 +6981,11 @@ function isExpressionStatementNode(node) {
|
|
|
6942
6981
|
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
6943
6982
|
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
6944
6983
|
}
|
|
6945
|
-
const UNDEFINED_EXPRESSION = new
|
|
6984
|
+
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
6985
|
+
getLiteralValueAtPath(path) {
|
|
6986
|
+
return path.length > 0 ? UnknownValue : undefined;
|
|
6987
|
+
}
|
|
6988
|
+
})();
|
|
6946
6989
|
const returnsUnknown = {
|
|
6947
6990
|
value: {
|
|
6948
6991
|
hasEffectsWhenCalled: null,
|
|
@@ -7123,7 +7166,7 @@ function getLiteralMembersForValue(value) {
|
|
|
7123
7166
|
return literalStringMembers;
|
|
7124
7167
|
}
|
|
7125
7168
|
}
|
|
7126
|
-
return
|
|
7169
|
+
return Object.create(null);
|
|
7127
7170
|
}
|
|
7128
7171
|
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
7129
7172
|
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
@@ -7423,8 +7466,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7423
7466
|
// causes an issue with TypeScript enums in files with moduleSideEffects:
|
|
7424
7467
|
// false because we cannot properly track whether a "var" has been
|
|
7425
7468
|
// initialized. This should be reverted once we can properly track this.
|
|
7426
|
-
// ALSO needs to be updated once this is resolved:
|
|
7427
|
-
// - literals-from-return-expressions-branches/main.js
|
|
7428
7469
|
// return UnknownTruthyValue;
|
|
7429
7470
|
return UnknownValue;
|
|
7430
7471
|
}
|
|
@@ -10125,156 +10166,6 @@ class ThisVariable extends ParameterVariable {
|
|
|
10125
10166
|
}
|
|
10126
10167
|
}
|
|
10127
10168
|
|
|
10128
|
-
const UNASSIGNED = Symbol('unassigned');
|
|
10129
|
-
|
|
10130
|
-
class ReturnStatement extends NodeBase {
|
|
10131
|
-
constructor() {
|
|
10132
|
-
super(...arguments);
|
|
10133
|
-
this.expressionsToBeDeoptimized = [];
|
|
10134
|
-
}
|
|
10135
|
-
checkReached(origin) {
|
|
10136
|
-
if (this.deoptimized)
|
|
10137
|
-
return true;
|
|
10138
|
-
this.expressionsToBeDeoptimized.push(origin);
|
|
10139
|
-
return false;
|
|
10140
|
-
}
|
|
10141
|
-
applyDeoptimizations() {
|
|
10142
|
-
this.deoptimized = true;
|
|
10143
|
-
const { expressionsToBeDeoptimized } = this;
|
|
10144
|
-
if (expressionsToBeDeoptimized.length) {
|
|
10145
|
-
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
10146
|
-
for (const expression of expressionsToBeDeoptimized) {
|
|
10147
|
-
expression.deoptimizeCache();
|
|
10148
|
-
}
|
|
10149
|
-
this.scope.context.requestTreeshakingPass();
|
|
10150
|
-
}
|
|
10151
|
-
}
|
|
10152
|
-
hasEffects(context) {
|
|
10153
|
-
if (!this.deoptimized)
|
|
10154
|
-
this.applyDeoptimizations();
|
|
10155
|
-
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
10156
|
-
return true;
|
|
10157
|
-
context.brokenFlow = true;
|
|
10158
|
-
return false;
|
|
10159
|
-
}
|
|
10160
|
-
include(context, includeChildrenRecursively) {
|
|
10161
|
-
if (!this.included)
|
|
10162
|
-
this.includeNode(context);
|
|
10163
|
-
this.argument?.include(context, includeChildrenRecursively);
|
|
10164
|
-
context.brokenFlow = true;
|
|
10165
|
-
}
|
|
10166
|
-
includeNode(context) {
|
|
10167
|
-
this.included = true;
|
|
10168
|
-
if (!this.deoptimized)
|
|
10169
|
-
this.applyDeoptimizations();
|
|
10170
|
-
this.argument?.includePath(UNKNOWN_PATH, context);
|
|
10171
|
-
}
|
|
10172
|
-
initialise() {
|
|
10173
|
-
super.initialise();
|
|
10174
|
-
this.scope.addReturnExpression(this.argument || new LiteralExpression(undefined, this));
|
|
10175
|
-
}
|
|
10176
|
-
render(code, options) {
|
|
10177
|
-
if (this.argument) {
|
|
10178
|
-
this.argument.render(code, options, { preventASI: true });
|
|
10179
|
-
if (this.argument.start === this.start + 6 /* 'return'.length */) {
|
|
10180
|
-
code.prependLeft(this.start + 6, ' ');
|
|
10181
|
-
}
|
|
10182
|
-
}
|
|
10183
|
-
}
|
|
10184
|
-
}
|
|
10185
|
-
|
|
10186
|
-
function mergeValues(a, b) {
|
|
10187
|
-
if (a === b)
|
|
10188
|
-
return a;
|
|
10189
|
-
if (a === UnknownTruthyValue) {
|
|
10190
|
-
if (b && b !== UnknownFalsyValue)
|
|
10191
|
-
return UnknownTruthyValue;
|
|
10192
|
-
return UnknownValue;
|
|
10193
|
-
}
|
|
10194
|
-
if (a === UnknownFalsyValue) {
|
|
10195
|
-
if (!b || b === UnknownFalsyValue)
|
|
10196
|
-
return UnknownFalsyValue;
|
|
10197
|
-
return UnknownValue;
|
|
10198
|
-
}
|
|
10199
|
-
if (a && b)
|
|
10200
|
-
return UnknownTruthyValue;
|
|
10201
|
-
if (!a && !b)
|
|
10202
|
-
return UnknownFalsyValue;
|
|
10203
|
-
return UnknownValue;
|
|
10204
|
-
}
|
|
10205
|
-
class MultiExpression extends ExpressionEntity {
|
|
10206
|
-
constructor(expressions) {
|
|
10207
|
-
super();
|
|
10208
|
-
this.expressions = expressions;
|
|
10209
|
-
this.literalValue = UNASSIGNED;
|
|
10210
|
-
this.dependantEntities = new Set();
|
|
10211
|
-
}
|
|
10212
|
-
deoptimizeCache() {
|
|
10213
|
-
if (this.literalValue !== UNASSIGNED) {
|
|
10214
|
-
const { dependantEntities } = this;
|
|
10215
|
-
this.literalValue = UNASSIGNED;
|
|
10216
|
-
this.dependantEntities = new Set();
|
|
10217
|
-
for (const entity of dependantEntities) {
|
|
10218
|
-
entity.deoptimizeCache();
|
|
10219
|
-
}
|
|
10220
|
-
}
|
|
10221
|
-
}
|
|
10222
|
-
deoptimizePath(path) {
|
|
10223
|
-
for (const expression of this.expressions) {
|
|
10224
|
-
expression.deoptimizePath(path);
|
|
10225
|
-
}
|
|
10226
|
-
}
|
|
10227
|
-
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10228
|
-
if (path.length === 0) {
|
|
10229
|
-
if (this.literalValue === UNASSIGNED)
|
|
10230
|
-
this.literalValue = this.doGetLiteralValueAtPath(path, recursionTracker, this);
|
|
10231
|
-
this.dependantEntities.add(origin);
|
|
10232
|
-
return this.literalValue;
|
|
10233
|
-
}
|
|
10234
|
-
return this.doGetLiteralValueAtPath(path, recursionTracker, origin);
|
|
10235
|
-
}
|
|
10236
|
-
doGetLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10237
|
-
let value = UnknownValue;
|
|
10238
|
-
for (const expression of this.expressions) {
|
|
10239
|
-
if (this.isTreeshaken(expression))
|
|
10240
|
-
continue;
|
|
10241
|
-
const expressionValue = expression.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
10242
|
-
if (expressionValue === UnknownValue)
|
|
10243
|
-
return UnknownValue;
|
|
10244
|
-
if (value === UnknownValue) {
|
|
10245
|
-
value = expressionValue;
|
|
10246
|
-
continue;
|
|
10247
|
-
}
|
|
10248
|
-
value = mergeValues(value, expressionValue);
|
|
10249
|
-
if (value === UnknownValue)
|
|
10250
|
-
return UnknownValue;
|
|
10251
|
-
}
|
|
10252
|
-
return value;
|
|
10253
|
-
}
|
|
10254
|
-
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
10255
|
-
const returnExpressions = this.expressions.map(expression => expression.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin));
|
|
10256
|
-
let pure = true;
|
|
10257
|
-
return [
|
|
10258
|
-
new MultiExpression(returnExpressions.map(expression => ((pure &&= expression[1]), expression[0]))),
|
|
10259
|
-
pure
|
|
10260
|
-
];
|
|
10261
|
-
}
|
|
10262
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10263
|
-
for (const expression of this.expressions) {
|
|
10264
|
-
if (!this.isTreeshaken(expression) &&
|
|
10265
|
-
expression.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
10266
|
-
return true;
|
|
10267
|
-
}
|
|
10268
|
-
return false;
|
|
10269
|
-
}
|
|
10270
|
-
isTreeshaken(expression) {
|
|
10271
|
-
if ('parent' in expression && expression.parent instanceof ReturnStatement) {
|
|
10272
|
-
return !expression.parent.checkReached(this);
|
|
10273
|
-
}
|
|
10274
|
-
return false;
|
|
10275
|
-
}
|
|
10276
|
-
}
|
|
10277
|
-
|
|
10278
10169
|
class CatchBodyScope extends ChildScope {
|
|
10279
10170
|
constructor(parent) {
|
|
10280
10171
|
super(parent, parent.context);
|
|
@@ -10484,12 +10375,8 @@ class ReturnValueScope extends ParameterScope {
|
|
|
10484
10375
|
}
|
|
10485
10376
|
}
|
|
10486
10377
|
getReturnExpression() {
|
|
10487
|
-
if (
|
|
10488
|
-
this.
|
|
10489
|
-
this.returnExpressions.length === 1
|
|
10490
|
-
? this.returnExpressions[0]
|
|
10491
|
-
: new MultiExpression(this.returnExpressions);
|
|
10492
|
-
}
|
|
10378
|
+
if (this.returnExpression === null)
|
|
10379
|
+
this.updateReturnExpression();
|
|
10493
10380
|
return this.returnExpression;
|
|
10494
10381
|
}
|
|
10495
10382
|
deoptimizeAllParameters() {
|
|
@@ -10508,6 +10395,17 @@ class ReturnValueScope extends ParameterScope {
|
|
|
10508
10395
|
}
|
|
10509
10396
|
}
|
|
10510
10397
|
addArgumentToBeDeoptimized(_argument) { }
|
|
10398
|
+
updateReturnExpression() {
|
|
10399
|
+
if (this.returnExpressions.length === 1) {
|
|
10400
|
+
this.returnExpression = this.returnExpressions[0];
|
|
10401
|
+
}
|
|
10402
|
+
else {
|
|
10403
|
+
this.returnExpression = UNKNOWN_EXPRESSION;
|
|
10404
|
+
for (const expression of this.returnExpressions) {
|
|
10405
|
+
expression.deoptimizePath(UNKNOWN_PATH);
|
|
10406
|
+
}
|
|
10407
|
+
}
|
|
10408
|
+
}
|
|
10511
10409
|
}
|
|
10512
10410
|
|
|
10513
10411
|
class FunctionScope extends ReturnValueScope {
|
|
@@ -10569,10 +10467,6 @@ ExpressionStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize;
|
|
|
10569
10467
|
ExpressionStatement.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
10570
10468
|
|
|
10571
10469
|
class BlockStatement extends NodeBase {
|
|
10572
|
-
constructor() {
|
|
10573
|
-
super(...arguments);
|
|
10574
|
-
this.virtualReturnStatement = null;
|
|
10575
|
-
}
|
|
10576
10470
|
get deoptimizeBody() {
|
|
10577
10471
|
return isFlagSet(this.flags, 32768 /* Flag.deoptimizeBody */);
|
|
10578
10472
|
}
|
|
@@ -10588,13 +10482,7 @@ class BlockStatement extends NodeBase {
|
|
|
10588
10482
|
addImplicitReturnExpressionToScope() {
|
|
10589
10483
|
const lastStatement = this.body[this.body.length - 1];
|
|
10590
10484
|
if (!lastStatement || lastStatement.type !== parseAst_js.ReturnStatement) {
|
|
10591
|
-
|
|
10592
|
-
virtualReturnStatement.type = parseAst_js.ReturnStatement;
|
|
10593
|
-
virtualReturnStatement.argument = null;
|
|
10594
|
-
virtualReturnStatement.initialise();
|
|
10595
|
-
if (this.deoptimizeBody)
|
|
10596
|
-
virtualReturnStatement.includeNode(createInclusionContext());
|
|
10597
|
-
this.virtualReturnStatement = virtualReturnStatement;
|
|
10485
|
+
this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
|
|
10598
10486
|
}
|
|
10599
10487
|
}
|
|
10600
10488
|
createScope(parentScope) {
|
|
@@ -10605,15 +10493,13 @@ class BlockStatement extends NodeBase {
|
|
|
10605
10493
|
hasEffects(context) {
|
|
10606
10494
|
if (this.deoptimizeBody)
|
|
10607
10495
|
return true;
|
|
10608
|
-
let hasEffect = false;
|
|
10609
10496
|
for (const node of this.body) {
|
|
10610
|
-
if (context.brokenFlow
|
|
10497
|
+
if (context.brokenFlow)
|
|
10611
10498
|
break;
|
|
10499
|
+
if (node.hasEffects(context))
|
|
10500
|
+
return true;
|
|
10612
10501
|
}
|
|
10613
|
-
|
|
10614
|
-
hasEffect ||= !!this.virtualReturnStatement?.hasEffects(context);
|
|
10615
|
-
}
|
|
10616
|
-
return hasEffect;
|
|
10502
|
+
return false;
|
|
10617
10503
|
}
|
|
10618
10504
|
include(context, includeChildrenRecursively) {
|
|
10619
10505
|
if (!(this.deoptimizeBody && this.directlyIncluded)) {
|
|
@@ -10625,8 +10511,6 @@ class BlockStatement extends NodeBase {
|
|
|
10625
10511
|
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
10626
10512
|
node.include(context, includeChildrenRecursively);
|
|
10627
10513
|
}
|
|
10628
|
-
if (includeChildrenRecursively || !context.brokenFlow)
|
|
10629
|
-
this.virtualReturnStatement?.include(context, includeChildrenRecursively);
|
|
10630
10514
|
}
|
|
10631
10515
|
}
|
|
10632
10516
|
initialise() {
|
|
@@ -11639,7 +11523,7 @@ class MemberExpression extends NodeBase {
|
|
|
11639
11523
|
if (!this.included)
|
|
11640
11524
|
this.includeNode(context);
|
|
11641
11525
|
if (this.variable) {
|
|
11642
|
-
this.variable
|
|
11526
|
+
this.variable?.includePath(path, context);
|
|
11643
11527
|
}
|
|
11644
11528
|
else if (!this.isUndefined) {
|
|
11645
11529
|
this.object.includePath([
|
|
@@ -13847,10 +13731,11 @@ const binaryOperators = {
|
|
|
13847
13731
|
// in: () => UnknownValue,
|
|
13848
13732
|
// instanceof: () => UnknownValue,
|
|
13849
13733
|
};
|
|
13734
|
+
const UNASSIGNED$1 = Symbol('Unassigned');
|
|
13850
13735
|
class BinaryExpression extends NodeBase {
|
|
13851
13736
|
constructor() {
|
|
13852
13737
|
super(...arguments);
|
|
13853
|
-
this.renderedLiteralValue = UNASSIGNED;
|
|
13738
|
+
this.renderedLiteralValue = UNASSIGNED$1;
|
|
13854
13739
|
}
|
|
13855
13740
|
deoptimizeCache() {
|
|
13856
13741
|
this.renderedLiteralValue = UnknownValue;
|
|
@@ -13883,7 +13768,7 @@ class BinaryExpression extends NodeBase {
|
|
|
13883
13768
|
if (this.operator !== 'in' || !(this.right.variable instanceof NamespaceVariable)) {
|
|
13884
13769
|
return UnknownValue;
|
|
13885
13770
|
}
|
|
13886
|
-
if (this.renderedLiteralValue !== UNASSIGNED)
|
|
13771
|
+
if (this.renderedLiteralValue !== UNASSIGNED$1)
|
|
13887
13772
|
return this.renderedLiteralValue;
|
|
13888
13773
|
return (this.renderedLiteralValue = getRenderedLiteralValue(this.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this)));
|
|
13889
13774
|
}
|
|
@@ -14018,10 +13903,10 @@ class CallExpressionBase extends NodeBase {
|
|
|
14018
13903
|
}
|
|
14019
13904
|
deoptimizeCache() {
|
|
14020
13905
|
if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
|
|
14021
|
-
this.returnExpression =
|
|
13906
|
+
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14022
13907
|
const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
|
|
14023
|
-
this.expressionsToBeDeoptimized =
|
|
14024
|
-
this.deoptimizableDependentExpressions =
|
|
13908
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_SET;
|
|
13909
|
+
this.deoptimizableDependentExpressions = parseAst_js.EMPTY_ARRAY;
|
|
14025
13910
|
for (const expression of deoptimizableDependentExpressions) {
|
|
14026
13911
|
expression.deoptimizeCache();
|
|
14027
13912
|
}
|
|
@@ -14047,7 +13932,7 @@ class CallExpressionBase extends NodeBase {
|
|
|
14047
13932
|
}
|
|
14048
13933
|
return recursionTracker.withTrackedEntityAtPath(path, returnExpression, () => {
|
|
14049
13934
|
this.deoptimizableDependentExpressions.push(origin);
|
|
14050
|
-
return returnExpression.getLiteralValueAtPath(path, recursionTracker,
|
|
13935
|
+
return returnExpression.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
14051
13936
|
}, UnknownValue);
|
|
14052
13937
|
}
|
|
14053
13938
|
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
@@ -14159,6 +14044,11 @@ class CallExpression extends CallExpressionBase {
|
|
|
14159
14044
|
this.callee.includeCallArguments(this.interaction, context);
|
|
14160
14045
|
}
|
|
14161
14046
|
}
|
|
14047
|
+
includeNode(_context) {
|
|
14048
|
+
this.included = true;
|
|
14049
|
+
if (!this.deoptimized)
|
|
14050
|
+
this.applyDeoptimizations();
|
|
14051
|
+
}
|
|
14162
14052
|
initialise() {
|
|
14163
14053
|
super.initialise();
|
|
14164
14054
|
if (this.annotations &&
|
|
@@ -14190,13 +14080,12 @@ class CallExpression extends CallExpressionBase {
|
|
|
14190
14080
|
}
|
|
14191
14081
|
getReturnExpression(recursionTracker = SHARED_RECURSION_TRACKER) {
|
|
14192
14082
|
if (this.returnExpression === null) {
|
|
14193
|
-
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14194
|
-
this.returnExpression = this.callee.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, this.interaction, recursionTracker, this);
|
|
14083
|
+
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14084
|
+
return (this.returnExpression = this.callee.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, this.interaction, recursionTracker, this));
|
|
14195
14085
|
}
|
|
14196
14086
|
return this.returnExpression;
|
|
14197
14087
|
}
|
|
14198
14088
|
}
|
|
14199
|
-
CallExpression.prototype.includeNode = onlyIncludeSelf;
|
|
14200
14089
|
|
|
14201
14090
|
class CatchClause extends NodeBase {
|
|
14202
14091
|
createScope(parentScope) {
|
|
@@ -14296,6 +14185,31 @@ function tryCastLiteralValueToBoolean(literalValue) {
|
|
|
14296
14185
|
return !!literalValue;
|
|
14297
14186
|
}
|
|
14298
14187
|
|
|
14188
|
+
class MultiExpression extends ExpressionEntity {
|
|
14189
|
+
constructor(expressions) {
|
|
14190
|
+
super();
|
|
14191
|
+
this.expressions = expressions;
|
|
14192
|
+
}
|
|
14193
|
+
deoptimizePath(path) {
|
|
14194
|
+
for (const expression of this.expressions) {
|
|
14195
|
+
expression.deoptimizePath(path);
|
|
14196
|
+
}
|
|
14197
|
+
}
|
|
14198
|
+
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
14199
|
+
return [
|
|
14200
|
+
new MultiExpression(this.expressions.map(expression => expression.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)[0])),
|
|
14201
|
+
false
|
|
14202
|
+
];
|
|
14203
|
+
}
|
|
14204
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
14205
|
+
for (const expression of this.expressions) {
|
|
14206
|
+
if (expression.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
14207
|
+
return true;
|
|
14208
|
+
}
|
|
14209
|
+
return false;
|
|
14210
|
+
}
|
|
14211
|
+
}
|
|
14212
|
+
|
|
14299
14213
|
class ConditionalExpression extends NodeBase {
|
|
14300
14214
|
constructor() {
|
|
14301
14215
|
super(...arguments);
|
|
@@ -14799,13 +14713,14 @@ class TrackingScope extends BlockScope {
|
|
|
14799
14713
|
}
|
|
14800
14714
|
}
|
|
14801
14715
|
|
|
14716
|
+
const unset = Symbol('unset');
|
|
14802
14717
|
class IfStatement extends NodeBase {
|
|
14803
14718
|
constructor() {
|
|
14804
14719
|
super(...arguments);
|
|
14805
|
-
this.testValue =
|
|
14720
|
+
this.testValue = unset;
|
|
14806
14721
|
}
|
|
14807
14722
|
deoptimizeCache() {
|
|
14808
|
-
this.testValue =
|
|
14723
|
+
this.testValue = UnknownValue;
|
|
14809
14724
|
}
|
|
14810
14725
|
hasEffects(context) {
|
|
14811
14726
|
if (this.test.hasEffects(context)) {
|
|
@@ -14894,8 +14809,8 @@ class IfStatement extends NodeBase {
|
|
|
14894
14809
|
this.renderHoistedDeclarations(hoistedDeclarations, code, getPropertyAccess);
|
|
14895
14810
|
}
|
|
14896
14811
|
getTestValue() {
|
|
14897
|
-
if (this.testValue ===
|
|
14898
|
-
this.testValue = tryCastLiteralValueToBoolean(this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this));
|
|
14812
|
+
if (this.testValue === unset) {
|
|
14813
|
+
return (this.testValue = tryCastLiteralValueToBoolean(this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this)));
|
|
14899
14814
|
}
|
|
14900
14815
|
return this.testValue;
|
|
14901
14816
|
}
|
|
@@ -16549,6 +16464,38 @@ class PropertyDefinition extends NodeBase {
|
|
|
16549
16464
|
}
|
|
16550
16465
|
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
16551
16466
|
|
|
16467
|
+
class ReturnStatement extends NodeBase {
|
|
16468
|
+
hasEffects(context) {
|
|
16469
|
+
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
16470
|
+
return true;
|
|
16471
|
+
context.brokenFlow = true;
|
|
16472
|
+
return false;
|
|
16473
|
+
}
|
|
16474
|
+
include(context, includeChildrenRecursively) {
|
|
16475
|
+
if (!this.included)
|
|
16476
|
+
this.includeNode(context);
|
|
16477
|
+
this.argument?.include(context, includeChildrenRecursively);
|
|
16478
|
+
context.brokenFlow = true;
|
|
16479
|
+
}
|
|
16480
|
+
includeNode(context) {
|
|
16481
|
+
this.included = true;
|
|
16482
|
+
this.argument?.includePath(UNKNOWN_PATH, context);
|
|
16483
|
+
}
|
|
16484
|
+
initialise() {
|
|
16485
|
+
super.initialise();
|
|
16486
|
+
this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION);
|
|
16487
|
+
}
|
|
16488
|
+
render(code, options) {
|
|
16489
|
+
if (this.argument) {
|
|
16490
|
+
this.argument.render(code, options, { preventASI: true });
|
|
16491
|
+
if (this.argument.start === this.start + 6 /* 'return'.length */) {
|
|
16492
|
+
code.prependLeft(this.start + 6, ' ');
|
|
16493
|
+
}
|
|
16494
|
+
}
|
|
16495
|
+
}
|
|
16496
|
+
}
|
|
16497
|
+
ReturnStatement.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
16498
|
+
|
|
16552
16499
|
class SequenceExpression extends NodeBase {
|
|
16553
16500
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
16554
16501
|
this.expressions[this.expressions.length - 1].deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
@@ -17072,6 +17019,7 @@ const unaryOperators = {
|
|
|
17072
17019
|
void: () => undefined,
|
|
17073
17020
|
'~': value => ~value
|
|
17074
17021
|
};
|
|
17022
|
+
const UNASSIGNED = Symbol('Unassigned');
|
|
17075
17023
|
class UnaryExpression extends NodeBase {
|
|
17076
17024
|
constructor() {
|
|
17077
17025
|
super(...arguments);
|