Skip to content

Commit 7958eb7

Browse files
authored
chore: remove unnecessary binding.is_called property (#15361)
1 parent 1b882fb commit 7958eb7

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

.changeset/green-geckos-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
chore: remove unnecessary `binding.is_called` property

packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function get_delegated_event(event_name, handler, context) {
162162
return unhoisted;
163163
}
164164

165-
if (binding !== null && binding.initial !== null && !binding.updated && !binding.is_called) {
165+
if (binding !== null && binding.initial !== null && !binding.updated) {
166166
const binding_type = binding.initial.type;
167167

168168
if (

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,6 @@ export function CallExpression(node, context) {
213213
break;
214214
}
215215

216-
if (node.callee.type === 'Identifier') {
217-
const binding = context.state.scope.get(node.callee.name);
218-
219-
if (binding !== null) {
220-
binding.is_called = true;
221-
}
222-
}
223-
224216
// `$inspect(foo)` or `$derived(foo) should not trigger the `static-state-reference` warning
225217
if (rune === '$inspect' || rune === '$derived') {
226218
context.next({ ...context.state, function_depth: context.state.function_depth + 1 });
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @import { TaggedTemplateExpression, VariableDeclarator } from 'estree' */
1+
/** @import { TaggedTemplateExpression } from 'estree' */
22
/** @import { Context } from '../types' */
33
import { is_pure } from './shared/utils.js';
44

@@ -12,12 +12,5 @@ export function TaggedTemplateExpression(node, context) {
1212
context.state.expression.has_state = true;
1313
}
1414

15-
if (node.tag.type === 'Identifier') {
16-
const binding = context.state.scope.get(node.tag.name);
17-
18-
if (binding !== null) {
19-
binding.is_called = true;
20-
}
21-
}
2215
context.next();
2316
}

packages/svelte/src/compiler/phases/scope.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export class Binding {
5757
*/
5858
metadata = null;
5959

60-
is_called = false;
6160
mutated = false;
6261
reassigned = false;
6362

0 commit comments

Comments
 (0)