Skip to content

Commit 993f878

Browse files
committed
revert src changes
1 parent 1595c58 commit 993f878

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { binding_properties } from '../bindings.js';
1919
import {
2020
ContentEditableBindings,
2121
EventModifiers,
22-
RenamedRunes,
2322
Runes,
2423
SVGElements,
2524
VoidElements
@@ -1176,12 +1175,8 @@ export const validation_runes = merge(validation, a11y_validators, {
11761175
parent = /** @type {import('estree').Expression} */ (path[--i]);
11771176

11781177
if (!Runes.includes(/** @type {Runes[number]} */ (name))) {
1179-
if (name in RenamedRunes) {
1180-
e.rune_renamed(
1181-
parent,
1182-
name,
1183-
RenamedRunes[/** @type {keyof typeof RenamedRunes} */ (name)]
1184-
);
1178+
if (name === '$effect.active') {
1179+
e.rune_renamed(parent, '$effect.active', '$effect.tracking');
11851180
}
11861181

11871182
e.rune_invalid_name(parent, name);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ export const VoidElements = [
2828

2929
export const PassiveEvents = ['wheel', 'touchstart', 'touchmove', 'touchend', 'touchcancel'];
3030

31-
export const RenamedRunes = /** @type {const}*/ ({ '$effect.active': '$effect.tracking' });
32-
3331
export const Runes = /** @type {const} */ ([
3432
'$state',
3533
'$state.frozen',

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { is_element_node } from './nodes.js';
44
import * as b from '../utils/builders.js';
55
import * as e from '../errors.js';
66
import { extract_identifiers, extract_identifiers_from_destructuring } from '../utils/ast.js';
7-
import { JsKeywords, RenamedRunes, Runes } from './constants.js';
7+
import { JsKeywords, Runes } from './constants.js';
88

99
export class Scope {
1010
/** @type {ScopeRoot} */
@@ -778,23 +778,10 @@ export function get_rune(node, scope) {
778778

779779
joined = n.name + joined;
780780

781-
const is_rune_obj =
782-
n.name !== '$host' && Runes.includes(/** @type {typeof Runes[number]} */ (n.name)); // check if the object of the expression is a rune e.g. `$effect` in `$effect.pre`
783-
784-
const is_rune = Runes.includes(/** @type {typeof Runes[number]} */ (joined));
785-
786-
const is_renamed_rune = joined in RenamedRunes;
787-
788-
if (!is_rune_obj && !is_rune && !is_renamed_rune) return null;
781+
if (!Runes.includes(/** @type {any} */ (joined))) return null;
789782

790783
const binding = scope.get(n.name);
784+
if (binding !== null) return null; // rune name, but references a variable or store
791785

792-
if (binding !== null) return null; // rune name, but references a variable or
793-
794-
if (is_rune) return /** @type {typeof Runes[number] | null} */ (joined);
795-
796-
if (is_renamed_rune)
797-
e.rune_renamed(node, joined, RenamedRunes[/** @type {keyof typeof RenamedRunes} */ (joined)]);
798-
799-
e.rune_invalid_name(node, joined);
786+
return /** @type {typeof Runes[number] | null} */ (joined);
800787
}

0 commit comments

Comments
 (0)