Skip to content

Commit 31a4449

Browse files
authored
chore: remove unused EACH_KEYED constant (#12814)
1 parent 9ba370f commit 31a4449

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {
77
EACH_IS_ANIMATED,
88
EACH_IS_CONTROLLED,
99
EACH_ITEM_IMMUTABLE,
10-
EACH_ITEM_REACTIVE,
11-
EACH_KEYED
10+
EACH_ITEM_REACTIVE
1211
} from '../../../../../constants.js';
1312
import { dev } from '../../../../state.js';
1413
import { extract_paths, object } from '../../../../utils/ast.js';
@@ -42,12 +41,8 @@ export function EachBlock(node, context) {
4241

4342
let flags = 0;
4443

45-
if (node.metadata.keyed) {
46-
flags |= EACH_KEYED;
47-
48-
if (node.index) {
49-
flags |= EACH_INDEX_REACTIVE;
50-
}
44+
if (node.metadata.keyed && node.index) {
45+
flags |= EACH_INDEX_REACTIVE;
5146
}
5247

5348
const key_is_item =
@@ -252,7 +247,7 @@ export function EachBlock(node, context) {
252247
declarations.push(b.let(node.index, index));
253248
}
254249

255-
if (dev && (flags & EACH_KEYED) !== 0) {
250+
if (dev && node.metadata.keyed) {
256251
context.state.init.push(
257252
b.stmt(b.call('$.validate_each_keys', b.thunk(collection), key_function))
258253
);

packages/svelte/src/constants.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
export const EACH_ITEM_REACTIVE = 1;
22
export const EACH_INDEX_REACTIVE = 1 << 1;
3-
export const EACH_KEYED = 1 << 2;
4-
53
/** See EachBlock interface metadata.is_controlled for an explanation what this is */
6-
export const EACH_IS_CONTROLLED = 1 << 3;
7-
export const EACH_IS_ANIMATED = 1 << 4;
8-
export const EACH_ITEM_IMMUTABLE = 1 << 5;
4+
export const EACH_IS_CONTROLLED = 1 << 2;
5+
export const EACH_IS_ANIMATED = 1 << 3;
6+
export const EACH_ITEM_IMMUTABLE = 1 << 4;
97

108
export const PROPS_IS_IMMUTABLE = 1;
119
export const PROPS_IS_RUNES = 1 << 1;

0 commit comments

Comments
 (0)