babel-plugin-react-compiler 0.0.0-experimental-fe484b5-20240911 → 0.0.0-experimental-de2cfda-20240912
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/index.js +1191 -159
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -135625,6 +135625,31 @@ function getOrInsertDefault(m, key, defaultValue) {
|
|
135625
135625
|
return defaultValue;
|
135626
135626
|
}
|
135627
135627
|
}
|
135628
|
+
function Set_union(a, b) {
|
135629
|
+
const union = new Set(a);
|
135630
|
+
for (const item of b) {
|
135631
|
+
union.add(item);
|
135632
|
+
}
|
135633
|
+
return union;
|
135634
|
+
}
|
135635
|
+
function Set_intersect(sets) {
|
135636
|
+
if (sets.length === 0 || sets.some(s => s.size === 0)) {
|
135637
|
+
return new Set();
|
135638
|
+
} else if (sets.length === 1) {
|
135639
|
+
return new Set(sets[0]);
|
135640
|
+
}
|
135641
|
+
const result = new Set();
|
135642
|
+
const first = sets[0];
|
135643
|
+
outer: for (const e of first) {
|
135644
|
+
for (let i = 1; i < sets.length; i++) {
|
135645
|
+
if (!sets[i].has(e)) {
|
135646
|
+
continue outer;
|
135647
|
+
}
|
135648
|
+
}
|
135649
|
+
result.add(e);
|
135650
|
+
}
|
135651
|
+
return result;
|
135652
|
+
}
|
135628
135653
|
function Iterable_some(iter, pred) {
|
135629
135654
|
for (const item of iter) {
|
135630
135655
|
if (pred(item)) {
|
@@ -140998,6 +141023,7 @@ function getFunctionName$1(instrValue, defaultValue) {
|
|
140998
141023
|
return defaultValue;
|
140999
141024
|
}
|
141000
141025
|
}
|
141026
|
+
var _ScopeBlockTraversal_activeScopes;
|
141001
141027
|
function* eachInstructionLValue(instr) {
|
141002
141028
|
if (instr.lvalue !== null) {
|
141003
141029
|
yield instr.lvalue;
|
@@ -142052,6 +142078,93 @@ function* eachTerminalOperand(terminal) {
|
|
142052
142078
|
}
|
142053
142079
|
}
|
142054
142080
|
}
|
142081
|
+
class ScopeBlockTraversal {
|
142082
|
+
constructor() {
|
142083
|
+
_ScopeBlockTraversal_activeScopes.set(this, []);
|
142084
|
+
this.blockInfos = new Map();
|
142085
|
+
}
|
142086
|
+
recordScopes(block) {
|
142087
|
+
var _a, _b;
|
142088
|
+
const blockInfo = this.blockInfos.get(block.id);
|
142089
|
+
if (
|
142090
|
+
(blockInfo === null || blockInfo === void 0 ? void 0 : blockInfo.kind) ===
|
142091
|
+
'begin'
|
142092
|
+
) {
|
142093
|
+
__classPrivateFieldGet(this, _ScopeBlockTraversal_activeScopes, 'f').push(
|
142094
|
+
blockInfo.scope.id
|
142095
|
+
);
|
142096
|
+
} else if (
|
142097
|
+
(blockInfo === null || blockInfo === void 0 ? void 0 : blockInfo.kind) ===
|
142098
|
+
'end'
|
142099
|
+
) {
|
142100
|
+
const top = __classPrivateFieldGet(
|
142101
|
+
this,
|
142102
|
+
_ScopeBlockTraversal_activeScopes,
|
142103
|
+
'f'
|
142104
|
+
).at(-1);
|
142105
|
+
CompilerError.invariant(blockInfo.scope.id === top, {
|
142106
|
+
reason:
|
142107
|
+
'Expected traversed block fallthrough to match top-most active scope',
|
142108
|
+
loc:
|
142109
|
+
(_b =
|
142110
|
+
(_a = block.instructions[0]) === null || _a === void 0
|
142111
|
+
? void 0
|
142112
|
+
: _a.loc) !== null && _b !== void 0
|
142113
|
+
? _b
|
142114
|
+
: block.terminal.id,
|
142115
|
+
});
|
142116
|
+
__classPrivateFieldGet(
|
142117
|
+
this,
|
142118
|
+
_ScopeBlockTraversal_activeScopes,
|
142119
|
+
'f'
|
142120
|
+
).pop();
|
142121
|
+
}
|
142122
|
+
if (
|
142123
|
+
block.terminal.kind === 'scope' ||
|
142124
|
+
block.terminal.kind === 'pruned-scope'
|
142125
|
+
) {
|
142126
|
+
CompilerError.invariant(
|
142127
|
+
!this.blockInfos.has(block.terminal.block) &&
|
142128
|
+
!this.blockInfos.has(block.terminal.fallthrough),
|
142129
|
+
{
|
142130
|
+
reason: 'Expected unique scope blocks and fallthroughs',
|
142131
|
+
loc: block.terminal.loc,
|
142132
|
+
}
|
142133
|
+
);
|
142134
|
+
this.blockInfos.set(block.terminal.block, {
|
142135
|
+
kind: 'begin',
|
142136
|
+
scope: block.terminal.scope,
|
142137
|
+
pruned: block.terminal.kind === 'pruned-scope',
|
142138
|
+
fallthrough: block.terminal.fallthrough,
|
142139
|
+
});
|
142140
|
+
this.blockInfos.set(block.terminal.fallthrough, {
|
142141
|
+
kind: 'end',
|
142142
|
+
scope: block.terminal.scope,
|
142143
|
+
pruned: block.terminal.kind === 'pruned-scope',
|
142144
|
+
});
|
142145
|
+
}
|
142146
|
+
}
|
142147
|
+
isScopeActive(scopeId) {
|
142148
|
+
return (
|
142149
|
+
__classPrivateFieldGet(
|
142150
|
+
this,
|
142151
|
+
_ScopeBlockTraversal_activeScopes,
|
142152
|
+
'f'
|
142153
|
+
).indexOf(scopeId) !== -1
|
142154
|
+
);
|
142155
|
+
}
|
142156
|
+
get currentScope() {
|
142157
|
+
var _a;
|
142158
|
+
return (_a = __classPrivateFieldGet(
|
142159
|
+
this,
|
142160
|
+
_ScopeBlockTraversal_activeScopes,
|
142161
|
+
'f'
|
142162
|
+
).at(-1)) !== null && _a !== void 0
|
142163
|
+
? _a
|
142164
|
+
: null;
|
142165
|
+
}
|
142166
|
+
}
|
142167
|
+
_ScopeBlockTraversal_activeScopes = new WeakMap();
|
142055
142168
|
function assertConsistentIdentifiers(fn) {
|
142056
142169
|
const identifiers = new Map();
|
142057
142170
|
const assignments = new Set();
|
@@ -150485,7 +150598,7 @@ const EnvironmentConfigSchema = z.object({
|
|
150485
150598
|
enablePreserveExistingManualUseMemo: z.boolean().default(false),
|
150486
150599
|
enableForest: z.boolean().default(false),
|
150487
150600
|
enableUseTypeAnnotations: z.boolean().default(false),
|
150488
|
-
enablePropagateDepsInHIR: z.boolean().default(
|
150601
|
+
enablePropagateDepsInHIR: z.boolean().default(false),
|
150489
150602
|
enableOptionalDependencies: z.boolean().default(true),
|
150490
150603
|
validateHooksUsage: z.boolean().default(true),
|
150491
150604
|
validateRefAccessDuringRender: z.boolean().default(true),
|
@@ -153014,8 +153127,10 @@ function mergeLocation(l, r) {
|
|
153014
153127
|
};
|
153015
153128
|
}
|
153016
153129
|
}
|
153017
|
-
function isMutable(
|
153018
|
-
|
153130
|
+
function isMutable(instr, place) {
|
153131
|
+
return inRange(instr, place.identifier.mutableRange);
|
153132
|
+
}
|
153133
|
+
function inRange({id: id}, range) {
|
153019
153134
|
return id >= range.start && id < range.end;
|
153020
153135
|
}
|
153021
153136
|
function mayAllocate(env, instruction) {
|
@@ -155630,7 +155745,7 @@ var _Context_nextScheduleId,
|
|
155630
155745
|
_Context_catchHandlers,
|
155631
155746
|
_Context_controlFlowStack;
|
155632
155747
|
function buildReactiveFunction(fn) {
|
155633
|
-
const cx = new Context$
|
155748
|
+
const cx = new Context$3(fn.body);
|
155634
155749
|
const driver = new Driver(cx);
|
155635
155750
|
const body = driver.traverseBlock(cx.block(fn.body.entry));
|
155636
155751
|
return {
|
@@ -156678,7 +156793,7 @@ class Driver {
|
|
156678
156793
|
};
|
156679
156794
|
}
|
156680
156795
|
}
|
156681
|
-
let Context$
|
156796
|
+
let Context$3 = class Context {
|
156682
156797
|
constructor(ir) {
|
156683
156798
|
_Context_nextScheduleId.set(this, 0);
|
156684
156799
|
this.emitted = new Set();
|
@@ -157058,7 +157173,7 @@ function expandFbtScopeRange(fbtRange, extendWith) {
|
|
157058
157173
|
);
|
157059
157174
|
}
|
157060
157175
|
}
|
157061
|
-
var _Context_nextCacheIndex, _Context_declarations$
|
157176
|
+
var _Context_nextCacheIndex, _Context_declarations$2;
|
157062
157177
|
const MEMO_CACHE_SENTINEL = 'react.memo_cache_sentinel';
|
157063
157178
|
const EARLY_RETURN_SENTINEL = 'react.early_return_sentinel';
|
157064
157179
|
function codegenFunction(
|
@@ -157066,7 +157181,7 @@ function codegenFunction(
|
|
157066
157181
|
{uniqueIdentifiers: uniqueIdentifiers, fbtOperands: fbtOperands}
|
157067
157182
|
) {
|
157068
157183
|
var _a, _b, _c;
|
157069
|
-
const cx = new Context$
|
157184
|
+
const cx = new Context$2(
|
157070
157185
|
fn.env,
|
157071
157186
|
(_a = fn.id) !== null && _a !== void 0 ? _a : '[[ anonymous ]]',
|
157072
157187
|
uniqueIdentifiers,
|
@@ -157231,7 +157346,7 @@ function codegenFunction(
|
|
157231
157346
|
pruneHoistedContexts(reactiveFunction);
|
157232
157347
|
const identifiers = renameVariables(reactiveFunction);
|
157233
157348
|
const codegen = codegenReactiveFunction(
|
157234
|
-
new Context$
|
157349
|
+
new Context$2(
|
157235
157350
|
cx.env,
|
157236
157351
|
(_c = reactiveFunction.id) !== null && _c !== void 0
|
157237
157352
|
? _c
|
@@ -157318,10 +157433,10 @@ function convertParameter(param) {
|
|
157318
157433
|
return t__namespace.restElement(convertIdentifier(param.place.identifier));
|
157319
157434
|
}
|
157320
157435
|
}
|
157321
|
-
let Context$
|
157436
|
+
let Context$2 = class Context {
|
157322
157437
|
constructor(env, fnName, uniqueIdentifiers, fbtOperands, temporaries = null) {
|
157323
157438
|
_Context_nextCacheIndex.set(this, 0);
|
157324
|
-
_Context_declarations$
|
157439
|
+
_Context_declarations$2.set(this, new Set());
|
157325
157440
|
this.errors = new CompilerError();
|
157326
157441
|
this.objectMethods = new Map();
|
157327
157442
|
this.synthesizedNames = new Map();
|
@@ -157346,12 +157461,12 @@ let Context$1 = class Context {
|
|
157346
157461
|
);
|
157347
157462
|
}
|
157348
157463
|
declare(identifier) {
|
157349
|
-
__classPrivateFieldGet(this, _Context_declarations$
|
157464
|
+
__classPrivateFieldGet(this, _Context_declarations$2, 'f').add(
|
157350
157465
|
identifier.declarationId
|
157351
157466
|
);
|
157352
157467
|
}
|
157353
157468
|
hasDeclared(identifier) {
|
157354
|
-
return __classPrivateFieldGet(this, _Context_declarations$
|
157469
|
+
return __classPrivateFieldGet(this, _Context_declarations$2, 'f').has(
|
157355
157470
|
identifier.declarationId
|
157356
157471
|
);
|
157357
157472
|
}
|
@@ -157371,7 +157486,7 @@ let Context$1 = class Context {
|
|
157371
157486
|
}
|
157372
157487
|
};
|
157373
157488
|
(_Context_nextCacheIndex = new WeakMap()),
|
157374
|
-
(_Context_declarations$
|
157489
|
+
(_Context_declarations$2 = new WeakMap());
|
157375
157490
|
function codegenBlock(cx, block) {
|
157376
157491
|
const temp = new Map(cx.temp);
|
157377
157492
|
const result = codegenBlockNoReset(cx, block);
|
@@ -158648,7 +158763,7 @@ function codegenInstructionValue(cx, instrValue) {
|
|
158648
158763
|
pruneUnusedLabels(reactiveFunction);
|
158649
158764
|
pruneUnusedLValues(reactiveFunction);
|
158650
158765
|
const fn = codegenReactiveFunction(
|
158651
|
-
new Context$
|
158766
|
+
new Context$2(
|
158652
158767
|
cx.env,
|
158653
158768
|
(_e = reactiveFunction.id) !== null && _e !== void 0
|
158654
158769
|
? _e
|
@@ -158847,7 +158962,7 @@ function codegenInstructionValue(cx, instrValue) {
|
|
158847
158962
|
pruneUnusedLValues(reactiveFunction);
|
158848
158963
|
pruneHoistedContexts(reactiveFunction);
|
158849
158964
|
const fn = codegenReactiveFunction(
|
158850
|
-
new Context$
|
158965
|
+
new Context$2(
|
158851
158966
|
cx.env,
|
158852
158967
|
(_g = reactiveFunction.id) !== null && _g !== void 0
|
158853
158968
|
? _g
|
@@ -160398,21 +160513,21 @@ class ReactiveScopeDependencyTree {
|
|
160398
160513
|
_ReactiveScopeDependencyTree_getOrCreateRoot
|
160399
160514
|
).call(this, dep.identifier);
|
160400
160515
|
for (const item of path) {
|
160401
|
-
let currChild = getOrMakeProperty(currNode, item.property);
|
160516
|
+
let currChild = getOrMakeProperty$1(currNode, item.property);
|
160402
160517
|
const accessType = inConditional
|
160403
|
-
? PropertyAccessType.ConditionalAccess
|
160518
|
+
? PropertyAccessType$1.ConditionalAccess
|
160404
160519
|
: item.optional
|
160405
|
-
? PropertyAccessType.OptionalAccess
|
160406
|
-
: PropertyAccessType.UnconditionalAccess;
|
160407
|
-
currChild.accessType = merge(currChild.accessType, accessType);
|
160520
|
+
? PropertyAccessType$1.OptionalAccess
|
160521
|
+
: PropertyAccessType$1.UnconditionalAccess;
|
160522
|
+
currChild.accessType = merge$1(currChild.accessType, accessType);
|
160408
160523
|
currNode = currChild;
|
160409
160524
|
}
|
160410
160525
|
const depType = inConditional
|
160411
|
-
? PropertyAccessType.ConditionalDependency
|
160526
|
+
? PropertyAccessType$1.ConditionalDependency
|
160412
160527
|
: isOptional(currNode.accessType)
|
160413
|
-
? PropertyAccessType.OptionalDependency
|
160414
|
-
: PropertyAccessType.UnconditionalDependency;
|
160415
|
-
currNode.accessType = merge(currNode.accessType, depType);
|
160528
|
+
? PropertyAccessType$1.OptionalDependency
|
160529
|
+
: PropertyAccessType$1.UnconditionalDependency;
|
160530
|
+
currNode.accessType = merge$1(currNode.accessType, depType);
|
160416
160531
|
}
|
160417
160532
|
deriveMinimalDependencies() {
|
160418
160533
|
const results = new Set();
|
@@ -160421,12 +160536,12 @@ class ReactiveScopeDependencyTree {
|
|
160421
160536
|
_ReactiveScopeDependencyTree_roots,
|
160422
160537
|
'f'
|
160423
160538
|
).entries()) {
|
160424
|
-
const deps = deriveMinimalDependenciesInSubtree(rootNode, null);
|
160539
|
+
const deps = deriveMinimalDependenciesInSubtree$1(rootNode, null);
|
160425
160540
|
CompilerError.invariant(
|
160426
160541
|
deps.every(
|
160427
160542
|
dep =>
|
160428
|
-
dep.accessType === PropertyAccessType.UnconditionalDependency ||
|
160429
|
-
dep.accessType == PropertyAccessType.OptionalDependency
|
160543
|
+
dep.accessType === PropertyAccessType$1.UnconditionalDependency ||
|
160544
|
+
dep.accessType == PropertyAccessType$1.OptionalDependency
|
160430
160545
|
),
|
160431
160546
|
{
|
160432
160547
|
reason:
|
@@ -160463,9 +160578,9 @@ class ReactiveScopeDependencyTree {
|
|
160463
160578
|
).call(this, id);
|
160464
160579
|
addSubtree(currRoot, otherRoot, innerScopeInConditionalWithinParent);
|
160465
160580
|
if (!isUnconditional(currRoot.accessType)) {
|
160466
|
-
currRoot.accessType = isDependency(currRoot.accessType)
|
160467
|
-
? PropertyAccessType.UnconditionalDependency
|
160468
|
-
: PropertyAccessType.UnconditionalAccess;
|
160581
|
+
currRoot.accessType = isDependency$1(currRoot.accessType)
|
160582
|
+
? PropertyAccessType$1.UnconditionalDependency
|
160583
|
+
: PropertyAccessType$1.UnconditionalAccess;
|
160469
160584
|
}
|
160470
160585
|
}
|
160471
160586
|
}
|
@@ -160508,7 +160623,7 @@ class ReactiveScopeDependencyTree {
|
|
160508
160623
|
_ReactiveScopeDependencyTree_roots,
|
160509
160624
|
'f'
|
160510
160625
|
).entries()) {
|
160511
|
-
const rootResults = printSubtree(rootNode, includeAccesses).map(
|
160626
|
+
const rootResults = printSubtree$1(rootNode, includeAccesses).map(
|
160512
160627
|
result => `${printIdentifier(rootId)}.${result}`
|
160513
160628
|
);
|
160514
160629
|
res.push(rootResults);
|
@@ -160546,7 +160661,7 @@ class ReactiveScopeDependencyTree {
|
|
160546
160661
|
if (rootNode === undefined) {
|
160547
160662
|
rootNode = {
|
160548
160663
|
properties: new Map(),
|
160549
|
-
accessType: PropertyAccessType.UnconditionalAccess,
|
160664
|
+
accessType: PropertyAccessType$1.UnconditionalAccess,
|
160550
160665
|
};
|
160551
160666
|
__classPrivateFieldGet(
|
160552
160667
|
this,
|
@@ -160570,7 +160685,7 @@ class ReactiveScopeDependencyTree {
|
|
160570
160685
|
).call(this, buf, childNode, depth + 1);
|
160571
160686
|
}
|
160572
160687
|
});
|
160573
|
-
var PropertyAccessType;
|
160688
|
+
var PropertyAccessType$1;
|
160574
160689
|
(function (PropertyAccessType) {
|
160575
160690
|
PropertyAccessType['ConditionalAccess'] = 'ConditionalAccess';
|
160576
160691
|
PropertyAccessType['OptionalAccess'] = 'OptionalAccess';
|
@@ -160578,49 +160693,49 @@ var PropertyAccessType;
|
|
160578
160693
|
PropertyAccessType['ConditionalDependency'] = 'ConditionalDependency';
|
160579
160694
|
PropertyAccessType['OptionalDependency'] = 'OptionalDependency';
|
160580
160695
|
PropertyAccessType['UnconditionalDependency'] = 'UnconditionalDependency';
|
160581
|
-
})(PropertyAccessType || (PropertyAccessType = {}));
|
160582
|
-
const MIN_ACCESS_TYPE = PropertyAccessType.ConditionalAccess;
|
160696
|
+
})(PropertyAccessType$1 || (PropertyAccessType$1 = {}));
|
160697
|
+
const MIN_ACCESS_TYPE$1 = PropertyAccessType$1.ConditionalAccess;
|
160583
160698
|
function isUnconditional(access) {
|
160584
160699
|
return (
|
160585
|
-
access === PropertyAccessType.UnconditionalAccess ||
|
160586
|
-
access === PropertyAccessType.UnconditionalDependency
|
160700
|
+
access === PropertyAccessType$1.UnconditionalAccess ||
|
160701
|
+
access === PropertyAccessType$1.UnconditionalDependency
|
160587
160702
|
);
|
160588
160703
|
}
|
160589
|
-
function isDependency(access) {
|
160704
|
+
function isDependency$1(access) {
|
160590
160705
|
return (
|
160591
|
-
access === PropertyAccessType.ConditionalDependency ||
|
160592
|
-
access === PropertyAccessType.OptionalDependency ||
|
160593
|
-
access === PropertyAccessType.UnconditionalDependency
|
160706
|
+
access === PropertyAccessType$1.ConditionalDependency ||
|
160707
|
+
access === PropertyAccessType$1.OptionalDependency ||
|
160708
|
+
access === PropertyAccessType$1.UnconditionalDependency
|
160594
160709
|
);
|
160595
160710
|
}
|
160596
160711
|
function isOptional(access) {
|
160597
160712
|
return (
|
160598
|
-
access === PropertyAccessType.OptionalAccess ||
|
160599
|
-
access === PropertyAccessType.OptionalDependency
|
160713
|
+
access === PropertyAccessType$1.OptionalAccess ||
|
160714
|
+
access === PropertyAccessType$1.OptionalDependency
|
160600
160715
|
);
|
160601
160716
|
}
|
160602
|
-
function merge(access1, access2) {
|
160717
|
+
function merge$1(access1, access2) {
|
160603
160718
|
const resultIsUnconditional =
|
160604
160719
|
isUnconditional(access1) || isUnconditional(access2);
|
160605
|
-
const resultIsDependency = isDependency(access1) || isDependency(access2);
|
160720
|
+
const resultIsDependency = isDependency$1(access1) || isDependency$1(access2);
|
160606
160721
|
const resultIsOptional = isOptional(access1) || isOptional(access2);
|
160607
160722
|
if (resultIsUnconditional) {
|
160608
160723
|
if (resultIsDependency) {
|
160609
|
-
return PropertyAccessType.UnconditionalDependency;
|
160724
|
+
return PropertyAccessType$1.UnconditionalDependency;
|
160610
160725
|
} else {
|
160611
|
-
return PropertyAccessType.UnconditionalAccess;
|
160726
|
+
return PropertyAccessType$1.UnconditionalAccess;
|
160612
160727
|
}
|
160613
160728
|
} else if (resultIsOptional) {
|
160614
160729
|
if (resultIsDependency) {
|
160615
|
-
return PropertyAccessType.OptionalDependency;
|
160730
|
+
return PropertyAccessType$1.OptionalDependency;
|
160616
160731
|
} else {
|
160617
|
-
return PropertyAccessType.OptionalAccess;
|
160732
|
+
return PropertyAccessType$1.OptionalAccess;
|
160618
160733
|
}
|
160619
160734
|
} else {
|
160620
160735
|
if (resultIsDependency) {
|
160621
|
-
return PropertyAccessType.ConditionalDependency;
|
160736
|
+
return PropertyAccessType$1.ConditionalDependency;
|
160622
160737
|
} else {
|
160623
|
-
return PropertyAccessType.ConditionalAccess;
|
160738
|
+
return PropertyAccessType$1.ConditionalAccess;
|
160624
160739
|
}
|
160625
160740
|
}
|
160626
160741
|
}
|
@@ -160640,28 +160755,28 @@ function prependPath(results, path) {
|
|
160640
160755
|
relativePath: [path, ...result.relativePath],
|
160641
160756
|
}));
|
160642
160757
|
}
|
160643
|
-
function deriveMinimalDependenciesInSubtree(dep, property) {
|
160758
|
+
function deriveMinimalDependenciesInSubtree$1(dep, property) {
|
160644
160759
|
const results = [];
|
160645
160760
|
for (const [childName, childNode] of dep.properties) {
|
160646
|
-
const childResult = deriveMinimalDependenciesInSubtree(
|
160761
|
+
const childResult = deriveMinimalDependenciesInSubtree$1(
|
160647
160762
|
childNode,
|
160648
160763
|
childName
|
160649
160764
|
);
|
160650
160765
|
results.push(...childResult);
|
160651
160766
|
}
|
160652
160767
|
switch (dep.accessType) {
|
160653
|
-
case PropertyAccessType.UnconditionalDependency: {
|
160768
|
+
case PropertyAccessType$1.UnconditionalDependency: {
|
160654
160769
|
return promoteResult(
|
160655
|
-
PropertyAccessType.UnconditionalDependency,
|
160770
|
+
PropertyAccessType$1.UnconditionalDependency,
|
160656
160771
|
property !== null ? {property: property, optional: false} : null
|
160657
160772
|
);
|
160658
160773
|
}
|
160659
|
-
case PropertyAccessType.UnconditionalAccess: {
|
160774
|
+
case PropertyAccessType$1.UnconditionalAccess: {
|
160660
160775
|
if (
|
160661
160776
|
results.every(
|
160662
160777
|
({accessType: accessType}) =>
|
160663
|
-
accessType === PropertyAccessType.UnconditionalDependency ||
|
160664
|
-
accessType === PropertyAccessType.OptionalDependency
|
160778
|
+
accessType === PropertyAccessType$1.UnconditionalDependency ||
|
160779
|
+
accessType === PropertyAccessType$1.OptionalDependency
|
160665
160780
|
)
|
160666
160781
|
) {
|
160667
160782
|
return prependPath(
|
@@ -160670,23 +160785,23 @@ function deriveMinimalDependenciesInSubtree(dep, property) {
|
|
160670
160785
|
);
|
160671
160786
|
} else {
|
160672
160787
|
return promoteResult(
|
160673
|
-
PropertyAccessType.UnconditionalDependency,
|
160788
|
+
PropertyAccessType$1.UnconditionalDependency,
|
160674
160789
|
property !== null ? {property: property, optional: false} : null
|
160675
160790
|
);
|
160676
160791
|
}
|
160677
160792
|
}
|
160678
|
-
case PropertyAccessType.OptionalDependency: {
|
160793
|
+
case PropertyAccessType$1.OptionalDependency: {
|
160679
160794
|
return promoteResult(
|
160680
|
-
PropertyAccessType.OptionalDependency,
|
160795
|
+
PropertyAccessType$1.OptionalDependency,
|
160681
160796
|
property !== null ? {property: property, optional: true} : null
|
160682
160797
|
);
|
160683
160798
|
}
|
160684
|
-
case PropertyAccessType.OptionalAccess: {
|
160799
|
+
case PropertyAccessType$1.OptionalAccess: {
|
160685
160800
|
if (
|
160686
160801
|
results.every(
|
160687
160802
|
({accessType: accessType}) =>
|
160688
|
-
accessType === PropertyAccessType.UnconditionalDependency ||
|
160689
|
-
accessType === PropertyAccessType.OptionalDependency
|
160803
|
+
accessType === PropertyAccessType$1.UnconditionalDependency ||
|
160804
|
+
accessType === PropertyAccessType$1.OptionalDependency
|
160690
160805
|
)
|
160691
160806
|
) {
|
160692
160807
|
return prependPath(
|
@@ -160695,26 +160810,26 @@ function deriveMinimalDependenciesInSubtree(dep, property) {
|
|
160695
160810
|
);
|
160696
160811
|
} else {
|
160697
160812
|
return promoteResult(
|
160698
|
-
PropertyAccessType.OptionalDependency,
|
160813
|
+
PropertyAccessType$1.OptionalDependency,
|
160699
160814
|
property !== null ? {property: property, optional: true} : null
|
160700
160815
|
);
|
160701
160816
|
}
|
160702
160817
|
}
|
160703
|
-
case PropertyAccessType.ConditionalAccess:
|
160704
|
-
case PropertyAccessType.ConditionalDependency: {
|
160818
|
+
case PropertyAccessType$1.ConditionalAccess:
|
160819
|
+
case PropertyAccessType$1.ConditionalDependency: {
|
160705
160820
|
if (
|
160706
160821
|
results.every(
|
160707
160822
|
({accessType: accessType}) =>
|
160708
|
-
accessType === PropertyAccessType.ConditionalDependency
|
160823
|
+
accessType === PropertyAccessType$1.ConditionalDependency
|
160709
160824
|
)
|
160710
160825
|
) {
|
160711
160826
|
return promoteResult(
|
160712
|
-
PropertyAccessType.ConditionalDependency,
|
160827
|
+
PropertyAccessType$1.ConditionalDependency,
|
160713
160828
|
property !== null ? {property: property, optional: true} : null
|
160714
160829
|
);
|
160715
160830
|
} else {
|
160716
160831
|
return promoteResult(
|
160717
|
-
PropertyAccessType.UnconditionalDependency,
|
160832
|
+
PropertyAccessType$1.UnconditionalDependency,
|
160718
160833
|
property !== null ? {property: property, optional: true} : null
|
160719
160834
|
);
|
160720
160835
|
}
|
@@ -160735,9 +160850,9 @@ function demoteSubtreeToConditional(subtree) {
|
|
160735
160850
|
if (!isUnconditional(accessType)) {
|
160736
160851
|
continue;
|
160737
160852
|
}
|
160738
|
-
node.accessType = isDependency(accessType)
|
160739
|
-
? PropertyAccessType.ConditionalDependency
|
160740
|
-
: PropertyAccessType.ConditionalAccess;
|
160853
|
+
node.accessType = isDependency$1(accessType)
|
160854
|
+
? PropertyAccessType$1.ConditionalDependency
|
160855
|
+
: PropertyAccessType$1.ConditionalAccess;
|
160741
160856
|
for (const childNode of properties.values()) {
|
160742
160857
|
if (isUnconditional(accessType)) {
|
160743
160858
|
stack.push(childNode);
|
@@ -160748,11 +160863,11 @@ function demoteSubtreeToConditional(subtree) {
|
|
160748
160863
|
function addSubtree(currNode, otherNode, demoteOtherNode) {
|
160749
160864
|
let otherType = otherNode.accessType;
|
160750
160865
|
if (demoteOtherNode) {
|
160751
|
-
otherType = isDependency(otherType)
|
160752
|
-
? PropertyAccessType.ConditionalDependency
|
160753
|
-
: PropertyAccessType.ConditionalAccess;
|
160866
|
+
otherType = isDependency$1(otherType)
|
160867
|
+
? PropertyAccessType$1.ConditionalDependency
|
160868
|
+
: PropertyAccessType$1.ConditionalAccess;
|
160754
160869
|
}
|
160755
|
-
currNode.accessType = merge(currNode.accessType, otherType);
|
160870
|
+
currNode.accessType = merge$1(currNode.accessType, otherType);
|
160756
160871
|
for (const [propertyName, otherChild] of otherNode.properties) {
|
160757
160872
|
const currChild = currNode.properties.get(propertyName);
|
160758
160873
|
if (currChild) {
|
@@ -160787,29 +160902,29 @@ function addSubtreeIntersection(currProperties, otherProperties) {
|
|
160787
160902
|
currNode.properties,
|
160788
160903
|
otherNodes.map(node => node.properties)
|
160789
160904
|
);
|
160790
|
-
const isDep = otherNodes.some(tree => isDependency(tree.accessType));
|
160905
|
+
const isDep = otherNodes.some(tree => isDependency$1(tree.accessType));
|
160791
160906
|
const externalAccessType = isDep
|
160792
|
-
? PropertyAccessType.UnconditionalDependency
|
160793
|
-
: PropertyAccessType.UnconditionalAccess;
|
160794
|
-
currNode.accessType = merge(externalAccessType, currNode.accessType);
|
160907
|
+
? PropertyAccessType$1.UnconditionalDependency
|
160908
|
+
: PropertyAccessType$1.UnconditionalAccess;
|
160909
|
+
currNode.accessType = merge$1(externalAccessType, currNode.accessType);
|
160795
160910
|
}
|
160796
160911
|
}
|
160797
160912
|
}
|
160798
|
-
function printSubtree(node, includeAccesses) {
|
160913
|
+
function printSubtree$1(node, includeAccesses) {
|
160799
160914
|
const results = [];
|
160800
160915
|
for (const [propertyName, propertyNode] of node.properties) {
|
160801
|
-
if (includeAccesses || isDependency(propertyNode.accessType)) {
|
160916
|
+
if (includeAccesses || isDependency$1(propertyNode.accessType)) {
|
160802
160917
|
results.push(`${propertyName} (${propertyNode.accessType})`);
|
160803
160918
|
}
|
160804
|
-
const propertyResults = printSubtree(propertyNode, includeAccesses);
|
160919
|
+
const propertyResults = printSubtree$1(propertyNode, includeAccesses);
|
160805
160920
|
results.push(...propertyResults.map(result => `${propertyName}.${result}`));
|
160806
160921
|
}
|
160807
160922
|
return results;
|
160808
160923
|
}
|
160809
|
-
function getOrMakeProperty(node, property) {
|
160924
|
+
function getOrMakeProperty$1(node, property) {
|
160810
160925
|
let child = node.properties.get(property);
|
160811
160926
|
if (child == null) {
|
160812
|
-
child = {properties: new Map(), accessType: MIN_ACCESS_TYPE};
|
160927
|
+
child = {properties: new Map(), accessType: MIN_ACCESS_TYPE$1};
|
160813
160928
|
node.properties.set(property, child);
|
160814
160929
|
}
|
160815
160930
|
return child;
|
@@ -160828,26 +160943,26 @@ function mapNonNull(arr, fn) {
|
|
160828
160943
|
}
|
160829
160944
|
var _PoisonState_instances,
|
160830
160945
|
_PoisonState_invalidate,
|
160831
|
-
_Context_instances,
|
160832
|
-
_Context_temporariesUsedOutsideScope,
|
160833
|
-
_Context_declarations,
|
160834
|
-
_Context_reassignments,
|
160835
|
-
_Context_dependencies,
|
160946
|
+
_Context_instances$1,
|
160947
|
+
_Context_temporariesUsedOutsideScope$1,
|
160948
|
+
_Context_declarations$1,
|
160949
|
+
_Context_reassignments$1,
|
160950
|
+
_Context_dependencies$1,
|
160836
160951
|
_Context_properties,
|
160837
|
-
_Context_temporaries,
|
160952
|
+
_Context_temporaries$1,
|
160838
160953
|
_Context_inConditionalWithinScope,
|
160839
160954
|
_Context_depsInCurrentConditional,
|
160840
|
-
_Context_scopes,
|
160955
|
+
_Context_scopes$1,
|
160841
160956
|
_Context_getProperty,
|
160842
|
-
_Context_checkValidDependency,
|
160843
|
-
_Context_isScopeActive;
|
160957
|
+
_Context_checkValidDependency$1,
|
160958
|
+
_Context_isScopeActive$1;
|
160844
160959
|
function propagateScopeDependencies(fn) {
|
160845
160960
|
const escapingTemporaries = {
|
160846
160961
|
declarations: new Map(),
|
160847
160962
|
usedOutsideDeclaringScope: new Set(),
|
160848
160963
|
};
|
160849
160964
|
visitReactiveFunction(fn, new FindPromotedTemporaries(), escapingTemporaries);
|
160850
|
-
const context = new Context(escapingTemporaries.usedOutsideDeclaringScope);
|
160965
|
+
const context = new Context$1(escapingTemporaries.usedOutsideDeclaringScope);
|
160851
160966
|
for (const param of fn.params) {
|
160852
160967
|
if (param.kind === 'Identifier') {
|
160853
160968
|
context.declare(param.identifier, {
|
@@ -161015,25 +161130,25 @@ class PoisonState {
|
|
161015
161130
|
}
|
161016
161131
|
this.isPoisoned = false;
|
161017
161132
|
});
|
161018
|
-
class Context {
|
161133
|
+
let Context$1 = class Context {
|
161019
161134
|
constructor(temporariesUsedOutsideScope) {
|
161020
|
-
_Context_instances.add(this);
|
161021
|
-
_Context_temporariesUsedOutsideScope.set(this, void 0);
|
161022
|
-
_Context_declarations.set(this, new Map());
|
161023
|
-
_Context_reassignments.set(this, new Map());
|
161024
|
-
_Context_dependencies.set(this, new ReactiveScopeDependencyTree());
|
161135
|
+
_Context_instances$1.add(this);
|
161136
|
+
_Context_temporariesUsedOutsideScope$1.set(this, void 0);
|
161137
|
+
_Context_declarations$1.set(this, new Map());
|
161138
|
+
_Context_reassignments$1.set(this, new Map());
|
161139
|
+
_Context_dependencies$1.set(this, new ReactiveScopeDependencyTree());
|
161025
161140
|
_Context_properties.set(this, new Map());
|
161026
|
-
_Context_temporaries.set(this, new Map());
|
161141
|
+
_Context_temporaries$1.set(this, new Map());
|
161027
161142
|
_Context_inConditionalWithinScope.set(this, false);
|
161028
161143
|
_Context_depsInCurrentConditional.set(
|
161029
161144
|
this,
|
161030
161145
|
new ReactiveScopeDependencyTree()
|
161031
161146
|
);
|
161032
|
-
_Context_scopes.set(this, empty());
|
161147
|
+
_Context_scopes$1.set(this, empty());
|
161033
161148
|
this.poisonState = new PoisonState(new Set(), new Set(), false);
|
161034
161149
|
__classPrivateFieldSet(
|
161035
161150
|
this,
|
161036
|
-
_Context_temporariesUsedOutsideScope,
|
161151
|
+
_Context_temporariesUsedOutsideScope$1,
|
161037
161152
|
temporariesUsedOutsideScope,
|
161038
161153
|
'f'
|
161039
161154
|
);
|
@@ -161046,7 +161161,7 @@ class Context {
|
|
161046
161161
|
);
|
161047
161162
|
const previousDependencies = __classPrivateFieldGet(
|
161048
161163
|
this,
|
161049
|
-
_Context_dependencies,
|
161164
|
+
_Context_dependencies$1,
|
161050
161165
|
'f'
|
161051
161166
|
);
|
161052
161167
|
const prevDepsInConditional = this.isPoisoned
|
@@ -161064,14 +161179,14 @@ class Context {
|
|
161064
161179
|
__classPrivateFieldSet(this, _Context_inConditionalWithinScope, false, 'f');
|
161065
161180
|
__classPrivateFieldSet(
|
161066
161181
|
this,
|
161067
|
-
_Context_dependencies,
|
161182
|
+
_Context_dependencies$1,
|
161068
161183
|
scopedDependencies,
|
161069
161184
|
'f'
|
161070
161185
|
);
|
161071
161186
|
__classPrivateFieldSet(
|
161072
161187
|
this,
|
161073
|
-
_Context_scopes,
|
161074
|
-
__classPrivateFieldGet(this, _Context_scopes, 'f').push({
|
161188
|
+
_Context_scopes$1,
|
161189
|
+
__classPrivateFieldGet(this, _Context_scopes$1, 'f').push({
|
161075
161190
|
value: scope,
|
161076
161191
|
ownBlocks: empty(),
|
161077
161192
|
}),
|
@@ -161081,17 +161196,17 @@ class Context {
|
|
161081
161196
|
fn();
|
161082
161197
|
__classPrivateFieldSet(
|
161083
161198
|
this,
|
161084
|
-
_Context_scopes,
|
161085
|
-
__classPrivateFieldGet(this, _Context_scopes, 'f').pop(),
|
161199
|
+
_Context_scopes$1,
|
161200
|
+
__classPrivateFieldGet(this, _Context_scopes$1, 'f').pop(),
|
161086
161201
|
'f'
|
161087
161202
|
);
|
161088
161203
|
this.poisonState.removeMaybePoisonedScope(
|
161089
161204
|
scope.id,
|
161090
|
-
__classPrivateFieldGet(this, _Context_scopes, 'f').value
|
161205
|
+
__classPrivateFieldGet(this, _Context_scopes$1, 'f').value
|
161091
161206
|
);
|
161092
161207
|
__classPrivateFieldSet(
|
161093
161208
|
this,
|
161094
|
-
_Context_dependencies,
|
161209
|
+
_Context_dependencies$1,
|
161095
161210
|
previousDependencies,
|
161096
161211
|
'f'
|
161097
161212
|
);
|
@@ -161105,7 +161220,7 @@ class Context {
|
|
161105
161220
|
scopedDependencies.deriveMinimalDependencies();
|
161106
161221
|
__classPrivateFieldGet(
|
161107
161222
|
this,
|
161108
|
-
_Context_dependencies,
|
161223
|
+
_Context_dependencies$1,
|
161109
161224
|
'f'
|
161110
161225
|
).addDepsFromInnerScope(
|
161111
161226
|
scopedDependencies,
|
@@ -161113,9 +161228,9 @@ class Context {
|
|
161113
161228
|
this.isPoisoned,
|
161114
161229
|
__classPrivateFieldGet(
|
161115
161230
|
this,
|
161116
|
-
_Context_instances,
|
161231
|
+
_Context_instances$1,
|
161117
161232
|
'm',
|
161118
|
-
_Context_checkValidDependency
|
161233
|
+
_Context_checkValidDependency$1
|
161119
161234
|
).bind(this)
|
161120
161235
|
);
|
161121
161236
|
if (prevDepsInConditional != null) {
|
@@ -161124,9 +161239,9 @@ class Context {
|
|
161124
161239
|
true,
|
161125
161240
|
__classPrivateFieldGet(
|
161126
161241
|
this,
|
161127
|
-
_Context_instances,
|
161242
|
+
_Context_instances$1,
|
161128
161243
|
'm',
|
161129
|
-
_Context_checkValidDependency
|
161244
|
+
_Context_checkValidDependency$1
|
161130
161245
|
).bind(this)
|
161131
161246
|
);
|
161132
161247
|
__classPrivateFieldSet(
|
@@ -161141,12 +161256,12 @@ class Context {
|
|
161141
161256
|
isUsedOutsideDeclaringScope(place) {
|
161142
161257
|
return __classPrivateFieldGet(
|
161143
161258
|
this,
|
161144
|
-
_Context_temporariesUsedOutsideScope,
|
161259
|
+
_Context_temporariesUsedOutsideScope$1,
|
161145
161260
|
'f'
|
161146
161261
|
).has(place.identifier.declarationId);
|
161147
161262
|
}
|
161148
161263
|
printDeps(includeAccesses = false) {
|
161149
|
-
return __classPrivateFieldGet(this, _Context_dependencies, 'f').printDeps(
|
161264
|
+
return __classPrivateFieldGet(this, _Context_dependencies$1, 'f').printDeps(
|
161150
161265
|
includeAccesses
|
161151
161266
|
);
|
161152
161267
|
}
|
@@ -161191,7 +161306,7 @@ class Context {
|
|
161191
161306
|
promoteDepsFromExhaustiveConditionals(depsInConditionals) {
|
161192
161307
|
__classPrivateFieldGet(
|
161193
161308
|
this,
|
161194
|
-
_Context_dependencies,
|
161309
|
+
_Context_dependencies$1,
|
161195
161310
|
'f'
|
161196
161311
|
).promoteDepsFromExhaustiveConditionals(depsInConditionals);
|
161197
161312
|
__classPrivateFieldGet(
|
@@ -161202,29 +161317,29 @@ class Context {
|
|
161202
161317
|
}
|
161203
161318
|
declare(identifier, decl) {
|
161204
161319
|
if (
|
161205
|
-
!__classPrivateFieldGet(this, _Context_declarations, 'f').has(
|
161320
|
+
!__classPrivateFieldGet(this, _Context_declarations$1, 'f').has(
|
161206
161321
|
identifier.declarationId
|
161207
161322
|
)
|
161208
161323
|
) {
|
161209
|
-
__classPrivateFieldGet(this, _Context_declarations, 'f').set(
|
161324
|
+
__classPrivateFieldGet(this, _Context_declarations$1, 'f').set(
|
161210
161325
|
identifier.declarationId,
|
161211
161326
|
decl
|
161212
161327
|
);
|
161213
161328
|
}
|
161214
|
-
__classPrivateFieldGet(this, _Context_reassignments, 'f').set(
|
161329
|
+
__classPrivateFieldGet(this, _Context_reassignments$1, 'f').set(
|
161215
161330
|
identifier,
|
161216
161331
|
decl
|
161217
161332
|
);
|
161218
161333
|
}
|
161219
161334
|
declareTemporary(lvalue, place) {
|
161220
|
-
__classPrivateFieldGet(this, _Context_temporaries, 'f').set(
|
161335
|
+
__classPrivateFieldGet(this, _Context_temporaries$1, 'f').set(
|
161221
161336
|
lvalue.identifier,
|
161222
161337
|
place
|
161223
161338
|
);
|
161224
161339
|
}
|
161225
161340
|
resolveTemporary(place) {
|
161226
161341
|
var _a;
|
161227
|
-
return (_a = __classPrivateFieldGet(this, _Context_temporaries, 'f').get(
|
161342
|
+
return (_a = __classPrivateFieldGet(this, _Context_temporaries$1, 'f').get(
|
161228
161343
|
place.identifier
|
161229
161344
|
)) !== null && _a !== void 0
|
161230
161345
|
? _a
|
@@ -161233,7 +161348,7 @@ class Context {
|
|
161233
161348
|
declareProperty(lvalue, object, property, optional) {
|
161234
161349
|
const nextDependency = __classPrivateFieldGet(
|
161235
161350
|
this,
|
161236
|
-
_Context_instances,
|
161351
|
+
_Context_instances$1,
|
161237
161352
|
'm',
|
161238
161353
|
_Context_getProperty
|
161239
161354
|
).call(this, object, property, optional);
|
@@ -161243,7 +161358,7 @@ class Context {
|
|
161243
161358
|
);
|
161244
161359
|
}
|
161245
161360
|
get currentScope() {
|
161246
|
-
return __classPrivateFieldGet(this, _Context_scopes, 'f');
|
161361
|
+
return __classPrivateFieldGet(this, _Context_scopes$1, 'f');
|
161247
161362
|
}
|
161248
161363
|
get isPoisoned() {
|
161249
161364
|
return this.poisonState.isPoisoned;
|
@@ -161266,7 +161381,7 @@ class Context {
|
|
161266
161381
|
visitProperty(object, property, optional) {
|
161267
161382
|
const nextDependency = __classPrivateFieldGet(
|
161268
161383
|
this,
|
161269
|
-
_Context_instances,
|
161384
|
+
_Context_instances$1,
|
161270
161385
|
'm',
|
161271
161386
|
_Context_getProperty
|
161272
161387
|
).call(this, object, property, optional);
|
@@ -161275,7 +161390,7 @@ class Context {
|
|
161275
161390
|
visitDependency(maybeDependency) {
|
161276
161391
|
const originalDeclaration = __classPrivateFieldGet(
|
161277
161392
|
this,
|
161278
|
-
_Context_declarations,
|
161393
|
+
_Context_declarations$1,
|
161279
161394
|
'f'
|
161280
161395
|
).get(maybeDependency.identifier.declarationId);
|
161281
161396
|
if (
|
@@ -161286,9 +161401,9 @@ class Context {
|
|
161286
161401
|
if (
|
161287
161402
|
!__classPrivateFieldGet(
|
161288
161403
|
this,
|
161289
|
-
_Context_instances,
|
161404
|
+
_Context_instances$1,
|
161290
161405
|
'm',
|
161291
|
-
_Context_isScopeActive
|
161406
|
+
_Context_isScopeActive$1
|
161292
161407
|
).call(this, scope.value) &&
|
161293
161408
|
!Iterable_some(
|
161294
161409
|
scope.value.declarations.values(),
|
@@ -161307,9 +161422,9 @@ class Context {
|
|
161307
161422
|
if (
|
161308
161423
|
__classPrivateFieldGet(
|
161309
161424
|
this,
|
161310
|
-
_Context_instances,
|
161425
|
+
_Context_instances$1,
|
161311
161426
|
'm',
|
161312
|
-
_Context_checkValidDependency
|
161427
|
+
_Context_checkValidDependency$1
|
161313
161428
|
).call(this, maybeDependency)
|
161314
161429
|
) {
|
161315
161430
|
const isPoisoned = this.isPoisoned;
|
@@ -161317,7 +161432,7 @@ class Context {
|
|
161317
161432
|
maybeDependency,
|
161318
161433
|
isPoisoned
|
161319
161434
|
);
|
161320
|
-
__classPrivateFieldGet(this, _Context_dependencies, 'f').add(
|
161435
|
+
__classPrivateFieldGet(this, _Context_dependencies$1, 'f').add(
|
161321
161436
|
maybeDependency,
|
161322
161437
|
__classPrivateFieldGet(this, _Context_inConditionalWithinScope, 'f') ||
|
161323
161438
|
isPoisoned
|
@@ -161339,9 +161454,9 @@ class Context {
|
|
161339
161454
|
) &&
|
161340
161455
|
__classPrivateFieldGet(
|
161341
161456
|
this,
|
161342
|
-
_Context_instances,
|
161457
|
+
_Context_instances$1,
|
161343
161458
|
'm',
|
161344
|
-
_Context_checkValidDependency
|
161459
|
+
_Context_checkValidDependency$1
|
161345
161460
|
).call(this, {identifier: place.identifier, path: []})
|
161346
161461
|
) {
|
161347
161462
|
currentScope.reassignments.add(place.identifier);
|
@@ -161350,7 +161465,7 @@ class Context {
|
|
161350
161465
|
pushLabeledBlock(id) {
|
161351
161466
|
const currentScope = __classPrivateFieldGet(
|
161352
161467
|
this,
|
161353
|
-
_Context_scopes,
|
161468
|
+
_Context_scopes$1,
|
161354
161469
|
'f'
|
161355
161470
|
).value;
|
161356
161471
|
if (currentScope != null) {
|
@@ -161360,7 +161475,7 @@ class Context {
|
|
161360
161475
|
popLabeledBlock(id) {
|
161361
161476
|
const currentScope = __classPrivateFieldGet(
|
161362
161477
|
this,
|
161363
|
-
_Context_scopes,
|
161478
|
+
_Context_scopes$1,
|
161364
161479
|
'f'
|
161365
161480
|
).value;
|
161366
161481
|
if (currentScope != null) {
|
@@ -161373,17 +161488,17 @@ class Context {
|
|
161373
161488
|
}
|
161374
161489
|
this.poisonState.removeMaybePoisonedBlock(id, currentScope);
|
161375
161490
|
}
|
161376
|
-
}
|
161377
|
-
(_Context_temporariesUsedOutsideScope = new WeakMap()),
|
161378
|
-
(_Context_declarations = new WeakMap()),
|
161379
|
-
(_Context_reassignments = new WeakMap()),
|
161380
|
-
(_Context_dependencies = new WeakMap()),
|
161491
|
+
};
|
161492
|
+
(_Context_temporariesUsedOutsideScope$1 = new WeakMap()),
|
161493
|
+
(_Context_declarations$1 = new WeakMap()),
|
161494
|
+
(_Context_reassignments$1 = new WeakMap()),
|
161495
|
+
(_Context_dependencies$1 = new WeakMap()),
|
161381
161496
|
(_Context_properties = new WeakMap()),
|
161382
|
-
(_Context_temporaries = new WeakMap()),
|
161497
|
+
(_Context_temporaries$1 = new WeakMap()),
|
161383
161498
|
(_Context_inConditionalWithinScope = new WeakMap()),
|
161384
161499
|
(_Context_depsInCurrentConditional = new WeakMap()),
|
161385
|
-
(_Context_scopes = new WeakMap()),
|
161386
|
-
(_Context_instances = new WeakSet()),
|
161500
|
+
(_Context_scopes$1 = new WeakMap()),
|
161501
|
+
(_Context_instances$1 = new WeakSet()),
|
161387
161502
|
(_Context_getProperty = function _Context_getProperty(
|
161388
161503
|
object,
|
161389
161504
|
property,
|
@@ -161407,7 +161522,7 @@ class Context {
|
|
161407
161522
|
objectDependency.path.push({property: property, optional: optional});
|
161408
161523
|
return objectDependency;
|
161409
161524
|
}),
|
161410
|
-
(_Context_checkValidDependency = function _Context_checkValidDependency(
|
161525
|
+
(_Context_checkValidDependency$1 = function _Context_checkValidDependency(
|
161411
161526
|
maybeDependency
|
161412
161527
|
) {
|
161413
161528
|
var _a, _b, _c, _d;
|
@@ -161427,11 +161542,11 @@ class Context {
|
|
161427
161542
|
}
|
161428
161543
|
const identifier = maybeDependency.identifier;
|
161429
161544
|
const currentDeclaration =
|
161430
|
-
(_b = __classPrivateFieldGet(this, _Context_reassignments, 'f').get(
|
161545
|
+
(_b = __classPrivateFieldGet(this, _Context_reassignments$1, 'f').get(
|
161431
161546
|
identifier
|
161432
161547
|
)) !== null && _b !== void 0
|
161433
161548
|
? _b
|
161434
|
-
: __classPrivateFieldGet(this, _Context_declarations, 'f').get(
|
161549
|
+
: __classPrivateFieldGet(this, _Context_declarations$1, 'f').get(
|
161435
161550
|
identifier.declarationId
|
161436
161551
|
);
|
161437
161552
|
const currentScope =
|
@@ -161448,11 +161563,11 @@ class Context {
|
|
161448
161563
|
: _d.value) !== currentScope)
|
161449
161564
|
);
|
161450
161565
|
}),
|
161451
|
-
(_Context_isScopeActive = function _Context_isScopeActive(scope) {
|
161452
|
-
if (__classPrivateFieldGet(this, _Context_scopes, 'f') === null) {
|
161566
|
+
(_Context_isScopeActive$1 = function _Context_isScopeActive(scope) {
|
161567
|
+
if (__classPrivateFieldGet(this, _Context_scopes$1, 'f') === null) {
|
161453
161568
|
return false;
|
161454
161569
|
}
|
161455
|
-
return __classPrivateFieldGet(this, _Context_scopes, 'f').find(
|
161570
|
+
return __classPrivateFieldGet(this, _Context_scopes$1, 'f').find(
|
161456
161571
|
state => state.value === scope
|
161457
161572
|
);
|
161458
161573
|
});
|
@@ -169445,6 +169560,917 @@ function validateNoJSXInTryStatement(fn) {
|
|
169445
169560
|
throw errors;
|
169446
169561
|
}
|
169447
169562
|
}
|
169563
|
+
var _Tree_instances, _a, _Tree_getOrCreateRoot, _Tree_getOrCreateProperty;
|
169564
|
+
function collectHoistablePropertyLoads(fn, temporaries) {
|
169565
|
+
const nodes = collectPropertyLoadsInBlocks(fn, temporaries);
|
169566
|
+
propagateNonNull(fn, nodes);
|
169567
|
+
const nodesKeyedByScopeId = new Map();
|
169568
|
+
for (const [_, block] of fn.body.blocks) {
|
169569
|
+
if (block.terminal.kind === 'scope') {
|
169570
|
+
nodesKeyedByScopeId.set(
|
169571
|
+
block.terminal.scope.id,
|
169572
|
+
nodes.get(block.terminal.block)
|
169573
|
+
);
|
169574
|
+
}
|
169575
|
+
}
|
169576
|
+
return nodesKeyedByScopeId;
|
169577
|
+
}
|
169578
|
+
function getProperty(object, propertyName, temporaries) {
|
169579
|
+
const resolvedDependency = temporaries.get(object.identifier.id);
|
169580
|
+
let property;
|
169581
|
+
if (resolvedDependency == null) {
|
169582
|
+
property = {
|
169583
|
+
identifier: object.identifier,
|
169584
|
+
path: [{property: propertyName, optional: false}],
|
169585
|
+
};
|
169586
|
+
} else {
|
169587
|
+
property = {
|
169588
|
+
identifier: resolvedDependency.identifier,
|
169589
|
+
path: [
|
169590
|
+
...resolvedDependency.path,
|
169591
|
+
{property: propertyName, optional: false},
|
169592
|
+
],
|
169593
|
+
};
|
169594
|
+
}
|
169595
|
+
return property;
|
169596
|
+
}
|
169597
|
+
class Tree {
|
169598
|
+
constructor() {
|
169599
|
+
_Tree_instances.add(this);
|
169600
|
+
this.roots = new Map();
|
169601
|
+
}
|
169602
|
+
getPropertyLoadNode(n) {
|
169603
|
+
CompilerError.invariant(n.path.length > 0, {
|
169604
|
+
reason:
|
169605
|
+
'[CollectHoistablePropertyLoads] Expected property node, found root node',
|
169606
|
+
loc: GeneratedSource,
|
169607
|
+
});
|
169608
|
+
let currNode = __classPrivateFieldGet(
|
169609
|
+
this,
|
169610
|
+
_Tree_instances,
|
169611
|
+
'm',
|
169612
|
+
_Tree_getOrCreateRoot
|
169613
|
+
).call(this, n.identifier);
|
169614
|
+
for (let i = 0; i < n.path.length - 1; i++) {
|
169615
|
+
currNode = assertNonNull(currNode.properties.get(n.path[i].property));
|
169616
|
+
}
|
169617
|
+
return __classPrivateFieldGet(_a, _a, 'm', _Tree_getOrCreateProperty).call(
|
169618
|
+
_a,
|
169619
|
+
currNode,
|
169620
|
+
n.path.at(-1).property
|
169621
|
+
);
|
169622
|
+
}
|
169623
|
+
}
|
169624
|
+
(_a = Tree),
|
169625
|
+
(_Tree_instances = new WeakSet()),
|
169626
|
+
(_Tree_getOrCreateRoot = function _Tree_getOrCreateRoot(identifier) {
|
169627
|
+
let rootNode = this.roots.get(identifier);
|
169628
|
+
if (rootNode === undefined) {
|
169629
|
+
rootNode = {
|
169630
|
+
root: identifier,
|
169631
|
+
properties: new Map(),
|
169632
|
+
fullPath: {identifier: identifier, path: []},
|
169633
|
+
parent: null,
|
169634
|
+
};
|
169635
|
+
this.roots.set(identifier, rootNode);
|
169636
|
+
}
|
169637
|
+
return rootNode;
|
169638
|
+
}),
|
169639
|
+
(_Tree_getOrCreateProperty = function _Tree_getOrCreateProperty(
|
169640
|
+
node,
|
169641
|
+
property
|
169642
|
+
) {
|
169643
|
+
let child = node.properties.get(property);
|
169644
|
+
if (child == null) {
|
169645
|
+
child = {
|
169646
|
+
properties: new Map(),
|
169647
|
+
parent: node,
|
169648
|
+
fullPath: {
|
169649
|
+
identifier: node.fullPath.identifier,
|
169650
|
+
path: node.fullPath.path.concat([
|
169651
|
+
{property: property, optional: false},
|
169652
|
+
]),
|
169653
|
+
},
|
169654
|
+
};
|
169655
|
+
node.properties.set(property, child);
|
169656
|
+
}
|
169657
|
+
return child;
|
169658
|
+
});
|
169659
|
+
function collectPropertyLoadsInBlocks(fn, temporaries) {
|
169660
|
+
const knownImmutableIdentifiers = new Set();
|
169661
|
+
if (fn.fnType === 'Component' || fn.fnType === 'Hook') {
|
169662
|
+
for (const p of fn.params) {
|
169663
|
+
if (p.kind === 'Identifier') {
|
169664
|
+
knownImmutableIdentifiers.add(p.identifier);
|
169665
|
+
}
|
169666
|
+
}
|
169667
|
+
}
|
169668
|
+
const tree = new Tree();
|
169669
|
+
const nodes = new Map();
|
169670
|
+
for (const [_, block] of fn.body.blocks) {
|
169671
|
+
const assumedNonNullObjects = new Set();
|
169672
|
+
for (const instr of block.instructions) {
|
169673
|
+
if (instr.value.kind === 'PropertyLoad') {
|
169674
|
+
const property = getProperty(
|
169675
|
+
instr.value.object,
|
169676
|
+
instr.value.property,
|
169677
|
+
temporaries
|
169678
|
+
);
|
169679
|
+
const propertyNode = tree.getPropertyLoadNode(property);
|
169680
|
+
const object = instr.value.object.identifier;
|
169681
|
+
const isMutableAtInstr =
|
169682
|
+
object.mutableRange.end > object.mutableRange.start + 1 &&
|
169683
|
+
object.scope != null &&
|
169684
|
+
inRange(instr, object.scope.range);
|
169685
|
+
if (
|
169686
|
+
!isMutableAtInstr ||
|
169687
|
+
knownImmutableIdentifiers.has(propertyNode.fullPath.identifier)
|
169688
|
+
) {
|
169689
|
+
let curr = propertyNode.parent;
|
169690
|
+
while (curr != null) {
|
169691
|
+
assumedNonNullObjects.add(curr);
|
169692
|
+
curr = curr.parent;
|
169693
|
+
}
|
169694
|
+
}
|
169695
|
+
}
|
169696
|
+
}
|
169697
|
+
nodes.set(block.id, {
|
169698
|
+
block: block,
|
169699
|
+
assumedNonNullObjects: assumedNonNullObjects,
|
169700
|
+
});
|
169701
|
+
}
|
169702
|
+
return nodes;
|
169703
|
+
}
|
169704
|
+
function propagateNonNull(fn, nodes) {
|
169705
|
+
const blockSuccessors = new Map();
|
169706
|
+
const terminalPreds = new Set();
|
169707
|
+
for (const [blockId, block] of fn.body.blocks) {
|
169708
|
+
for (const pred of block.preds) {
|
169709
|
+
getOrInsertDefault(blockSuccessors, pred, new Set()).add(blockId);
|
169710
|
+
}
|
169711
|
+
if (block.terminal.kind === 'throw' || block.terminal.kind === 'return') {
|
169712
|
+
terminalPreds.add(blockId);
|
169713
|
+
}
|
169714
|
+
}
|
169715
|
+
function recursivelyPropagateNonNull(
|
169716
|
+
nodeId,
|
169717
|
+
direction,
|
169718
|
+
traversalState,
|
169719
|
+
nonNullObjectsByBlock
|
169720
|
+
) {
|
169721
|
+
var _b;
|
169722
|
+
if (traversalState.has(nodeId)) {
|
169723
|
+
return false;
|
169724
|
+
}
|
169725
|
+
traversalState.set(nodeId, 'active');
|
169726
|
+
const node = nodes.get(nodeId);
|
169727
|
+
if (node == null) {
|
169728
|
+
CompilerError.invariant(false, {
|
169729
|
+
reason: `Bad node ${nodeId}, kind: ${direction}`,
|
169730
|
+
loc: GeneratedSource,
|
169731
|
+
});
|
169732
|
+
}
|
169733
|
+
const neighbors = Array.from(
|
169734
|
+
direction === 'backward'
|
169735
|
+
? (_b = blockSuccessors.get(nodeId)) !== null && _b !== void 0
|
169736
|
+
? _b
|
169737
|
+
: []
|
169738
|
+
: node.block.preds
|
169739
|
+
);
|
169740
|
+
let changed = false;
|
169741
|
+
for (const pred of neighbors) {
|
169742
|
+
if (!traversalState.has(pred)) {
|
169743
|
+
const neighborChanged = recursivelyPropagateNonNull(
|
169744
|
+
pred,
|
169745
|
+
direction,
|
169746
|
+
traversalState,
|
169747
|
+
nonNullObjectsByBlock
|
169748
|
+
);
|
169749
|
+
changed || (changed = neighborChanged);
|
169750
|
+
}
|
169751
|
+
}
|
169752
|
+
const neighborAccesses = Set_intersect(
|
169753
|
+
Array.from(neighbors)
|
169754
|
+
.filter(n => traversalState.get(n) === 'done')
|
169755
|
+
.map(n => assertNonNull(nonNullObjectsByBlock.get(n)))
|
169756
|
+
);
|
169757
|
+
const prevObjects = assertNonNull(nonNullObjectsByBlock.get(nodeId));
|
169758
|
+
const newObjects = Set_union(prevObjects, neighborAccesses);
|
169759
|
+
nonNullObjectsByBlock.set(nodeId, newObjects);
|
169760
|
+
traversalState.set(nodeId, 'done');
|
169761
|
+
changed || (changed = prevObjects.size !== newObjects.size);
|
169762
|
+
return changed;
|
169763
|
+
}
|
169764
|
+
const fromEntry = new Map();
|
169765
|
+
const fromExit = new Map();
|
169766
|
+
for (const [blockId, blockInfo] of nodes) {
|
169767
|
+
fromEntry.set(blockId, blockInfo.assumedNonNullObjects);
|
169768
|
+
fromExit.set(blockId, blockInfo.assumedNonNullObjects);
|
169769
|
+
}
|
169770
|
+
const traversalState = new Map();
|
169771
|
+
const reversedBlocks = [...fn.body.blocks];
|
169772
|
+
reversedBlocks.reverse();
|
169773
|
+
let i = 0;
|
169774
|
+
let changed;
|
169775
|
+
do {
|
169776
|
+
i++;
|
169777
|
+
changed = false;
|
169778
|
+
for (const [blockId] of fn.body.blocks) {
|
169779
|
+
const forwardChanged = recursivelyPropagateNonNull(
|
169780
|
+
blockId,
|
169781
|
+
'forward',
|
169782
|
+
traversalState,
|
169783
|
+
fromEntry
|
169784
|
+
);
|
169785
|
+
changed || (changed = forwardChanged);
|
169786
|
+
}
|
169787
|
+
traversalState.clear();
|
169788
|
+
for (const [blockId] of reversedBlocks) {
|
169789
|
+
const backwardChanged = recursivelyPropagateNonNull(
|
169790
|
+
blockId,
|
169791
|
+
'backward',
|
169792
|
+
traversalState,
|
169793
|
+
fromExit
|
169794
|
+
);
|
169795
|
+
changed || (changed = backwardChanged);
|
169796
|
+
}
|
169797
|
+
traversalState.clear();
|
169798
|
+
} while (changed);
|
169799
|
+
CompilerError.invariant(i <= 2, {
|
169800
|
+
reason: 'require fixed-point iteration',
|
169801
|
+
description: `#iterations = ${i}`,
|
169802
|
+
loc: GeneratedSource,
|
169803
|
+
});
|
169804
|
+
CompilerError.invariant(
|
169805
|
+
fromEntry.size === fromExit.size && fromEntry.size === nodes.size,
|
169806
|
+
{
|
169807
|
+
reason:
|
169808
|
+
'bad sizes after calculating fromEntry + fromExit ' +
|
169809
|
+
`${fromEntry.size} ${fromExit.size} ${nodes.size}`,
|
169810
|
+
loc: GeneratedSource,
|
169811
|
+
}
|
169812
|
+
);
|
169813
|
+
for (const [id, node] of nodes) {
|
169814
|
+
node.assumedNonNullObjects = Set_union(
|
169815
|
+
assertNonNull(fromEntry.get(id)),
|
169816
|
+
assertNonNull(fromExit.get(id))
|
169817
|
+
);
|
169818
|
+
}
|
169819
|
+
}
|
169820
|
+
function assertNonNull(value, source) {
|
169821
|
+
CompilerError.invariant(value != null, {
|
169822
|
+
reason: 'Unexpected null',
|
169823
|
+
description: source != null ? `(from ${source})` : null,
|
169824
|
+
loc: GeneratedSource,
|
169825
|
+
});
|
169826
|
+
return value;
|
169827
|
+
}
|
169828
|
+
var _ReactiveScopeDependencyTreeHIR_instances,
|
169829
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169830
|
+
_ReactiveScopeDependencyTreeHIR_getOrCreateRoot;
|
169831
|
+
class ReactiveScopeDependencyTreeHIR {
|
169832
|
+
constructor() {
|
169833
|
+
_ReactiveScopeDependencyTreeHIR_instances.add(this);
|
169834
|
+
_ReactiveScopeDependencyTreeHIR_roots.set(this, new Map());
|
169835
|
+
}
|
169836
|
+
addDependency(dep) {
|
169837
|
+
const {path: path} = dep;
|
169838
|
+
let currNode = __classPrivateFieldGet(
|
169839
|
+
this,
|
169840
|
+
_ReactiveScopeDependencyTreeHIR_instances,
|
169841
|
+
'm',
|
169842
|
+
_ReactiveScopeDependencyTreeHIR_getOrCreateRoot
|
169843
|
+
).call(this, dep.identifier, false);
|
169844
|
+
const accessType = PropertyAccessType.Access;
|
169845
|
+
currNode.accessType = merge(currNode.accessType, accessType);
|
169846
|
+
for (const property of path) {
|
169847
|
+
let currChild = getOrMakeProperty(currNode, property.property);
|
169848
|
+
currChild.accessType = merge(currChild.accessType, accessType);
|
169849
|
+
currNode = currChild;
|
169850
|
+
}
|
169851
|
+
currNode.accessType = merge(
|
169852
|
+
currNode.accessType,
|
169853
|
+
PropertyAccessType.Dependency
|
169854
|
+
);
|
169855
|
+
}
|
169856
|
+
markNodesNonNull(dep) {
|
169857
|
+
const accessType = PropertyAccessType.NonNullAccess;
|
169858
|
+
let currNode = __classPrivateFieldGet(
|
169859
|
+
this,
|
169860
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169861
|
+
'f'
|
169862
|
+
).get(dep.identifier);
|
169863
|
+
let cursor = 0;
|
169864
|
+
while (currNode != null && cursor < dep.path.length) {
|
169865
|
+
currNode.accessType = merge(currNode.accessType, accessType);
|
169866
|
+
currNode = currNode.properties.get(dep.path[cursor++].property);
|
169867
|
+
}
|
169868
|
+
if (currNode != null) {
|
169869
|
+
currNode.accessType = merge(currNode.accessType, accessType);
|
169870
|
+
}
|
169871
|
+
}
|
169872
|
+
deriveMinimalDependencies() {
|
169873
|
+
const results = new Set();
|
169874
|
+
for (const [rootId, rootNode] of __classPrivateFieldGet(
|
169875
|
+
this,
|
169876
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169877
|
+
'f'
|
169878
|
+
).entries()) {
|
169879
|
+
{
|
169880
|
+
assertWellFormedTree(rootNode);
|
169881
|
+
}
|
169882
|
+
const deps = deriveMinimalDependenciesInSubtree(rootNode, []);
|
169883
|
+
for (const dep of deps) {
|
169884
|
+
results.add({
|
169885
|
+
identifier: rootId,
|
169886
|
+
path: dep.path.map(s => ({property: s, optional: false})),
|
169887
|
+
});
|
169888
|
+
}
|
169889
|
+
}
|
169890
|
+
return results;
|
169891
|
+
}
|
169892
|
+
printDeps(includeAccesses) {
|
169893
|
+
let res = [];
|
169894
|
+
for (const [rootId, rootNode] of __classPrivateFieldGet(
|
169895
|
+
this,
|
169896
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169897
|
+
'f'
|
169898
|
+
).entries()) {
|
169899
|
+
const rootResults = printSubtree(rootNode, includeAccesses).map(
|
169900
|
+
result => `${printIdentifier(rootId)}.${result}`
|
169901
|
+
);
|
169902
|
+
res.push(rootResults);
|
169903
|
+
}
|
169904
|
+
return res.flat().join('\n');
|
169905
|
+
}
|
169906
|
+
}
|
169907
|
+
(_ReactiveScopeDependencyTreeHIR_roots = new WeakMap()),
|
169908
|
+
(_ReactiveScopeDependencyTreeHIR_instances = new WeakSet()),
|
169909
|
+
(_ReactiveScopeDependencyTreeHIR_getOrCreateRoot =
|
169910
|
+
function _ReactiveScopeDependencyTreeHIR_getOrCreateRoot(
|
169911
|
+
identifier,
|
169912
|
+
isNonNull
|
169913
|
+
) {
|
169914
|
+
let rootNode = __classPrivateFieldGet(
|
169915
|
+
this,
|
169916
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169917
|
+
'f'
|
169918
|
+
).get(identifier);
|
169919
|
+
if (rootNode === undefined) {
|
169920
|
+
rootNode = {
|
169921
|
+
properties: new Map(),
|
169922
|
+
accessType: isNonNull
|
169923
|
+
? PropertyAccessType.NonNullAccess
|
169924
|
+
: PropertyAccessType.Access,
|
169925
|
+
};
|
169926
|
+
__classPrivateFieldGet(
|
169927
|
+
this,
|
169928
|
+
_ReactiveScopeDependencyTreeHIR_roots,
|
169929
|
+
'f'
|
169930
|
+
).set(identifier, rootNode);
|
169931
|
+
}
|
169932
|
+
return rootNode;
|
169933
|
+
});
|
169934
|
+
var PropertyAccessType;
|
169935
|
+
(function (PropertyAccessType) {
|
169936
|
+
PropertyAccessType['Access'] = 'Access';
|
169937
|
+
PropertyAccessType['NonNullAccess'] = 'NonNullAccess';
|
169938
|
+
PropertyAccessType['Dependency'] = 'Dependency';
|
169939
|
+
PropertyAccessType['NonNullDependency'] = 'NonNullDependency';
|
169940
|
+
})(PropertyAccessType || (PropertyAccessType = {}));
|
169941
|
+
const MIN_ACCESS_TYPE = PropertyAccessType.Access;
|
169942
|
+
function isNonNull(access) {
|
169943
|
+
return (
|
169944
|
+
access === PropertyAccessType.NonNullAccess ||
|
169945
|
+
access === PropertyAccessType.NonNullDependency
|
169946
|
+
);
|
169947
|
+
}
|
169948
|
+
function isDependency(access) {
|
169949
|
+
return (
|
169950
|
+
access === PropertyAccessType.Dependency ||
|
169951
|
+
access === PropertyAccessType.NonNullDependency
|
169952
|
+
);
|
169953
|
+
}
|
169954
|
+
function merge(access1, access2) {
|
169955
|
+
const resultisNonNull = isNonNull(access1) || isNonNull(access2);
|
169956
|
+
const resultIsDependency = isDependency(access1) || isDependency(access2);
|
169957
|
+
if (resultisNonNull) {
|
169958
|
+
if (resultIsDependency) {
|
169959
|
+
return PropertyAccessType.NonNullDependency;
|
169960
|
+
} else {
|
169961
|
+
return PropertyAccessType.NonNullAccess;
|
169962
|
+
}
|
169963
|
+
} else {
|
169964
|
+
if (resultIsDependency) {
|
169965
|
+
return PropertyAccessType.Dependency;
|
169966
|
+
} else {
|
169967
|
+
return PropertyAccessType.Access;
|
169968
|
+
}
|
169969
|
+
}
|
169970
|
+
}
|
169971
|
+
function assertWellFormedTree(node) {
|
169972
|
+
let nonNullInChildren = false;
|
169973
|
+
for (const childNode of node.properties.values()) {
|
169974
|
+
assertWellFormedTree(childNode);
|
169975
|
+
nonNullInChildren || (nonNullInChildren = isNonNull(childNode.accessType));
|
169976
|
+
}
|
169977
|
+
if (nonNullInChildren) {
|
169978
|
+
CompilerError.invariant(isNonNull(node.accessType), {
|
169979
|
+
reason:
|
169980
|
+
'[DeriveMinimialDependencies] Not well formed tree, unexpected non-null node',
|
169981
|
+
description: node.accessType,
|
169982
|
+
loc: GeneratedSource,
|
169983
|
+
});
|
169984
|
+
}
|
169985
|
+
}
|
169986
|
+
function deriveMinimalDependenciesInSubtree(node, path) {
|
169987
|
+
if (isDependency(node.accessType)) {
|
169988
|
+
return [{path: path}];
|
169989
|
+
} else {
|
169990
|
+
if (isNonNull(node.accessType)) {
|
169991
|
+
const result = [];
|
169992
|
+
for (const [childName, childNode] of node.properties) {
|
169993
|
+
result.push(
|
169994
|
+
...deriveMinimalDependenciesInSubtree(childNode, [...path, childName])
|
169995
|
+
);
|
169996
|
+
}
|
169997
|
+
return result;
|
169998
|
+
} else {
|
169999
|
+
return [{path: path}];
|
170000
|
+
}
|
170001
|
+
}
|
170002
|
+
}
|
170003
|
+
function printSubtree(node, includeAccesses) {
|
170004
|
+
const results = [];
|
170005
|
+
for (const [propertyName, propertyNode] of node.properties) {
|
170006
|
+
if (includeAccesses || isDependency(propertyNode.accessType)) {
|
170007
|
+
results.push(`${propertyName} (${propertyNode.accessType})`);
|
170008
|
+
}
|
170009
|
+
const propertyResults = printSubtree(propertyNode, includeAccesses);
|
170010
|
+
results.push(...propertyResults.map(result => `${propertyName}.${result}`));
|
170011
|
+
}
|
170012
|
+
return results;
|
170013
|
+
}
|
170014
|
+
function getOrMakeProperty(node, property) {
|
170015
|
+
let child = node.properties.get(property);
|
170016
|
+
if (child == null) {
|
170017
|
+
child = {properties: new Map(), accessType: MIN_ACCESS_TYPE};
|
170018
|
+
node.properties.set(property, child);
|
170019
|
+
}
|
170020
|
+
return child;
|
170021
|
+
}
|
170022
|
+
var _Context_instances,
|
170023
|
+
_Context_declarations,
|
170024
|
+
_Context_reassignments,
|
170025
|
+
_Context_scopes,
|
170026
|
+
_Context_dependencies,
|
170027
|
+
_Context_temporaries,
|
170028
|
+
_Context_temporariesUsedOutsideScope,
|
170029
|
+
_Context_checkValidDependency,
|
170030
|
+
_Context_isScopeActive;
|
170031
|
+
function propagateScopeDependenciesHIR(fn) {
|
170032
|
+
const usedOutsideDeclaringScope =
|
170033
|
+
findTemporariesUsedOutsideDeclaringScope(fn);
|
170034
|
+
const temporaries = collectTemporariesSidemap(fn, usedOutsideDeclaringScope);
|
170035
|
+
const hoistablePropertyLoads = collectHoistablePropertyLoads(fn, temporaries);
|
170036
|
+
const scopeDeps = collectDependencies(
|
170037
|
+
fn,
|
170038
|
+
usedOutsideDeclaringScope,
|
170039
|
+
temporaries
|
170040
|
+
);
|
170041
|
+
for (const [scope, deps] of scopeDeps) {
|
170042
|
+
const tree = new ReactiveScopeDependencyTreeHIR();
|
170043
|
+
for (const dep of deps) {
|
170044
|
+
tree.addDependency(Object.assign({}, dep));
|
170045
|
+
}
|
170046
|
+
recordHoistablePropertyReads(hoistablePropertyLoads, scope.id, tree);
|
170047
|
+
const candidates = tree.deriveMinimalDependencies();
|
170048
|
+
for (const candidateDep of candidates) {
|
170049
|
+
if (
|
170050
|
+
!Iterable_some(
|
170051
|
+
scope.dependencies,
|
170052
|
+
existingDep =>
|
170053
|
+
existingDep.identifier.declarationId ===
|
170054
|
+
candidateDep.identifier.declarationId &&
|
170055
|
+
areEqualPaths(existingDep.path, candidateDep.path)
|
170056
|
+
)
|
170057
|
+
)
|
170058
|
+
scope.dependencies.add(candidateDep);
|
170059
|
+
}
|
170060
|
+
}
|
170061
|
+
}
|
170062
|
+
function findTemporariesUsedOutsideDeclaringScope(fn) {
|
170063
|
+
const declarations = new Map();
|
170064
|
+
const prunedScopes = new Set();
|
170065
|
+
const scopeTraversal = new ScopeBlockTraversal();
|
170066
|
+
const usedOutsideDeclaringScope = new Set();
|
170067
|
+
function handlePlace(place) {
|
170068
|
+
const declaringScope = declarations.get(place.identifier.declarationId);
|
170069
|
+
if (
|
170070
|
+
declaringScope != null &&
|
170071
|
+
!scopeTraversal.isScopeActive(declaringScope) &&
|
170072
|
+
!prunedScopes.has(declaringScope)
|
170073
|
+
) {
|
170074
|
+
usedOutsideDeclaringScope.add(place.identifier.declarationId);
|
170075
|
+
}
|
170076
|
+
}
|
170077
|
+
function handleInstruction(instr) {
|
170078
|
+
const scope = scopeTraversal.currentScope;
|
170079
|
+
if (scope == null || prunedScopes.has(scope)) {
|
170080
|
+
return;
|
170081
|
+
}
|
170082
|
+
switch (instr.value.kind) {
|
170083
|
+
case 'LoadLocal':
|
170084
|
+
case 'LoadContext':
|
170085
|
+
case 'PropertyLoad': {
|
170086
|
+
declarations.set(instr.lvalue.identifier.declarationId, scope);
|
170087
|
+
break;
|
170088
|
+
}
|
170089
|
+
}
|
170090
|
+
}
|
170091
|
+
for (const [blockId, block] of fn.body.blocks) {
|
170092
|
+
scopeTraversal.recordScopes(block);
|
170093
|
+
const scopeStartInfo = scopeTraversal.blockInfos.get(blockId);
|
170094
|
+
if (
|
170095
|
+
(scopeStartInfo === null || scopeStartInfo === void 0
|
170096
|
+
? void 0
|
170097
|
+
: scopeStartInfo.kind) === 'begin' &&
|
170098
|
+
scopeStartInfo.pruned
|
170099
|
+
) {
|
170100
|
+
prunedScopes.add(scopeStartInfo.scope.id);
|
170101
|
+
}
|
170102
|
+
for (const instr of block.instructions) {
|
170103
|
+
for (const place of eachInstructionOperand(instr)) {
|
170104
|
+
handlePlace(place);
|
170105
|
+
}
|
170106
|
+
handleInstruction(instr);
|
170107
|
+
}
|
170108
|
+
for (const place of eachTerminalOperand(block.terminal)) {
|
170109
|
+
handlePlace(place);
|
170110
|
+
}
|
170111
|
+
}
|
170112
|
+
return usedOutsideDeclaringScope;
|
170113
|
+
}
|
170114
|
+
function collectTemporariesSidemap(fn, usedOutsideDeclaringScope) {
|
170115
|
+
const temporaries = new Map();
|
170116
|
+
for (const [_, block] of fn.body.blocks) {
|
170117
|
+
for (const instr of block.instructions) {
|
170118
|
+
const {value: value, lvalue: lvalue} = instr;
|
170119
|
+
const usedOutside = usedOutsideDeclaringScope.has(
|
170120
|
+
lvalue.identifier.declarationId
|
170121
|
+
);
|
170122
|
+
if (value.kind === 'PropertyLoad' && !usedOutside) {
|
170123
|
+
const property = getProperty(value.object, value.property, temporaries);
|
170124
|
+
temporaries.set(lvalue.identifier.id, property);
|
170125
|
+
} else if (
|
170126
|
+
value.kind === 'LoadLocal' &&
|
170127
|
+
lvalue.identifier.name == null &&
|
170128
|
+
value.place.identifier.name !== null &&
|
170129
|
+
!usedOutside
|
170130
|
+
) {
|
170131
|
+
temporaries.set(lvalue.identifier.id, {
|
170132
|
+
identifier: value.place.identifier,
|
170133
|
+
path: [],
|
170134
|
+
});
|
170135
|
+
}
|
170136
|
+
}
|
170137
|
+
}
|
170138
|
+
return temporaries;
|
170139
|
+
}
|
170140
|
+
class Context {
|
170141
|
+
constructor(temporariesUsedOutsideScope, temporaries) {
|
170142
|
+
_Context_instances.add(this);
|
170143
|
+
_Context_declarations.set(this, new Map());
|
170144
|
+
_Context_reassignments.set(this, new Map());
|
170145
|
+
_Context_scopes.set(this, empty());
|
170146
|
+
_Context_dependencies.set(this, empty());
|
170147
|
+
this.deps = new Map();
|
170148
|
+
_Context_temporaries.set(this, void 0);
|
170149
|
+
_Context_temporariesUsedOutsideScope.set(this, void 0);
|
170150
|
+
__classPrivateFieldSet(
|
170151
|
+
this,
|
170152
|
+
_Context_temporariesUsedOutsideScope,
|
170153
|
+
temporariesUsedOutsideScope,
|
170154
|
+
'f'
|
170155
|
+
);
|
170156
|
+
__classPrivateFieldSet(this, _Context_temporaries, temporaries, 'f');
|
170157
|
+
}
|
170158
|
+
enterScope(scope) {
|
170159
|
+
__classPrivateFieldSet(
|
170160
|
+
this,
|
170161
|
+
_Context_dependencies,
|
170162
|
+
__classPrivateFieldGet(this, _Context_dependencies, 'f').push([]),
|
170163
|
+
'f'
|
170164
|
+
);
|
170165
|
+
__classPrivateFieldSet(
|
170166
|
+
this,
|
170167
|
+
_Context_scopes,
|
170168
|
+
__classPrivateFieldGet(this, _Context_scopes, 'f').push(scope),
|
170169
|
+
'f'
|
170170
|
+
);
|
170171
|
+
}
|
170172
|
+
exitScope(scope, pruned) {
|
170173
|
+
var _a;
|
170174
|
+
const scopedDependencies = __classPrivateFieldGet(
|
170175
|
+
this,
|
170176
|
+
_Context_dependencies,
|
170177
|
+
'f'
|
170178
|
+
).value;
|
170179
|
+
CompilerError.invariant(scopedDependencies != null, {
|
170180
|
+
reason: '[PropagateScopeDeps]: Unexpected scope mismatch',
|
170181
|
+
loc: scope.loc,
|
170182
|
+
});
|
170183
|
+
__classPrivateFieldSet(
|
170184
|
+
this,
|
170185
|
+
_Context_scopes,
|
170186
|
+
__classPrivateFieldGet(this, _Context_scopes, 'f').pop(),
|
170187
|
+
'f'
|
170188
|
+
);
|
170189
|
+
__classPrivateFieldSet(
|
170190
|
+
this,
|
170191
|
+
_Context_dependencies,
|
170192
|
+
__classPrivateFieldGet(this, _Context_dependencies, 'f').pop(),
|
170193
|
+
'f'
|
170194
|
+
);
|
170195
|
+
for (const dep of scopedDependencies) {
|
170196
|
+
if (
|
170197
|
+
__classPrivateFieldGet(
|
170198
|
+
this,
|
170199
|
+
_Context_instances,
|
170200
|
+
'm',
|
170201
|
+
_Context_checkValidDependency
|
170202
|
+
).call(this, dep)
|
170203
|
+
) {
|
170204
|
+
(_a = __classPrivateFieldGet(
|
170205
|
+
this,
|
170206
|
+
_Context_dependencies,
|
170207
|
+
'f'
|
170208
|
+
).value) === null || _a === void 0
|
170209
|
+
? void 0
|
170210
|
+
: _a.push(dep);
|
170211
|
+
}
|
170212
|
+
}
|
170213
|
+
if (!pruned) {
|
170214
|
+
this.deps.set(scope, scopedDependencies);
|
170215
|
+
}
|
170216
|
+
}
|
170217
|
+
isUsedOutsideDeclaringScope(place) {
|
170218
|
+
return __classPrivateFieldGet(
|
170219
|
+
this,
|
170220
|
+
_Context_temporariesUsedOutsideScope,
|
170221
|
+
'f'
|
170222
|
+
).has(place.identifier.declarationId);
|
170223
|
+
}
|
170224
|
+
declare(identifier, decl) {
|
170225
|
+
if (
|
170226
|
+
!__classPrivateFieldGet(this, _Context_declarations, 'f').has(
|
170227
|
+
identifier.declarationId
|
170228
|
+
)
|
170229
|
+
) {
|
170230
|
+
__classPrivateFieldGet(this, _Context_declarations, 'f').set(
|
170231
|
+
identifier.declarationId,
|
170232
|
+
decl
|
170233
|
+
);
|
170234
|
+
}
|
170235
|
+
__classPrivateFieldGet(this, _Context_reassignments, 'f').set(
|
170236
|
+
identifier,
|
170237
|
+
decl
|
170238
|
+
);
|
170239
|
+
}
|
170240
|
+
get currentScope() {
|
170241
|
+
return __classPrivateFieldGet(this, _Context_scopes, 'f');
|
170242
|
+
}
|
170243
|
+
visitOperand(place) {
|
170244
|
+
var _a;
|
170245
|
+
this.visitDependency(
|
170246
|
+
(_a = __classPrivateFieldGet(this, _Context_temporaries, 'f').get(
|
170247
|
+
place.identifier.id
|
170248
|
+
)) !== null && _a !== void 0
|
170249
|
+
? _a
|
170250
|
+
: {identifier: place.identifier, path: []}
|
170251
|
+
);
|
170252
|
+
}
|
170253
|
+
visitProperty(object, property) {
|
170254
|
+
const nextDependency = getProperty(
|
170255
|
+
object,
|
170256
|
+
property,
|
170257
|
+
__classPrivateFieldGet(this, _Context_temporaries, 'f')
|
170258
|
+
);
|
170259
|
+
this.visitDependency(nextDependency);
|
170260
|
+
}
|
170261
|
+
visitDependency(maybeDependency) {
|
170262
|
+
const originalDeclaration = __classPrivateFieldGet(
|
170263
|
+
this,
|
170264
|
+
_Context_declarations,
|
170265
|
+
'f'
|
170266
|
+
).get(maybeDependency.identifier.declarationId);
|
170267
|
+
if (
|
170268
|
+
originalDeclaration !== undefined &&
|
170269
|
+
originalDeclaration.scope.value !== null
|
170270
|
+
) {
|
170271
|
+
originalDeclaration.scope.each(scope => {
|
170272
|
+
if (
|
170273
|
+
!__classPrivateFieldGet(
|
170274
|
+
this,
|
170275
|
+
_Context_instances,
|
170276
|
+
'm',
|
170277
|
+
_Context_isScopeActive
|
170278
|
+
).call(this, scope) &&
|
170279
|
+
!Iterable_some(
|
170280
|
+
scope.declarations.values(),
|
170281
|
+
decl =>
|
170282
|
+
decl.identifier.declarationId ===
|
170283
|
+
maybeDependency.identifier.declarationId
|
170284
|
+
)
|
170285
|
+
) {
|
170286
|
+
scope.declarations.set(maybeDependency.identifier.id, {
|
170287
|
+
identifier: maybeDependency.identifier,
|
170288
|
+
scope: originalDeclaration.scope.value,
|
170289
|
+
});
|
170290
|
+
}
|
170291
|
+
});
|
170292
|
+
}
|
170293
|
+
if (
|
170294
|
+
__classPrivateFieldGet(
|
170295
|
+
this,
|
170296
|
+
_Context_instances,
|
170297
|
+
'm',
|
170298
|
+
_Context_checkValidDependency
|
170299
|
+
).call(this, maybeDependency)
|
170300
|
+
) {
|
170301
|
+
__classPrivateFieldGet(this, _Context_dependencies, 'f').value.push(
|
170302
|
+
maybeDependency
|
170303
|
+
);
|
170304
|
+
}
|
170305
|
+
}
|
170306
|
+
visitReassignment(place) {
|
170307
|
+
const currentScope = this.currentScope.value;
|
170308
|
+
if (
|
170309
|
+
currentScope != null &&
|
170310
|
+
!Iterable_some(
|
170311
|
+
currentScope.reassignments,
|
170312
|
+
identifier =>
|
170313
|
+
identifier.declarationId === place.identifier.declarationId
|
170314
|
+
) &&
|
170315
|
+
__classPrivateFieldGet(
|
170316
|
+
this,
|
170317
|
+
_Context_instances,
|
170318
|
+
'm',
|
170319
|
+
_Context_checkValidDependency
|
170320
|
+
).call(this, {identifier: place.identifier, path: []})
|
170321
|
+
) {
|
170322
|
+
currentScope.reassignments.add(place.identifier);
|
170323
|
+
}
|
170324
|
+
}
|
170325
|
+
}
|
170326
|
+
(_Context_declarations = new WeakMap()),
|
170327
|
+
(_Context_reassignments = new WeakMap()),
|
170328
|
+
(_Context_scopes = new WeakMap()),
|
170329
|
+
(_Context_dependencies = new WeakMap()),
|
170330
|
+
(_Context_temporaries = new WeakMap()),
|
170331
|
+
(_Context_temporariesUsedOutsideScope = new WeakMap()),
|
170332
|
+
(_Context_instances = new WeakSet()),
|
170333
|
+
(_Context_checkValidDependency = function _Context_checkValidDependency(
|
170334
|
+
maybeDependency
|
170335
|
+
) {
|
170336
|
+
var _a, _b;
|
170337
|
+
if (
|
170338
|
+
isUseRefType(maybeDependency.identifier) &&
|
170339
|
+
((_a = maybeDependency.path.at(0)) === null || _a === void 0
|
170340
|
+
? void 0
|
170341
|
+
: _a.property) === 'current'
|
170342
|
+
) {
|
170343
|
+
return false;
|
170344
|
+
}
|
170345
|
+
if (isRefValueType(maybeDependency.identifier)) {
|
170346
|
+
return false;
|
170347
|
+
}
|
170348
|
+
if (isObjectMethodType(maybeDependency.identifier)) {
|
170349
|
+
return false;
|
170350
|
+
}
|
170351
|
+
const identifier = maybeDependency.identifier;
|
170352
|
+
const currentDeclaration =
|
170353
|
+
(_b = __classPrivateFieldGet(this, _Context_reassignments, 'f').get(
|
170354
|
+
identifier
|
170355
|
+
)) !== null && _b !== void 0
|
170356
|
+
? _b
|
170357
|
+
: __classPrivateFieldGet(this, _Context_declarations, 'f').get(
|
170358
|
+
identifier.declarationId
|
170359
|
+
);
|
170360
|
+
const currentScope = this.currentScope.value;
|
170361
|
+
return (
|
170362
|
+
currentScope != null &&
|
170363
|
+
currentDeclaration !== undefined &&
|
170364
|
+
currentDeclaration.id < currentScope.range.start
|
170365
|
+
);
|
170366
|
+
}),
|
170367
|
+
(_Context_isScopeActive = function _Context_isScopeActive(scope) {
|
170368
|
+
if (__classPrivateFieldGet(this, _Context_scopes, 'f') === null) {
|
170369
|
+
return false;
|
170370
|
+
}
|
170371
|
+
return __classPrivateFieldGet(this, _Context_scopes, 'f').find(
|
170372
|
+
state => state === scope
|
170373
|
+
);
|
170374
|
+
});
|
170375
|
+
function handleInstruction(instr, context) {
|
170376
|
+
const {id: id, value: value, lvalue: lvalue} = instr;
|
170377
|
+
if (value.kind === 'LoadLocal') {
|
170378
|
+
if (
|
170379
|
+
value.place.identifier.name === null ||
|
170380
|
+
lvalue.identifier.name !== null ||
|
170381
|
+
context.isUsedOutsideDeclaringScope(lvalue)
|
170382
|
+
) {
|
170383
|
+
context.visitOperand(value.place);
|
170384
|
+
}
|
170385
|
+
} else if (value.kind === 'PropertyLoad') {
|
170386
|
+
if (context.isUsedOutsideDeclaringScope(lvalue)) {
|
170387
|
+
context.visitProperty(value.object, value.property);
|
170388
|
+
}
|
170389
|
+
} else if (value.kind === 'StoreLocal') {
|
170390
|
+
context.visitOperand(value.value);
|
170391
|
+
if (value.lvalue.kind === InstructionKind.Reassign) {
|
170392
|
+
context.visitReassignment(value.lvalue.place);
|
170393
|
+
}
|
170394
|
+
context.declare(value.lvalue.place.identifier, {
|
170395
|
+
id: id,
|
170396
|
+
scope: context.currentScope,
|
170397
|
+
});
|
170398
|
+
} else if (value.kind === 'DeclareLocal' || value.kind === 'DeclareContext') {
|
170399
|
+
context.declare(value.lvalue.place.identifier, {
|
170400
|
+
id: id,
|
170401
|
+
scope: context.currentScope,
|
170402
|
+
});
|
170403
|
+
} else if (value.kind === 'Destructure') {
|
170404
|
+
context.visitOperand(value.value);
|
170405
|
+
for (const place of eachPatternOperand(value.lvalue.pattern)) {
|
170406
|
+
if (value.lvalue.kind === InstructionKind.Reassign) {
|
170407
|
+
context.visitReassignment(place);
|
170408
|
+
}
|
170409
|
+
context.declare(place.identifier, {id: id, scope: context.currentScope});
|
170410
|
+
}
|
170411
|
+
} else {
|
170412
|
+
for (const operand of eachInstructionValueOperand(value)) {
|
170413
|
+
context.visitOperand(operand);
|
170414
|
+
}
|
170415
|
+
}
|
170416
|
+
context.declare(lvalue.identifier, {id: id, scope: context.currentScope});
|
170417
|
+
}
|
170418
|
+
function collectDependencies(fn, usedOutsideDeclaringScope, temporaries) {
|
170419
|
+
const context = new Context(usedOutsideDeclaringScope, temporaries);
|
170420
|
+
for (const param of fn.params) {
|
170421
|
+
if (param.kind === 'Identifier') {
|
170422
|
+
context.declare(param.identifier, {
|
170423
|
+
id: makeInstructionId(0),
|
170424
|
+
scope: empty(),
|
170425
|
+
});
|
170426
|
+
} else {
|
170427
|
+
context.declare(param.place.identifier, {
|
170428
|
+
id: makeInstructionId(0),
|
170429
|
+
scope: empty(),
|
170430
|
+
});
|
170431
|
+
}
|
170432
|
+
}
|
170433
|
+
const scopeTraversal = new ScopeBlockTraversal();
|
170434
|
+
for (const [blockId, block] of fn.body.blocks) {
|
170435
|
+
scopeTraversal.recordScopes(block);
|
170436
|
+
const scopeBlockInfo = scopeTraversal.blockInfos.get(blockId);
|
170437
|
+
if (
|
170438
|
+
(scopeBlockInfo === null || scopeBlockInfo === void 0
|
170439
|
+
? void 0
|
170440
|
+
: scopeBlockInfo.kind) === 'begin'
|
170441
|
+
) {
|
170442
|
+
context.enterScope(scopeBlockInfo.scope);
|
170443
|
+
} else if (
|
170444
|
+
(scopeBlockInfo === null || scopeBlockInfo === void 0
|
170445
|
+
? void 0
|
170446
|
+
: scopeBlockInfo.kind) === 'end'
|
170447
|
+
) {
|
170448
|
+
context.exitScope(
|
170449
|
+
scopeBlockInfo.scope,
|
170450
|
+
scopeBlockInfo === null || scopeBlockInfo === void 0
|
170451
|
+
? void 0
|
170452
|
+
: scopeBlockInfo.pruned
|
170453
|
+
);
|
170454
|
+
}
|
170455
|
+
for (const instr of block.instructions) {
|
170456
|
+
handleInstruction(instr, context);
|
170457
|
+
}
|
170458
|
+
for (const place of eachTerminalOperand(block.terminal)) {
|
170459
|
+
context.visitOperand(place);
|
170460
|
+
}
|
170461
|
+
}
|
170462
|
+
return context.deps;
|
170463
|
+
}
|
170464
|
+
function recordHoistablePropertyReads(nodes, scopeId, tree) {
|
170465
|
+
const node = nodes.get(scopeId);
|
170466
|
+
CompilerError.invariant(node != null, {
|
170467
|
+
reason: '[PropagateScopeDependencies] Scope not found in tracked blocks',
|
170468
|
+
loc: GeneratedSource,
|
170469
|
+
});
|
170470
|
+
for (const item of node.assumedNonNullObjects) {
|
170471
|
+
tree.markNodesNonNull(Object.assign({}, item.fullPath));
|
170472
|
+
}
|
170473
|
+
}
|
169448
170474
|
function* run(
|
169449
170475
|
func,
|
169450
170476
|
config,
|
@@ -169596,6 +170622,10 @@ function* runWithEnvironment(func, env) {
|
|
169596
170622
|
yield log({kind: 'hir', name: 'FlattenScopesWithHooksOrUseHIR', value: hir});
|
169597
170623
|
assertTerminalSuccessorsExist(hir);
|
169598
170624
|
assertTerminalPredsExist(hir);
|
170625
|
+
if (env.config.enablePropagateDepsInHIR) {
|
170626
|
+
propagateScopeDependenciesHIR(hir);
|
170627
|
+
yield log({kind: 'hir', name: 'PropagateScopeDependenciesHIR', value: hir});
|
170628
|
+
}
|
169599
170629
|
const reactiveFunction = buildReactiveFunction(hir);
|
169600
170630
|
yield log({
|
169601
170631
|
kind: 'reactive',
|
@@ -169610,12 +170640,14 @@ function* runWithEnvironment(func, env) {
|
|
169610
170640
|
value: reactiveFunction,
|
169611
170641
|
});
|
169612
170642
|
assertScopeInstructionsWithinScopes(reactiveFunction);
|
169613
|
-
|
169614
|
-
|
169615
|
-
|
169616
|
-
|
169617
|
-
|
169618
|
-
|
170643
|
+
if (!env.config.enablePropagateDepsInHIR) {
|
170644
|
+
propagateScopeDependencies(reactiveFunction);
|
170645
|
+
yield log({
|
170646
|
+
kind: 'reactive',
|
170647
|
+
name: 'PropagateScopeDependencies',
|
170648
|
+
value: reactiveFunction,
|
170649
|
+
});
|
170650
|
+
}
|
169619
170651
|
pruneNonEscapingScopes(reactiveFunction);
|
169620
170652
|
yield log({
|
169621
170653
|
kind: 'reactive',
|