rollup 3.20.2 → 3.20.3
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 +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +137 -115
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +137 -115
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.20.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.20.3
|
|
4
|
+
Sun, 16 Apr 2023 13:03:29 GMT - commit bd675b104147594767b56df2756426d032a68583
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version$1 = "3.20.
|
|
19
|
+
var version$1 = "3.20.3";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -1860,11 +1860,8 @@ const UNKNOWN_RETURN_EXPRESSION = [
|
|
|
1860
1860
|
false
|
|
1861
1861
|
];
|
|
1862
1862
|
const deoptimizeInteraction = (interaction) => {
|
|
1863
|
-
interaction.
|
|
1864
|
-
|
|
1865
|
-
for (const argument of interaction.args) {
|
|
1866
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
1867
|
-
}
|
|
1863
|
+
for (const argument of interaction.args) {
|
|
1864
|
+
argument?.deoptimizePath(UNKNOWN_PATH);
|
|
1868
1865
|
}
|
|
1869
1866
|
};
|
|
1870
1867
|
|
|
@@ -1872,23 +1869,18 @@ const INTERACTION_ACCESSED = 0;
|
|
|
1872
1869
|
const INTERACTION_ASSIGNED = 1;
|
|
1873
1870
|
const INTERACTION_CALLED = 2;
|
|
1874
1871
|
const NODE_INTERACTION_UNKNOWN_ACCESS = {
|
|
1875
|
-
args: null,
|
|
1876
|
-
thisArg: null,
|
|
1872
|
+
args: [null],
|
|
1877
1873
|
type: INTERACTION_ACCESSED
|
|
1878
1874
|
};
|
|
1879
|
-
const UNKNOWN_ARG = [UNKNOWN_EXPRESSION];
|
|
1880
1875
|
const NODE_INTERACTION_UNKNOWN_ASSIGNMENT = {
|
|
1881
|
-
args:
|
|
1882
|
-
thisArg: null,
|
|
1876
|
+
args: [null, UNKNOWN_EXPRESSION],
|
|
1883
1877
|
type: INTERACTION_ASSIGNED
|
|
1884
1878
|
};
|
|
1885
|
-
const NO_ARGS = [];
|
|
1886
1879
|
// While this is technically a call without arguments, we can compare against
|
|
1887
|
-
// this reference in places where precise values or
|
|
1880
|
+
// this reference in places where precise values or this argument would make a
|
|
1888
1881
|
// difference
|
|
1889
1882
|
const NODE_INTERACTION_UNKNOWN_CALL = {
|
|
1890
|
-
args:
|
|
1891
|
-
thisArg: null,
|
|
1883
|
+
args: [null],
|
|
1892
1884
|
type: INTERACTION_CALLED,
|
|
1893
1885
|
withNew: false
|
|
1894
1886
|
};
|
|
@@ -1974,6 +1966,11 @@ class ExternalVariable extends Variable {
|
|
|
1974
1966
|
const BLANK = Object.freeze(Object.create(null));
|
|
1975
1967
|
const EMPTY_OBJECT = Object.freeze({});
|
|
1976
1968
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
1969
|
+
const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
1970
|
+
add() {
|
|
1971
|
+
throw new Error('Cannot add to empty set');
|
|
1972
|
+
}
|
|
1973
|
+
})());
|
|
1977
1974
|
|
|
1978
1975
|
function getLocator(source, options) {
|
|
1979
1976
|
if (options === void 0) { options = {}; }
|
|
@@ -5157,8 +5154,8 @@ const returnsString = {
|
|
|
5157
5154
|
const stringReplace = {
|
|
5158
5155
|
value: {
|
|
5159
5156
|
hasEffectsWhenCalled({ args }, context) {
|
|
5160
|
-
const argument1 = args[
|
|
5161
|
-
return (args.length <
|
|
5157
|
+
const argument1 = args[2];
|
|
5158
|
+
return (args.length < 3 ||
|
|
5162
5159
|
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
5163
5160
|
deoptimizeCache() { }
|
|
5164
5161
|
}) === 'symbol' &&
|
|
@@ -5856,7 +5853,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5856
5853
|
}
|
|
5857
5854
|
}
|
|
5858
5855
|
setAssignedValue(value) {
|
|
5859
|
-
this.assignmentInteraction = { args: [value],
|
|
5856
|
+
this.assignmentInteraction = { args: [null, value], type: INTERACTION_ASSIGNED };
|
|
5860
5857
|
}
|
|
5861
5858
|
shouldBeIncluded(context) {
|
|
5862
5859
|
return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
|
|
@@ -5915,19 +5912,19 @@ class Method extends ExpressionEntity {
|
|
|
5915
5912
|
super();
|
|
5916
5913
|
this.description = description;
|
|
5917
5914
|
}
|
|
5918
|
-
deoptimizeArgumentsOnInteractionAtPath({
|
|
5915
|
+
deoptimizeArgumentsOnInteractionAtPath({ args, type }, path) {
|
|
5919
5916
|
if (type === INTERACTION_CALLED && path.length === 0 && this.description.mutatesSelfAsArray) {
|
|
5920
|
-
|
|
5917
|
+
args[0]?.deoptimizePath(UNKNOWN_INTEGER_PATH);
|
|
5921
5918
|
}
|
|
5922
5919
|
}
|
|
5923
|
-
getReturnExpressionWhenCalledAtPath(path, {
|
|
5920
|
+
getReturnExpressionWhenCalledAtPath(path, { args }) {
|
|
5924
5921
|
if (path.length > 0) {
|
|
5925
5922
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
5926
5923
|
}
|
|
5927
5924
|
return [
|
|
5928
5925
|
this.description.returnsPrimitive ||
|
|
5929
5926
|
(this.description.returns === 'self'
|
|
5930
|
-
?
|
|
5927
|
+
? args[0] || UNKNOWN_EXPRESSION
|
|
5931
5928
|
: this.description.returns()),
|
|
5932
5929
|
false
|
|
5933
5930
|
];
|
|
@@ -5938,14 +5935,14 @@ class Method extends ExpressionEntity {
|
|
|
5938
5935
|
return true;
|
|
5939
5936
|
}
|
|
5940
5937
|
if (type === INTERACTION_CALLED) {
|
|
5941
|
-
const { args
|
|
5938
|
+
const { args } = interaction;
|
|
5942
5939
|
if (this.description.mutatesSelfAsArray === true &&
|
|
5943
|
-
|
|
5940
|
+
args[0]?.hasEffectsOnInteractionAtPath(UNKNOWN_INTEGER_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context)) {
|
|
5944
5941
|
return true;
|
|
5945
5942
|
}
|
|
5946
5943
|
if (this.description.callsArgs) {
|
|
5947
5944
|
for (const argumentIndex of this.description.callsArgs) {
|
|
5948
|
-
if (args[argumentIndex]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
|
|
5945
|
+
if (args[argumentIndex + 1]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
|
|
5949
5946
|
return true;
|
|
5950
5947
|
}
|
|
5951
5948
|
}
|
|
@@ -6045,18 +6042,13 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6045
6042
|
}
|
|
6046
6043
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
6047
6044
|
const [key, ...subPath] = path;
|
|
6048
|
-
const { args,
|
|
6045
|
+
const { args, type } = interaction;
|
|
6049
6046
|
if (this.hasLostTrack ||
|
|
6050
6047
|
// single paths that are deoptimized will not become getters or setters
|
|
6051
6048
|
((type === INTERACTION_CALLED || path.length > 1) &&
|
|
6052
6049
|
(this.hasUnknownDeoptimizedProperty ||
|
|
6053
6050
|
(typeof key === 'string' && this.deoptimizedPaths[key])))) {
|
|
6054
|
-
|
|
6055
|
-
if (args) {
|
|
6056
|
-
for (const argument of args) {
|
|
6057
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
6058
|
-
}
|
|
6059
|
-
}
|
|
6051
|
+
deoptimizeInteraction(interaction);
|
|
6060
6052
|
return;
|
|
6061
6053
|
}
|
|
6062
6054
|
const [propertiesForExactMatchByKey, relevantPropertiesByKey, relevantUnmatchableProperties] = type === INTERACTION_CALLED || path.length > 1
|
|
@@ -6077,11 +6069,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6077
6069
|
}
|
|
6078
6070
|
}
|
|
6079
6071
|
if (!this.immutable) {
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
}
|
|
6083
|
-
if (args) {
|
|
6084
|
-
for (const argument of args) {
|
|
6072
|
+
for (const argument of args) {
|
|
6073
|
+
if (argument) {
|
|
6085
6074
|
this.additionalExpressionsToBeDeoptimized.add(argument);
|
|
6086
6075
|
}
|
|
6087
6076
|
}
|
|
@@ -6111,11 +6100,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6111
6100
|
}
|
|
6112
6101
|
}
|
|
6113
6102
|
if (!this.immutable) {
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
}
|
|
6117
|
-
if (args) {
|
|
6118
|
-
for (const argument of args) {
|
|
6103
|
+
for (const argument of args) {
|
|
6104
|
+
if (argument) {
|
|
6119
6105
|
this.additionalExpressionsToBeDeoptimized.add(argument);
|
|
6120
6106
|
}
|
|
6121
6107
|
}
|
|
@@ -6649,7 +6635,7 @@ class LocalVariable extends Variable {
|
|
|
6649
6635
|
if (!this.isReassigned) {
|
|
6650
6636
|
this.isReassigned = true;
|
|
6651
6637
|
const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
|
|
6652
|
-
this.expressionsToBeDeoptimized =
|
|
6638
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
6653
6639
|
for (const expression of expressionsToBeDeoptimized) {
|
|
6654
6640
|
expression.deoptimizeCache();
|
|
6655
6641
|
}
|
|
@@ -6761,43 +6747,68 @@ class LocalVariable extends Variable {
|
|
|
6761
6747
|
}
|
|
6762
6748
|
}
|
|
6763
6749
|
|
|
6750
|
+
const MAX_TRACKED_INTERACTIONS = 20;
|
|
6751
|
+
const NO_INTERACTIONS = EMPTY_ARRAY;
|
|
6752
|
+
const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]);
|
|
6753
|
+
const EMPTY_PATH_TRACKER = new PathTracker();
|
|
6754
|
+
const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]);
|
|
6764
6755
|
class ParameterVariable extends LocalVariable {
|
|
6765
6756
|
constructor(name, declarator, context) {
|
|
6766
6757
|
super(name, declarator, UNKNOWN_EXPRESSION, context);
|
|
6767
6758
|
this.deoptimizationInteractions = [];
|
|
6768
|
-
this.deoptimizations = new
|
|
6759
|
+
this.deoptimizations = new PathTracker();
|
|
6769
6760
|
this.deoptimizedFields = new Set();
|
|
6770
6761
|
this.entitiesToBeDeoptimized = new Set();
|
|
6771
6762
|
}
|
|
6772
6763
|
addEntityToBeDeoptimized(entity) {
|
|
6773
|
-
if (
|
|
6764
|
+
if (entity === UNKNOWN_EXPRESSION) {
|
|
6765
|
+
// As unknown expressions fully deoptimize all interactions, we can clear
|
|
6766
|
+
// the interaction cache at this point provided we keep this optimization
|
|
6767
|
+
// in mind when adding new interactions
|
|
6768
|
+
if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
|
|
6769
|
+
this.entitiesToBeDeoptimized.add(UNKNOWN_EXPRESSION);
|
|
6770
|
+
for (const { interaction } of this.deoptimizationInteractions) {
|
|
6771
|
+
deoptimizeInteraction(interaction);
|
|
6772
|
+
}
|
|
6773
|
+
this.deoptimizationInteractions = NO_INTERACTIONS;
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
else if (this.deoptimizedFields.has(UnknownKey)) {
|
|
6777
|
+
// This means that we already deoptimized all interactions and no longer
|
|
6778
|
+
// track them
|
|
6774
6779
|
entity.deoptimizePath(UNKNOWN_PATH);
|
|
6775
6780
|
}
|
|
6776
|
-
else {
|
|
6781
|
+
else if (!this.entitiesToBeDeoptimized.has(entity)) {
|
|
6782
|
+
this.entitiesToBeDeoptimized.add(entity);
|
|
6777
6783
|
for (const field of this.deoptimizedFields) {
|
|
6778
6784
|
entity.deoptimizePath([field]);
|
|
6779
6785
|
}
|
|
6786
|
+
for (const { interaction, path } of this.deoptimizationInteractions) {
|
|
6787
|
+
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
6788
|
+
}
|
|
6780
6789
|
}
|
|
6781
|
-
for (const { interaction, path } of this.deoptimizationInteractions) {
|
|
6782
|
-
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
6783
|
-
}
|
|
6784
|
-
this.entitiesToBeDeoptimized.add(entity);
|
|
6785
6790
|
}
|
|
6786
6791
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
|
|
6787
6792
|
// For performance reasons, we fully deoptimize all deeper interactions
|
|
6788
|
-
if (path.length >= 2
|
|
6793
|
+
if (path.length >= 2 ||
|
|
6794
|
+
this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION) ||
|
|
6795
|
+
this.deoptimizationInteractions.length >= MAX_TRACKED_INTERACTIONS ||
|
|
6796
|
+
(path.length === 1 &&
|
|
6797
|
+
(this.deoptimizedFields.has(UnknownKey) ||
|
|
6798
|
+
(interaction.type === INTERACTION_CALLED && this.deoptimizedFields.has(path[0]))))) {
|
|
6789
6799
|
deoptimizeInteraction(interaction);
|
|
6790
6800
|
return;
|
|
6791
6801
|
}
|
|
6792
|
-
if (interaction.
|
|
6793
|
-
!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args, interaction.thisArg)) {
|
|
6802
|
+
if (!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args)) {
|
|
6794
6803
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
6795
6804
|
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
6796
6805
|
}
|
|
6797
|
-
this.
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6806
|
+
if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
|
|
6807
|
+
this.deoptimizationInteractions.push({
|
|
6808
|
+
interaction,
|
|
6809
|
+
path
|
|
6810
|
+
});
|
|
6811
|
+
}
|
|
6801
6812
|
}
|
|
6802
6813
|
}
|
|
6803
6814
|
deoptimizePath(path) {
|
|
@@ -6810,8 +6821,17 @@ class ParameterVariable extends LocalVariable {
|
|
|
6810
6821
|
}
|
|
6811
6822
|
this.deoptimizedFields.add(key);
|
|
6812
6823
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
6824
|
+
// We do not need a recursion tracker here as we already track whether
|
|
6825
|
+
// this field is deoptimized
|
|
6813
6826
|
entity.deoptimizePath(path);
|
|
6814
6827
|
}
|
|
6828
|
+
if (key === UnknownKey) {
|
|
6829
|
+
// save some memory
|
|
6830
|
+
this.deoptimizationInteractions = NO_INTERACTIONS;
|
|
6831
|
+
this.deoptimizations = EMPTY_PATH_TRACKER;
|
|
6832
|
+
this.deoptimizedFields = UNKNOWN_DEOPTIMIZED_FIELD;
|
|
6833
|
+
this.entitiesToBeDeoptimized = UNKNOWN_DEOPTIMIZED_ENTITY;
|
|
6834
|
+
}
|
|
6815
6835
|
}
|
|
6816
6836
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
6817
6837
|
// We deoptimize everything that is called as that will trivially deoptimize
|
|
@@ -6821,7 +6841,7 @@ class ParameterVariable extends LocalVariable {
|
|
|
6821
6841
|
this.deoptimizePath(UNKNOWN_PATH);
|
|
6822
6842
|
}
|
|
6823
6843
|
else if (!this.deoptimizedFields.has(path[0])) {
|
|
6824
|
-
this.deoptimizePath(path
|
|
6844
|
+
this.deoptimizePath([path[0]]);
|
|
6825
6845
|
}
|
|
6826
6846
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
6827
6847
|
}
|
|
@@ -7152,13 +7172,13 @@ const PF = {
|
|
|
7152
7172
|
const MUTATES_ARG_WITHOUT_ACCESSOR = {
|
|
7153
7173
|
__proto__: null,
|
|
7154
7174
|
[ValueProperties]: {
|
|
7155
|
-
deoptimizeArgumentsOnCall({ args: [firstArgument] }) {
|
|
7175
|
+
deoptimizeArgumentsOnCall({ args: [, firstArgument] }) {
|
|
7156
7176
|
firstArgument?.deoptimizePath(UNKNOWN_PATH);
|
|
7157
7177
|
},
|
|
7158
7178
|
getLiteralValue: getTruthyLiteralValue,
|
|
7159
7179
|
hasEffectsWhenCalled({ args }, context) {
|
|
7160
|
-
return (args.length
|
|
7161
|
-
args[
|
|
7180
|
+
return (args.length <= 1 ||
|
|
7181
|
+
args[1].hasEffectsOnInteractionAtPath(UNKNOWN_NON_ACCESSOR_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context));
|
|
7162
7182
|
}
|
|
7163
7183
|
}
|
|
7164
7184
|
};
|
|
@@ -8581,18 +8601,19 @@ class FunctionBase extends NodeBase {
|
|
|
8581
8601
|
const { parameters } = this.scope;
|
|
8582
8602
|
const { args } = interaction;
|
|
8583
8603
|
let hasRest = false;
|
|
8584
|
-
for (let position = 0; position < args.length; position++) {
|
|
8604
|
+
for (let position = 0; position < args.length - 1; position++) {
|
|
8585
8605
|
const parameter = this.params[position];
|
|
8606
|
+
// Only the "this" argument arg[0] can be null
|
|
8607
|
+
const argument = args[position + 1];
|
|
8586
8608
|
if (hasRest || parameter instanceof RestElement) {
|
|
8587
8609
|
hasRest = true;
|
|
8588
|
-
|
|
8610
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
8589
8611
|
}
|
|
8590
8612
|
else if (parameter instanceof Identifier) {
|
|
8591
|
-
|
|
8592
|
-
parameters[position][0].addEntityToBeDeoptimized(args[position]);
|
|
8613
|
+
parameters[position][0].addEntityToBeDeoptimized(argument);
|
|
8593
8614
|
}
|
|
8594
8615
|
else if (parameter) {
|
|
8595
|
-
|
|
8616
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
8596
8617
|
}
|
|
8597
8618
|
}
|
|
8598
8619
|
}
|
|
@@ -8974,8 +8995,9 @@ class FunctionNode extends FunctionBase {
|
|
|
8974
8995
|
}
|
|
8975
8996
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
8976
8997
|
super.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
8977
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.
|
|
8978
|
-
this
|
|
8998
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.args[0]) {
|
|
8999
|
+
// args[0] is the "this" argument
|
|
9000
|
+
this.scope.thisVariable.addEntityToBeDeoptimized(interaction.args[0]);
|
|
8979
9001
|
}
|
|
8980
9002
|
}
|
|
8981
9003
|
hasEffects(context) {
|
|
@@ -9305,10 +9327,10 @@ class MemberExpression extends NodeBase {
|
|
|
9305
9327
|
}
|
|
9306
9328
|
}
|
|
9307
9329
|
deoptimizeCache() {
|
|
9308
|
-
const expressionsToBeDeoptimized = this
|
|
9309
|
-
this.expressionsToBeDeoptimized =
|
|
9330
|
+
const { expressionsToBeDeoptimized, object } = this;
|
|
9331
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
9310
9332
|
this.propertyKey = UnknownKey;
|
|
9311
|
-
|
|
9333
|
+
object.deoptimizePath(UNKNOWN_PATH);
|
|
9312
9334
|
for (const expression of expressionsToBeDeoptimized) {
|
|
9313
9335
|
expression.deoptimizeCache();
|
|
9314
9336
|
}
|
|
@@ -9334,8 +9356,8 @@ class MemberExpression extends NodeBase {
|
|
|
9334
9356
|
if (this.isUndefined) {
|
|
9335
9357
|
return undefined;
|
|
9336
9358
|
}
|
|
9337
|
-
this.
|
|
9338
|
-
|
|
9359
|
+
if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
|
|
9360
|
+
this.expressionsToBeDeoptimized.push(origin);
|
|
9339
9361
|
return this.object.getLiteralValueAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
|
|
9340
9362
|
}
|
|
9341
9363
|
return UnknownValue;
|
|
@@ -9347,8 +9369,8 @@ class MemberExpression extends NodeBase {
|
|
|
9347
9369
|
if (this.isUndefined) {
|
|
9348
9370
|
return [UNDEFINED_EXPRESSION, false];
|
|
9349
9371
|
}
|
|
9350
|
-
this.
|
|
9351
|
-
|
|
9372
|
+
if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
|
|
9373
|
+
this.expressionsToBeDeoptimized.push(origin);
|
|
9352
9374
|
return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], interaction, recursionTracker, origin);
|
|
9353
9375
|
}
|
|
9354
9376
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
@@ -9407,7 +9429,7 @@ class MemberExpression extends NodeBase {
|
|
|
9407
9429
|
}
|
|
9408
9430
|
initialise() {
|
|
9409
9431
|
this.propertyKey = getResolvablePropertyKey(this);
|
|
9410
|
-
this.accessInteraction = { args:
|
|
9432
|
+
this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
|
|
9411
9433
|
}
|
|
9412
9434
|
isSkippedAsOptional(origin) {
|
|
9413
9435
|
return (!this.variable &&
|
|
@@ -9437,8 +9459,7 @@ class MemberExpression extends NodeBase {
|
|
|
9437
9459
|
}
|
|
9438
9460
|
setAssignedValue(value) {
|
|
9439
9461
|
this.assignmentInteraction = {
|
|
9440
|
-
args: [value],
|
|
9441
|
-
thisArg: this.object,
|
|
9462
|
+
args: [this.object, value],
|
|
9442
9463
|
type: INTERACTION_ASSIGNED
|
|
9443
9464
|
};
|
|
9444
9465
|
}
|
|
@@ -9538,27 +9559,22 @@ class CallExpressionBase extends NodeBase {
|
|
|
9538
9559
|
this.expressionsToBeDeoptimized = new Set();
|
|
9539
9560
|
}
|
|
9540
9561
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
9541
|
-
const { args
|
|
9562
|
+
const { args } = interaction;
|
|
9542
9563
|
const [returnExpression, isPure] = this.getReturnExpression(recursionTracker);
|
|
9543
9564
|
if (isPure)
|
|
9544
9565
|
return;
|
|
9566
|
+
const deoptimizedExpressions = args.filter(expression => !!expression && expression !== UNKNOWN_EXPRESSION);
|
|
9567
|
+
if (deoptimizedExpressions.length === 0)
|
|
9568
|
+
return;
|
|
9545
9569
|
if (returnExpression === UNKNOWN_EXPRESSION) {
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
for (const argument of args) {
|
|
9549
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
9550
|
-
}
|
|
9570
|
+
for (const expression of deoptimizedExpressions) {
|
|
9571
|
+
expression.deoptimizePath(UNKNOWN_PATH);
|
|
9551
9572
|
}
|
|
9552
9573
|
}
|
|
9553
9574
|
else {
|
|
9554
9575
|
recursionTracker.withTrackedEntityAtPath(path, returnExpression, () => {
|
|
9555
|
-
|
|
9556
|
-
this.expressionsToBeDeoptimized.add(
|
|
9557
|
-
}
|
|
9558
|
-
if (args) {
|
|
9559
|
-
for (const argument of args) {
|
|
9560
|
-
this.expressionsToBeDeoptimized.add(argument);
|
|
9561
|
-
}
|
|
9576
|
+
for (const expression of deoptimizedExpressions) {
|
|
9577
|
+
this.expressionsToBeDeoptimized.add(expression);
|
|
9562
9578
|
}
|
|
9563
9579
|
returnExpression.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
9564
9580
|
}, null);
|
|
@@ -9567,10 +9583,13 @@ class CallExpressionBase extends NodeBase {
|
|
|
9567
9583
|
deoptimizeCache() {
|
|
9568
9584
|
if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
|
|
9569
9585
|
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
9570
|
-
|
|
9586
|
+
const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
|
|
9587
|
+
this.expressionsToBeDeoptimized = EMPTY_SET;
|
|
9588
|
+
this.deoptimizableDependentExpressions = EMPTY_ARRAY;
|
|
9589
|
+
for (const expression of deoptimizableDependentExpressions) {
|
|
9571
9590
|
expression.deoptimizeCache();
|
|
9572
9591
|
}
|
|
9573
|
-
for (const expression of
|
|
9592
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
9574
9593
|
expression.deoptimizePath(UNKNOWN_PATH);
|
|
9575
9594
|
}
|
|
9576
9595
|
}
|
|
@@ -9638,10 +9657,12 @@ class CallExpression extends CallExpressionBase {
|
|
|
9638
9657
|
}
|
|
9639
9658
|
}
|
|
9640
9659
|
this.interaction = {
|
|
9641
|
-
args:
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9660
|
+
args: [
|
|
9661
|
+
this.callee instanceof MemberExpression && !this.callee.variable
|
|
9662
|
+
? this.callee.object
|
|
9663
|
+
: null,
|
|
9664
|
+
...this.arguments
|
|
9665
|
+
],
|
|
9645
9666
|
type: INTERACTION_CALLED,
|
|
9646
9667
|
withNew: false
|
|
9647
9668
|
};
|
|
@@ -9794,8 +9815,7 @@ class MethodBase extends NodeBase {
|
|
|
9794
9815
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
9795
9816
|
if (interaction.type === INTERACTION_ACCESSED && this.kind === 'get' && path.length === 0) {
|
|
9796
9817
|
return this.value.deoptimizeArgumentsOnInteractionAtPath({
|
|
9797
|
-
args:
|
|
9798
|
-
thisArg: interaction.thisArg,
|
|
9818
|
+
args: interaction.args,
|
|
9799
9819
|
type: INTERACTION_CALLED,
|
|
9800
9820
|
withNew: false
|
|
9801
9821
|
}, EMPTY_PATH, recursionTracker);
|
|
@@ -9803,7 +9823,6 @@ class MethodBase extends NodeBase {
|
|
|
9803
9823
|
if (interaction.type === INTERACTION_ASSIGNED && this.kind === 'set' && path.length === 0) {
|
|
9804
9824
|
return this.value.deoptimizeArgumentsOnInteractionAtPath({
|
|
9805
9825
|
args: interaction.args,
|
|
9806
|
-
thisArg: interaction.thisArg,
|
|
9807
9826
|
type: INTERACTION_CALLED,
|
|
9808
9827
|
withNew: false
|
|
9809
9828
|
}, EMPTY_PATH, recursionTracker);
|
|
@@ -9828,8 +9847,7 @@ class MethodBase extends NodeBase {
|
|
|
9828
9847
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
9829
9848
|
if (this.kind === 'get' && interaction.type === INTERACTION_ACCESSED && path.length === 0) {
|
|
9830
9849
|
return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
|
|
9831
|
-
args:
|
|
9832
|
-
thisArg: interaction.thisArg,
|
|
9850
|
+
args: interaction.args,
|
|
9833
9851
|
type: INTERACTION_CALLED,
|
|
9834
9852
|
withNew: false
|
|
9835
9853
|
}, context);
|
|
@@ -9838,7 +9856,6 @@ class MethodBase extends NodeBase {
|
|
|
9838
9856
|
if (this.kind === 'set' && interaction.type === INTERACTION_ASSIGNED) {
|
|
9839
9857
|
return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
|
|
9840
9858
|
args: interaction.args,
|
|
9841
|
-
thisArg: interaction.thisArg,
|
|
9842
9859
|
type: INTERACTION_CALLED,
|
|
9843
9860
|
withNew: false
|
|
9844
9861
|
}, context);
|
|
@@ -10099,7 +10116,9 @@ class ConditionalExpression extends NodeBase {
|
|
|
10099
10116
|
const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
|
|
10100
10117
|
this.usedBranch = null;
|
|
10101
10118
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
10102
|
-
|
|
10119
|
+
const { expressionsToBeDeoptimized } = this;
|
|
10120
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
10121
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
10103
10122
|
expression.deoptimizeCache();
|
|
10104
10123
|
}
|
|
10105
10124
|
}
|
|
@@ -11231,12 +11250,14 @@ class LogicalExpression extends NodeBase {
|
|
|
11231
11250
|
const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
|
|
11232
11251
|
this.usedBranch = null;
|
|
11233
11252
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
11234
|
-
|
|
11253
|
+
const { context, expressionsToBeDeoptimized } = this;
|
|
11254
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
11255
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
11235
11256
|
expression.deoptimizeCache();
|
|
11236
11257
|
}
|
|
11237
11258
|
// Request another pass because we need to ensure "include" runs again if
|
|
11238
11259
|
// it is rendered
|
|
11239
|
-
|
|
11260
|
+
context.requestTreeshakingPass();
|
|
11240
11261
|
}
|
|
11241
11262
|
}
|
|
11242
11263
|
deoptimizePath(path) {
|
|
@@ -11506,8 +11527,7 @@ class NewExpression extends NodeBase {
|
|
|
11506
11527
|
}
|
|
11507
11528
|
initialise() {
|
|
11508
11529
|
this.interaction = {
|
|
11509
|
-
args: this.arguments,
|
|
11510
|
-
thisArg: null,
|
|
11530
|
+
args: [null, ...this.arguments],
|
|
11511
11531
|
type: INTERACTION_CALLED,
|
|
11512
11532
|
withNew: true
|
|
11513
11533
|
};
|
|
@@ -12026,16 +12046,19 @@ class TaggedTemplateExpression extends CallExpressionBase {
|
|
|
12026
12046
|
this.tag.include(context, includeChildrenRecursively);
|
|
12027
12047
|
this.quasi.include(context, includeChildrenRecursively);
|
|
12028
12048
|
}
|
|
12029
|
-
this.tag.includeCallArguments(context, this.
|
|
12049
|
+
this.tag.includeCallArguments(context, this.args);
|
|
12030
12050
|
const [returnExpression] = this.getReturnExpression();
|
|
12031
12051
|
if (!returnExpression.included) {
|
|
12032
12052
|
returnExpression.include(context, false);
|
|
12033
12053
|
}
|
|
12034
12054
|
}
|
|
12035
12055
|
initialise() {
|
|
12056
|
+
this.args = [UNKNOWN_EXPRESSION, ...this.quasi.expressions];
|
|
12036
12057
|
this.interaction = {
|
|
12037
|
-
args: [
|
|
12038
|
-
|
|
12058
|
+
args: [
|
|
12059
|
+
this.tag instanceof MemberExpression && !this.tag.variable ? this.tag.object : null,
|
|
12060
|
+
...this.args
|
|
12061
|
+
],
|
|
12039
12062
|
type: INTERACTION_CALLED,
|
|
12040
12063
|
withNew: false
|
|
12041
12064
|
};
|
|
@@ -12220,8 +12243,7 @@ class ThisExpression extends NodeBase {
|
|
|
12220
12243
|
this.variable = this.scope.findVariable('this');
|
|
12221
12244
|
}
|
|
12222
12245
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
12223
|
-
|
|
12224
|
-
this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction.thisArg === this ? { ...interaction, thisArg: this.variable } : interaction, path, recursionTracker);
|
|
12246
|
+
this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
12225
12247
|
}
|
|
12226
12248
|
deoptimizePath(path) {
|
|
12227
12249
|
this.variable.deoptimizePath(path);
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.20.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.20.3
|
|
4
|
+
Sun, 16 Apr 2023 13:03:29 GMT - commit bd675b104147594767b56df2756426d032a68583
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.20.
|
|
34
|
+
var version$1 = "3.20.3";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -91,6 +91,11 @@ async function asyncFlatten(array) {
|
|
|
91
91
|
const BLANK = Object.freeze(Object.create(null));
|
|
92
92
|
const EMPTY_OBJECT = Object.freeze({});
|
|
93
93
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
94
|
+
const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
95
|
+
add() {
|
|
96
|
+
throw new Error('Cannot add to empty set');
|
|
97
|
+
}
|
|
98
|
+
})());
|
|
94
99
|
|
|
95
100
|
function getLocator$1(source, options) {
|
|
96
101
|
if (options === void 0) { options = {}; }
|
|
@@ -3060,11 +3065,8 @@ const UNKNOWN_RETURN_EXPRESSION = [
|
|
|
3060
3065
|
false
|
|
3061
3066
|
];
|
|
3062
3067
|
const deoptimizeInteraction = (interaction) => {
|
|
3063
|
-
interaction.
|
|
3064
|
-
|
|
3065
|
-
for (const argument of interaction.args) {
|
|
3066
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
3067
|
-
}
|
|
3068
|
+
for (const argument of interaction.args) {
|
|
3069
|
+
argument?.deoptimizePath(UNKNOWN_PATH);
|
|
3068
3070
|
}
|
|
3069
3071
|
};
|
|
3070
3072
|
|
|
@@ -3072,23 +3074,18 @@ const INTERACTION_ACCESSED = 0;
|
|
|
3072
3074
|
const INTERACTION_ASSIGNED = 1;
|
|
3073
3075
|
const INTERACTION_CALLED = 2;
|
|
3074
3076
|
const NODE_INTERACTION_UNKNOWN_ACCESS = {
|
|
3075
|
-
args: null,
|
|
3076
|
-
thisArg: null,
|
|
3077
|
+
args: [null],
|
|
3077
3078
|
type: INTERACTION_ACCESSED
|
|
3078
3079
|
};
|
|
3079
|
-
const UNKNOWN_ARG = [UNKNOWN_EXPRESSION];
|
|
3080
3080
|
const NODE_INTERACTION_UNKNOWN_ASSIGNMENT = {
|
|
3081
|
-
args:
|
|
3082
|
-
thisArg: null,
|
|
3081
|
+
args: [null, UNKNOWN_EXPRESSION],
|
|
3083
3082
|
type: INTERACTION_ASSIGNED
|
|
3084
3083
|
};
|
|
3085
|
-
const NO_ARGS = [];
|
|
3086
3084
|
// While this is technically a call without arguments, we can compare against
|
|
3087
|
-
// this reference in places where precise values or
|
|
3085
|
+
// this reference in places where precise values or this argument would make a
|
|
3088
3086
|
// difference
|
|
3089
3087
|
const NODE_INTERACTION_UNKNOWN_CALL = {
|
|
3090
|
-
args:
|
|
3091
|
-
thisArg: null,
|
|
3088
|
+
args: [null],
|
|
3092
3089
|
type: INTERACTION_CALLED,
|
|
3093
3090
|
withNew: false
|
|
3094
3091
|
};
|
|
@@ -5655,8 +5652,8 @@ const returnsString = {
|
|
|
5655
5652
|
const stringReplace = {
|
|
5656
5653
|
value: {
|
|
5657
5654
|
hasEffectsWhenCalled({ args }, context) {
|
|
5658
|
-
const argument1 = args[
|
|
5659
|
-
return (args.length <
|
|
5655
|
+
const argument1 = args[2];
|
|
5656
|
+
return (args.length < 3 ||
|
|
5660
5657
|
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
5661
5658
|
deoptimizeCache() { }
|
|
5662
5659
|
}) === 'symbol' &&
|
|
@@ -6354,7 +6351,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
6354
6351
|
}
|
|
6355
6352
|
}
|
|
6356
6353
|
setAssignedValue(value) {
|
|
6357
|
-
this.assignmentInteraction = { args: [value],
|
|
6354
|
+
this.assignmentInteraction = { args: [null, value], type: INTERACTION_ASSIGNED };
|
|
6358
6355
|
}
|
|
6359
6356
|
shouldBeIncluded(context) {
|
|
6360
6357
|
return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
|
|
@@ -6413,19 +6410,19 @@ class Method extends ExpressionEntity {
|
|
|
6413
6410
|
super();
|
|
6414
6411
|
this.description = description;
|
|
6415
6412
|
}
|
|
6416
|
-
deoptimizeArgumentsOnInteractionAtPath({
|
|
6413
|
+
deoptimizeArgumentsOnInteractionAtPath({ args, type }, path) {
|
|
6417
6414
|
if (type === INTERACTION_CALLED && path.length === 0 && this.description.mutatesSelfAsArray) {
|
|
6418
|
-
|
|
6415
|
+
args[0]?.deoptimizePath(UNKNOWN_INTEGER_PATH);
|
|
6419
6416
|
}
|
|
6420
6417
|
}
|
|
6421
|
-
getReturnExpressionWhenCalledAtPath(path, {
|
|
6418
|
+
getReturnExpressionWhenCalledAtPath(path, { args }) {
|
|
6422
6419
|
if (path.length > 0) {
|
|
6423
6420
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
6424
6421
|
}
|
|
6425
6422
|
return [
|
|
6426
6423
|
this.description.returnsPrimitive ||
|
|
6427
6424
|
(this.description.returns === 'self'
|
|
6428
|
-
?
|
|
6425
|
+
? args[0] || UNKNOWN_EXPRESSION
|
|
6429
6426
|
: this.description.returns()),
|
|
6430
6427
|
false
|
|
6431
6428
|
];
|
|
@@ -6436,14 +6433,14 @@ class Method extends ExpressionEntity {
|
|
|
6436
6433
|
return true;
|
|
6437
6434
|
}
|
|
6438
6435
|
if (type === INTERACTION_CALLED) {
|
|
6439
|
-
const { args
|
|
6436
|
+
const { args } = interaction;
|
|
6440
6437
|
if (this.description.mutatesSelfAsArray === true &&
|
|
6441
|
-
|
|
6438
|
+
args[0]?.hasEffectsOnInteractionAtPath(UNKNOWN_INTEGER_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context)) {
|
|
6442
6439
|
return true;
|
|
6443
6440
|
}
|
|
6444
6441
|
if (this.description.callsArgs) {
|
|
6445
6442
|
for (const argumentIndex of this.description.callsArgs) {
|
|
6446
|
-
if (args[argumentIndex]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
|
|
6443
|
+
if (args[argumentIndex + 1]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
|
|
6447
6444
|
return true;
|
|
6448
6445
|
}
|
|
6449
6446
|
}
|
|
@@ -6543,18 +6540,13 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6543
6540
|
}
|
|
6544
6541
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
6545
6542
|
const [key, ...subPath] = path;
|
|
6546
|
-
const { args,
|
|
6543
|
+
const { args, type } = interaction;
|
|
6547
6544
|
if (this.hasLostTrack ||
|
|
6548
6545
|
// single paths that are deoptimized will not become getters or setters
|
|
6549
6546
|
((type === INTERACTION_CALLED || path.length > 1) &&
|
|
6550
6547
|
(this.hasUnknownDeoptimizedProperty ||
|
|
6551
6548
|
(typeof key === 'string' && this.deoptimizedPaths[key])))) {
|
|
6552
|
-
|
|
6553
|
-
if (args) {
|
|
6554
|
-
for (const argument of args) {
|
|
6555
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
6556
|
-
}
|
|
6557
|
-
}
|
|
6549
|
+
deoptimizeInteraction(interaction);
|
|
6558
6550
|
return;
|
|
6559
6551
|
}
|
|
6560
6552
|
const [propertiesForExactMatchByKey, relevantPropertiesByKey, relevantUnmatchableProperties] = type === INTERACTION_CALLED || path.length > 1
|
|
@@ -6575,11 +6567,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6575
6567
|
}
|
|
6576
6568
|
}
|
|
6577
6569
|
if (!this.immutable) {
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
}
|
|
6581
|
-
if (args) {
|
|
6582
|
-
for (const argument of args) {
|
|
6570
|
+
for (const argument of args) {
|
|
6571
|
+
if (argument) {
|
|
6583
6572
|
this.additionalExpressionsToBeDeoptimized.add(argument);
|
|
6584
6573
|
}
|
|
6585
6574
|
}
|
|
@@ -6609,11 +6598,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6609
6598
|
}
|
|
6610
6599
|
}
|
|
6611
6600
|
if (!this.immutable) {
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
}
|
|
6615
|
-
if (args) {
|
|
6616
|
-
for (const argument of args) {
|
|
6601
|
+
for (const argument of args) {
|
|
6602
|
+
if (argument) {
|
|
6617
6603
|
this.additionalExpressionsToBeDeoptimized.add(argument);
|
|
6618
6604
|
}
|
|
6619
6605
|
}
|
|
@@ -7147,7 +7133,7 @@ class LocalVariable extends Variable {
|
|
|
7147
7133
|
if (!this.isReassigned) {
|
|
7148
7134
|
this.isReassigned = true;
|
|
7149
7135
|
const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
|
|
7150
|
-
this.expressionsToBeDeoptimized =
|
|
7136
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
7151
7137
|
for (const expression of expressionsToBeDeoptimized) {
|
|
7152
7138
|
expression.deoptimizeCache();
|
|
7153
7139
|
}
|
|
@@ -7259,43 +7245,68 @@ class LocalVariable extends Variable {
|
|
|
7259
7245
|
}
|
|
7260
7246
|
}
|
|
7261
7247
|
|
|
7248
|
+
const MAX_TRACKED_INTERACTIONS = 20;
|
|
7249
|
+
const NO_INTERACTIONS = EMPTY_ARRAY;
|
|
7250
|
+
const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]);
|
|
7251
|
+
const EMPTY_PATH_TRACKER = new PathTracker();
|
|
7252
|
+
const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]);
|
|
7262
7253
|
class ParameterVariable extends LocalVariable {
|
|
7263
7254
|
constructor(name, declarator, context) {
|
|
7264
7255
|
super(name, declarator, UNKNOWN_EXPRESSION, context);
|
|
7265
7256
|
this.deoptimizationInteractions = [];
|
|
7266
|
-
this.deoptimizations = new
|
|
7257
|
+
this.deoptimizations = new PathTracker();
|
|
7267
7258
|
this.deoptimizedFields = new Set();
|
|
7268
7259
|
this.entitiesToBeDeoptimized = new Set();
|
|
7269
7260
|
}
|
|
7270
7261
|
addEntityToBeDeoptimized(entity) {
|
|
7271
|
-
if (
|
|
7262
|
+
if (entity === UNKNOWN_EXPRESSION) {
|
|
7263
|
+
// As unknown expressions fully deoptimize all interactions, we can clear
|
|
7264
|
+
// the interaction cache at this point provided we keep this optimization
|
|
7265
|
+
// in mind when adding new interactions
|
|
7266
|
+
if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
|
|
7267
|
+
this.entitiesToBeDeoptimized.add(UNKNOWN_EXPRESSION);
|
|
7268
|
+
for (const { interaction } of this.deoptimizationInteractions) {
|
|
7269
|
+
deoptimizeInteraction(interaction);
|
|
7270
|
+
}
|
|
7271
|
+
this.deoptimizationInteractions = NO_INTERACTIONS;
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
else if (this.deoptimizedFields.has(UnknownKey)) {
|
|
7275
|
+
// This means that we already deoptimized all interactions and no longer
|
|
7276
|
+
// track them
|
|
7272
7277
|
entity.deoptimizePath(UNKNOWN_PATH);
|
|
7273
7278
|
}
|
|
7274
|
-
else {
|
|
7279
|
+
else if (!this.entitiesToBeDeoptimized.has(entity)) {
|
|
7280
|
+
this.entitiesToBeDeoptimized.add(entity);
|
|
7275
7281
|
for (const field of this.deoptimizedFields) {
|
|
7276
7282
|
entity.deoptimizePath([field]);
|
|
7277
7283
|
}
|
|
7284
|
+
for (const { interaction, path } of this.deoptimizationInteractions) {
|
|
7285
|
+
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
7286
|
+
}
|
|
7278
7287
|
}
|
|
7279
|
-
for (const { interaction, path } of this.deoptimizationInteractions) {
|
|
7280
|
-
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
7281
|
-
}
|
|
7282
|
-
this.entitiesToBeDeoptimized.add(entity);
|
|
7283
7288
|
}
|
|
7284
7289
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
|
|
7285
7290
|
// For performance reasons, we fully deoptimize all deeper interactions
|
|
7286
|
-
if (path.length >= 2
|
|
7291
|
+
if (path.length >= 2 ||
|
|
7292
|
+
this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION) ||
|
|
7293
|
+
this.deoptimizationInteractions.length >= MAX_TRACKED_INTERACTIONS ||
|
|
7294
|
+
(path.length === 1 &&
|
|
7295
|
+
(this.deoptimizedFields.has(UnknownKey) ||
|
|
7296
|
+
(interaction.type === INTERACTION_CALLED && this.deoptimizedFields.has(path[0]))))) {
|
|
7287
7297
|
deoptimizeInteraction(interaction);
|
|
7288
7298
|
return;
|
|
7289
7299
|
}
|
|
7290
|
-
if (interaction.
|
|
7291
|
-
!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args, interaction.thisArg)) {
|
|
7300
|
+
if (!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args)) {
|
|
7292
7301
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
7293
7302
|
entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
|
|
7294
7303
|
}
|
|
7295
|
-
this.
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7304
|
+
if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
|
|
7305
|
+
this.deoptimizationInteractions.push({
|
|
7306
|
+
interaction,
|
|
7307
|
+
path
|
|
7308
|
+
});
|
|
7309
|
+
}
|
|
7299
7310
|
}
|
|
7300
7311
|
}
|
|
7301
7312
|
deoptimizePath(path) {
|
|
@@ -7308,8 +7319,17 @@ class ParameterVariable extends LocalVariable {
|
|
|
7308
7319
|
}
|
|
7309
7320
|
this.deoptimizedFields.add(key);
|
|
7310
7321
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
7322
|
+
// We do not need a recursion tracker here as we already track whether
|
|
7323
|
+
// this field is deoptimized
|
|
7311
7324
|
entity.deoptimizePath(path);
|
|
7312
7325
|
}
|
|
7326
|
+
if (key === UnknownKey) {
|
|
7327
|
+
// save some memory
|
|
7328
|
+
this.deoptimizationInteractions = NO_INTERACTIONS;
|
|
7329
|
+
this.deoptimizations = EMPTY_PATH_TRACKER;
|
|
7330
|
+
this.deoptimizedFields = UNKNOWN_DEOPTIMIZED_FIELD;
|
|
7331
|
+
this.entitiesToBeDeoptimized = UNKNOWN_DEOPTIMIZED_ENTITY;
|
|
7332
|
+
}
|
|
7313
7333
|
}
|
|
7314
7334
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
7315
7335
|
// We deoptimize everything that is called as that will trivially deoptimize
|
|
@@ -7319,7 +7339,7 @@ class ParameterVariable extends LocalVariable {
|
|
|
7319
7339
|
this.deoptimizePath(UNKNOWN_PATH);
|
|
7320
7340
|
}
|
|
7321
7341
|
else if (!this.deoptimizedFields.has(path[0])) {
|
|
7322
|
-
this.deoptimizePath(path
|
|
7342
|
+
this.deoptimizePath([path[0]]);
|
|
7323
7343
|
}
|
|
7324
7344
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
7325
7345
|
}
|
|
@@ -7650,13 +7670,13 @@ const PF = {
|
|
|
7650
7670
|
const MUTATES_ARG_WITHOUT_ACCESSOR = {
|
|
7651
7671
|
__proto__: null,
|
|
7652
7672
|
[ValueProperties]: {
|
|
7653
|
-
deoptimizeArgumentsOnCall({ args: [firstArgument] }) {
|
|
7673
|
+
deoptimizeArgumentsOnCall({ args: [, firstArgument] }) {
|
|
7654
7674
|
firstArgument?.deoptimizePath(UNKNOWN_PATH);
|
|
7655
7675
|
},
|
|
7656
7676
|
getLiteralValue: getTruthyLiteralValue,
|
|
7657
7677
|
hasEffectsWhenCalled({ args }, context) {
|
|
7658
|
-
return (args.length
|
|
7659
|
-
args[
|
|
7678
|
+
return (args.length <= 1 ||
|
|
7679
|
+
args[1].hasEffectsOnInteractionAtPath(UNKNOWN_NON_ACCESSOR_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context));
|
|
7660
7680
|
}
|
|
7661
7681
|
}
|
|
7662
7682
|
};
|
|
@@ -9079,18 +9099,19 @@ class FunctionBase extends NodeBase {
|
|
|
9079
9099
|
const { parameters } = this.scope;
|
|
9080
9100
|
const { args } = interaction;
|
|
9081
9101
|
let hasRest = false;
|
|
9082
|
-
for (let position = 0; position < args.length; position++) {
|
|
9102
|
+
for (let position = 0; position < args.length - 1; position++) {
|
|
9083
9103
|
const parameter = this.params[position];
|
|
9104
|
+
// Only the "this" argument arg[0] can be null
|
|
9105
|
+
const argument = args[position + 1];
|
|
9084
9106
|
if (hasRest || parameter instanceof RestElement) {
|
|
9085
9107
|
hasRest = true;
|
|
9086
|
-
|
|
9108
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
9087
9109
|
}
|
|
9088
9110
|
else if (parameter instanceof Identifier) {
|
|
9089
|
-
|
|
9090
|
-
parameters[position][0].addEntityToBeDeoptimized(args[position]);
|
|
9111
|
+
parameters[position][0].addEntityToBeDeoptimized(argument);
|
|
9091
9112
|
}
|
|
9092
9113
|
else if (parameter) {
|
|
9093
|
-
|
|
9114
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
9094
9115
|
}
|
|
9095
9116
|
}
|
|
9096
9117
|
}
|
|
@@ -9472,8 +9493,9 @@ class FunctionNode extends FunctionBase {
|
|
|
9472
9493
|
}
|
|
9473
9494
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
9474
9495
|
super.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
9475
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.
|
|
9476
|
-
this
|
|
9496
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.args[0]) {
|
|
9497
|
+
// args[0] is the "this" argument
|
|
9498
|
+
this.scope.thisVariable.addEntityToBeDeoptimized(interaction.args[0]);
|
|
9477
9499
|
}
|
|
9478
9500
|
}
|
|
9479
9501
|
hasEffects(context) {
|
|
@@ -9803,10 +9825,10 @@ class MemberExpression extends NodeBase {
|
|
|
9803
9825
|
}
|
|
9804
9826
|
}
|
|
9805
9827
|
deoptimizeCache() {
|
|
9806
|
-
const expressionsToBeDeoptimized = this
|
|
9807
|
-
this.expressionsToBeDeoptimized =
|
|
9828
|
+
const { expressionsToBeDeoptimized, object } = this;
|
|
9829
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
9808
9830
|
this.propertyKey = UnknownKey;
|
|
9809
|
-
|
|
9831
|
+
object.deoptimizePath(UNKNOWN_PATH);
|
|
9810
9832
|
for (const expression of expressionsToBeDeoptimized) {
|
|
9811
9833
|
expression.deoptimizeCache();
|
|
9812
9834
|
}
|
|
@@ -9832,8 +9854,8 @@ class MemberExpression extends NodeBase {
|
|
|
9832
9854
|
if (this.isUndefined) {
|
|
9833
9855
|
return undefined;
|
|
9834
9856
|
}
|
|
9835
|
-
this.
|
|
9836
|
-
|
|
9857
|
+
if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
|
|
9858
|
+
this.expressionsToBeDeoptimized.push(origin);
|
|
9837
9859
|
return this.object.getLiteralValueAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
|
|
9838
9860
|
}
|
|
9839
9861
|
return UnknownValue;
|
|
@@ -9845,8 +9867,8 @@ class MemberExpression extends NodeBase {
|
|
|
9845
9867
|
if (this.isUndefined) {
|
|
9846
9868
|
return [UNDEFINED_EXPRESSION, false];
|
|
9847
9869
|
}
|
|
9848
|
-
this.
|
|
9849
|
-
|
|
9870
|
+
if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
|
|
9871
|
+
this.expressionsToBeDeoptimized.push(origin);
|
|
9850
9872
|
return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], interaction, recursionTracker, origin);
|
|
9851
9873
|
}
|
|
9852
9874
|
return UNKNOWN_RETURN_EXPRESSION;
|
|
@@ -9905,7 +9927,7 @@ class MemberExpression extends NodeBase {
|
|
|
9905
9927
|
}
|
|
9906
9928
|
initialise() {
|
|
9907
9929
|
this.propertyKey = getResolvablePropertyKey(this);
|
|
9908
|
-
this.accessInteraction = { args:
|
|
9930
|
+
this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
|
|
9909
9931
|
}
|
|
9910
9932
|
isSkippedAsOptional(origin) {
|
|
9911
9933
|
return (!this.variable &&
|
|
@@ -9935,8 +9957,7 @@ class MemberExpression extends NodeBase {
|
|
|
9935
9957
|
}
|
|
9936
9958
|
setAssignedValue(value) {
|
|
9937
9959
|
this.assignmentInteraction = {
|
|
9938
|
-
args: [value],
|
|
9939
|
-
thisArg: this.object,
|
|
9960
|
+
args: [this.object, value],
|
|
9940
9961
|
type: INTERACTION_ASSIGNED
|
|
9941
9962
|
};
|
|
9942
9963
|
}
|
|
@@ -10036,27 +10057,22 @@ class CallExpressionBase extends NodeBase {
|
|
|
10036
10057
|
this.expressionsToBeDeoptimized = new Set();
|
|
10037
10058
|
}
|
|
10038
10059
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
10039
|
-
const { args
|
|
10060
|
+
const { args } = interaction;
|
|
10040
10061
|
const [returnExpression, isPure] = this.getReturnExpression(recursionTracker);
|
|
10041
10062
|
if (isPure)
|
|
10042
10063
|
return;
|
|
10064
|
+
const deoptimizedExpressions = args.filter(expression => !!expression && expression !== UNKNOWN_EXPRESSION);
|
|
10065
|
+
if (deoptimizedExpressions.length === 0)
|
|
10066
|
+
return;
|
|
10043
10067
|
if (returnExpression === UNKNOWN_EXPRESSION) {
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
for (const argument of args) {
|
|
10047
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
10048
|
-
}
|
|
10068
|
+
for (const expression of deoptimizedExpressions) {
|
|
10069
|
+
expression.deoptimizePath(UNKNOWN_PATH);
|
|
10049
10070
|
}
|
|
10050
10071
|
}
|
|
10051
10072
|
else {
|
|
10052
10073
|
recursionTracker.withTrackedEntityAtPath(path, returnExpression, () => {
|
|
10053
|
-
|
|
10054
|
-
this.expressionsToBeDeoptimized.add(
|
|
10055
|
-
}
|
|
10056
|
-
if (args) {
|
|
10057
|
-
for (const argument of args) {
|
|
10058
|
-
this.expressionsToBeDeoptimized.add(argument);
|
|
10059
|
-
}
|
|
10074
|
+
for (const expression of deoptimizedExpressions) {
|
|
10075
|
+
this.expressionsToBeDeoptimized.add(expression);
|
|
10060
10076
|
}
|
|
10061
10077
|
returnExpression.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
10062
10078
|
}, null);
|
|
@@ -10065,10 +10081,13 @@ class CallExpressionBase extends NodeBase {
|
|
|
10065
10081
|
deoptimizeCache() {
|
|
10066
10082
|
if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
|
|
10067
10083
|
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
10068
|
-
|
|
10084
|
+
const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
|
|
10085
|
+
this.expressionsToBeDeoptimized = EMPTY_SET;
|
|
10086
|
+
this.deoptimizableDependentExpressions = EMPTY_ARRAY;
|
|
10087
|
+
for (const expression of deoptimizableDependentExpressions) {
|
|
10069
10088
|
expression.deoptimizeCache();
|
|
10070
10089
|
}
|
|
10071
|
-
for (const expression of
|
|
10090
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
10072
10091
|
expression.deoptimizePath(UNKNOWN_PATH);
|
|
10073
10092
|
}
|
|
10074
10093
|
}
|
|
@@ -10136,10 +10155,12 @@ class CallExpression extends CallExpressionBase {
|
|
|
10136
10155
|
}
|
|
10137
10156
|
}
|
|
10138
10157
|
this.interaction = {
|
|
10139
|
-
args:
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10158
|
+
args: [
|
|
10159
|
+
this.callee instanceof MemberExpression && !this.callee.variable
|
|
10160
|
+
? this.callee.object
|
|
10161
|
+
: null,
|
|
10162
|
+
...this.arguments
|
|
10163
|
+
],
|
|
10143
10164
|
type: INTERACTION_CALLED,
|
|
10144
10165
|
withNew: false
|
|
10145
10166
|
};
|
|
@@ -10292,8 +10313,7 @@ class MethodBase extends NodeBase {
|
|
|
10292
10313
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
10293
10314
|
if (interaction.type === INTERACTION_ACCESSED && this.kind === 'get' && path.length === 0) {
|
|
10294
10315
|
return this.value.deoptimizeArgumentsOnInteractionAtPath({
|
|
10295
|
-
args:
|
|
10296
|
-
thisArg: interaction.thisArg,
|
|
10316
|
+
args: interaction.args,
|
|
10297
10317
|
type: INTERACTION_CALLED,
|
|
10298
10318
|
withNew: false
|
|
10299
10319
|
}, EMPTY_PATH, recursionTracker);
|
|
@@ -10301,7 +10321,6 @@ class MethodBase extends NodeBase {
|
|
|
10301
10321
|
if (interaction.type === INTERACTION_ASSIGNED && this.kind === 'set' && path.length === 0) {
|
|
10302
10322
|
return this.value.deoptimizeArgumentsOnInteractionAtPath({
|
|
10303
10323
|
args: interaction.args,
|
|
10304
|
-
thisArg: interaction.thisArg,
|
|
10305
10324
|
type: INTERACTION_CALLED,
|
|
10306
10325
|
withNew: false
|
|
10307
10326
|
}, EMPTY_PATH, recursionTracker);
|
|
@@ -10326,8 +10345,7 @@ class MethodBase extends NodeBase {
|
|
|
10326
10345
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10327
10346
|
if (this.kind === 'get' && interaction.type === INTERACTION_ACCESSED && path.length === 0) {
|
|
10328
10347
|
return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
|
|
10329
|
-
args:
|
|
10330
|
-
thisArg: interaction.thisArg,
|
|
10348
|
+
args: interaction.args,
|
|
10331
10349
|
type: INTERACTION_CALLED,
|
|
10332
10350
|
withNew: false
|
|
10333
10351
|
}, context);
|
|
@@ -10336,7 +10354,6 @@ class MethodBase extends NodeBase {
|
|
|
10336
10354
|
if (this.kind === 'set' && interaction.type === INTERACTION_ASSIGNED) {
|
|
10337
10355
|
return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
|
|
10338
10356
|
args: interaction.args,
|
|
10339
|
-
thisArg: interaction.thisArg,
|
|
10340
10357
|
type: INTERACTION_CALLED,
|
|
10341
10358
|
withNew: false
|
|
10342
10359
|
}, context);
|
|
@@ -10597,7 +10614,9 @@ class ConditionalExpression extends NodeBase {
|
|
|
10597
10614
|
const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
|
|
10598
10615
|
this.usedBranch = null;
|
|
10599
10616
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
10600
|
-
|
|
10617
|
+
const { expressionsToBeDeoptimized } = this;
|
|
10618
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
10619
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
10601
10620
|
expression.deoptimizeCache();
|
|
10602
10621
|
}
|
|
10603
10622
|
}
|
|
@@ -11729,12 +11748,14 @@ class LogicalExpression extends NodeBase {
|
|
|
11729
11748
|
const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
|
|
11730
11749
|
this.usedBranch = null;
|
|
11731
11750
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
11732
|
-
|
|
11751
|
+
const { context, expressionsToBeDeoptimized } = this;
|
|
11752
|
+
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
11753
|
+
for (const expression of expressionsToBeDeoptimized) {
|
|
11733
11754
|
expression.deoptimizeCache();
|
|
11734
11755
|
}
|
|
11735
11756
|
// Request another pass because we need to ensure "include" runs again if
|
|
11736
11757
|
// it is rendered
|
|
11737
|
-
|
|
11758
|
+
context.requestTreeshakingPass();
|
|
11738
11759
|
}
|
|
11739
11760
|
}
|
|
11740
11761
|
deoptimizePath(path) {
|
|
@@ -12004,8 +12025,7 @@ class NewExpression extends NodeBase {
|
|
|
12004
12025
|
}
|
|
12005
12026
|
initialise() {
|
|
12006
12027
|
this.interaction = {
|
|
12007
|
-
args: this.arguments,
|
|
12008
|
-
thisArg: null,
|
|
12028
|
+
args: [null, ...this.arguments],
|
|
12009
12029
|
type: INTERACTION_CALLED,
|
|
12010
12030
|
withNew: true
|
|
12011
12031
|
};
|
|
@@ -12524,16 +12544,19 @@ class TaggedTemplateExpression extends CallExpressionBase {
|
|
|
12524
12544
|
this.tag.include(context, includeChildrenRecursively);
|
|
12525
12545
|
this.quasi.include(context, includeChildrenRecursively);
|
|
12526
12546
|
}
|
|
12527
|
-
this.tag.includeCallArguments(context, this.
|
|
12547
|
+
this.tag.includeCallArguments(context, this.args);
|
|
12528
12548
|
const [returnExpression] = this.getReturnExpression();
|
|
12529
12549
|
if (!returnExpression.included) {
|
|
12530
12550
|
returnExpression.include(context, false);
|
|
12531
12551
|
}
|
|
12532
12552
|
}
|
|
12533
12553
|
initialise() {
|
|
12554
|
+
this.args = [UNKNOWN_EXPRESSION, ...this.quasi.expressions];
|
|
12534
12555
|
this.interaction = {
|
|
12535
|
-
args: [
|
|
12536
|
-
|
|
12556
|
+
args: [
|
|
12557
|
+
this.tag instanceof MemberExpression && !this.tag.variable ? this.tag.object : null,
|
|
12558
|
+
...this.args
|
|
12559
|
+
],
|
|
12537
12560
|
type: INTERACTION_CALLED,
|
|
12538
12561
|
withNew: false
|
|
12539
12562
|
};
|
|
@@ -12718,8 +12741,7 @@ class ThisExpression extends NodeBase {
|
|
|
12718
12741
|
this.variable = this.scope.findVariable('this');
|
|
12719
12742
|
}
|
|
12720
12743
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
12721
|
-
|
|
12722
|
-
this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction.thisArg === this ? { ...interaction, thisArg: this.variable } : interaction, path, recursionTracker);
|
|
12744
|
+
this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
12723
12745
|
}
|
|
12724
12746
|
deoptimizePath(path) {
|
|
12725
12747
|
this.variable.deoptimizePath(path);
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED