@@ -20860,6 +20860,7 @@ const BuiltInFireId = 'BuiltInFire';
20860
20860
const BuiltInFireFunctionId = 'BuiltInFireFunction';
20861
20861
const BuiltInUseEffectEventId = 'BuiltInUseEffectEvent';
20862
20862
const BuiltinEffectEventId = 'BuiltInEffectEventFunction';
20863
+ const BuiltInAutodepsId = 'BuiltInAutoDepsId';
20863
20864
const ReanimatedSharedValueId = 'ReanimatedSharedValueId';
20864
20865
const BUILTIN_SHAPES = new Map();
20865
20866
addObject(BUILTIN_SHAPES, BuiltInPropsId, [
@@ -29728,6 +29729,7 @@ const REACT_APIS = [
29728
29729
returnValueKind: ValueKind.Frozen,
29729
29730
}, BuiltInUseEffectEventId),
29730
29731
],
29732
+ ['AUTODEPS', addObject(DEFAULT_SHAPES, BuiltInAutodepsId, [])],
29731
29733
];
29732
29734
TYPED_GLOBALS.push([
29733
29735
'React',
@@ -45235,7 +45237,12 @@ function inferEffectDependencies(fn) {
45235
45237
else if (value.kind === 'CallExpression' ||
45236
45238
value.kind === 'MethodCall') {
45237
45239
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
45238
- if (value.args.length === autodepFnLoads.get(callee.identifier.id) &&
45240
+ const autodepsArgIndex = value.args.findIndex(arg => arg.kind === 'Identifier' &&
45241
+ arg.identifier.type.kind === 'Object' &&
45242
+ arg.identifier.type.shapeId === BuiltInAutodepsId);
45243
+ if (value.args.length > 1 &&
45244
+ autodepsArgIndex > 0 &&
45245
+ autodepFnLoads.has(callee.identifier.id) &&
45239
45246
value.args[0].kind === 'Identifier') {
45240
45247
const effectDeps = [];
45241
45248
const deps = {
@@ -45302,7 +45309,7 @@ function inferEffectDependencies(fn) {
45302
45309
effects: null,
45303
45310
},
45304
45311
});
45305
- value.args.push( Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze }) );
45312
+ value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
45306
45313
fn.env.inferredEffectLocations.add(callee.loc);
45307
45314
}
45308
45315
else if (loadGlobals.has(value.args[0].identifier.id)) {
@@ -45317,7 +45324,7 @@ function inferEffectDependencies(fn) {
45317
45324
effects: null,
45318
45325
},
45319
45326
});
45320
- value.args.push( Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze }) );
45327
+ value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
45321
45328
fn.env.inferredEffectLocations.add(callee.loc);
45322
45329
}
45323
45330
}
@@ -45351,6 +45358,7 @@ function inferEffectDependencies(fn) {
45351
45358
markPredecessors(fn.body);
45352
45359
markInstructionIds(fn.body);
45353
45360
fixScopeAndIdentifierRanges(fn.body);
45361
+ deadCodeElimination(fn);
45354
45362
fn.env.hasInferredEffect = true;
45355
45363
}
45356
45364
}
@@ -45387,7 +45395,7 @@ function rewriteSplices(originalBlock, splices, rewriteBlocks) {
45387
45395
if (rewrite.kind === 'instr') {
45388
45396
currBlock.instructions.push(rewrite.value);
45389
45397
}
45390
- else {
45398
+ else if (rewrite.kind === 'block') {
45391
45399
const { entry, blocks } = rewrite.value;
45392
45400
const entryBlock = blocks.get(entry);
45393
45401
currBlock.instructions.push(...entryBlock.instructions);
0 commit comments