Skip to content

Commit 9c19f8f

Browse files
committed
use var, minor tweaks
1 parent cc3bcae commit 9c19f8f

File tree

1 file changed

+19
-21
lines changed
  • packages/svelte/src/reactivity

1 file changed

+19
-21
lines changed

packages/svelte/src/reactivity/set.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DEV } from 'esm-env';
22
import { source, set } from '../internal/client/reactivity/sources.js';
33
import { get } from '../internal/client/runtime.js';
44

5-
const read = [
5+
var read = [
66
'difference',
77
'forEach',
88
'intersection',
@@ -29,7 +29,7 @@ function get_self() {
2929
return this;
3030
}
3131

32-
let inited = false;
32+
var inited = false;
3333

3434
/**
3535
* @template T
@@ -50,7 +50,7 @@ export class ReactiveSet extends Set {
5050
if (DEV) new Set(value);
5151

5252
if (value) {
53-
for (const element of value) {
53+
for (var element of value) {
5454
this.add(element);
5555
}
5656
}
@@ -62,10 +62,10 @@ export class ReactiveSet extends Set {
6262
#init() {
6363
inited = true;
6464

65-
const proto = ReactiveSet.prototype;
66-
const set_proto = Set.prototype;
65+
var proto = ReactiveSet.prototype;
66+
var set_proto = Set.prototype;
6767

68-
for (const method of read) {
68+
for (var method of read) {
6969
// @ts-ignore
7070
proto[method] = function (...v) {
7171
get(this.#version);
@@ -81,19 +81,19 @@ export class ReactiveSet extends Set {
8181

8282
/** @param {T} value */
8383
has(value) {
84-
let possible_source = this.#sources.get(value);
84+
var source = this.#sources.get(value);
8585

86-
if (possible_source === undefined) {
86+
if (source === undefined) {
8787
get(this.#version);
8888
return false;
8989
}
9090

91-
return get(possible_source);
91+
return get(source);
9292
}
9393

9494
/** @param {T} value */
9595
add(value) {
96-
const sources = this.#sources;
96+
var sources = this.#sources;
9797

9898
if (!sources.has(value)) {
9999
sources.set(value, source(true));
@@ -106,9 +106,9 @@ export class ReactiveSet extends Set {
106106

107107
/** @param {T} value */
108108
delete(value) {
109-
const sources = this.#sources;
109+
var sources = this.#sources;
110+
var source = sources.get(value);
110111

111-
let source = sources.get(value);
112112
if (source !== undefined) {
113113
sources.delete(value);
114114
set(this.#size, sources.size);
@@ -120,11 +120,11 @@ export class ReactiveSet extends Set {
120120
}
121121

122122
clear() {
123-
const sources = this.#sources;
123+
var sources = this.#sources;
124124

125125
if (sources.size !== 0) {
126126
set(this.#size, 0);
127-
for (const source of sources.values()) {
127+
for (var source of sources.values()) {
128128
set(source, false);
129129
}
130130
this.#increment_version();
@@ -141,15 +141,13 @@ export class ReactiveSet extends Set {
141141
values() {
142142
get(this.#version);
143143

144-
const iterator = this.#sources.entries();
144+
var iterator = this.#sources.keys();
145145

146146
return make_iterable(
147147
/** @type {IterableIterator<T>} */ ({
148148
next() {
149-
for (var [value, source] of iterator) {
150-
if (source.v) {
151-
return { value, done: false };
152-
}
149+
for (var value of iterator) {
150+
return { value, done: false };
153151
}
154152

155153
return { done: true };
@@ -159,12 +157,12 @@ export class ReactiveSet extends Set {
159157
}
160158

161159
entries() {
162-
const iterator = this.values();
160+
var iterator = this.values();
163161

164162
return make_iterable(
165163
/** @type {IterableIterator<[T, T]>} */ ({
166164
next() {
167-
for (const value of iterator) {
165+
for (var value of iterator) {
168166
return { value: [value, value], done: false };
169167
}
170168

0 commit comments

Comments
 (0)