Skip to content

Commit bfeb9ad

Browse files
authored
chore: create binding.updated getter (#15362)
1 parent 53d1b17 commit bfeb9ad

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export function analyze_component(root, source, options) {
565565
binding.declaration_kind !== 'import'
566566
) {
567567
binding.kind = 'state';
568-
binding.mutated = binding.updated = true;
568+
binding.mutated = true;
569569
}
570570
}
571571
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function ExportSpecifier(node, context) {
2222
});
2323

2424
const binding = context.state.scope.get(local_name);
25-
if (binding) binding.reassigned = binding.updated = true;
25+
if (binding) binding.reassigned = true;
2626
}
2727
} else {
2828
validate_export(node, context.state.scope, local_name);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export class Binding {
6060
is_called = false;
6161
mutated = false;
6262
reassigned = false;
63-
updated = false;
6463

6564
/**
6665
*
@@ -77,6 +76,10 @@ export class Binding {
7776
this.kind = kind;
7877
this.declaration_kind = declaration_kind;
7978
}
79+
80+
get updated() {
81+
return this.mutated || this.reassigned;
82+
}
8083
}
8184

8285
export class Scope {
@@ -738,8 +741,6 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
738741
const binding = left && scope.get(left.name);
739742

740743
if (binding !== null && left !== binding.node) {
741-
binding.updated = true;
742-
743744
if (left === expression) {
744745
binding.reassigned = true;
745746
} else {

0 commit comments

Comments
 (0)