File tree Expand file tree Collapse file tree 3 files changed +2
-24
lines changed
packages/svelte/src/compiler Expand file tree Collapse file tree 3 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import * as assert from '../../utils/assert.js';
55import {
66 extract_identifiers ,
77 extract_paths ,
8- get_callee_name ,
98 is_event_attribute ,
109 is_text_attribute ,
1110 object
@@ -268,11 +267,7 @@ export function analyze_component(root, options) {
268267 ! Runes . includes ( name ) ||
269268 ( declaration !== null &&
270269 // const state = $state(0) is valid
271- ! Runes . includes (
272- /** @type {string } */ (
273- get_callee_name ( /** @type {import('estree').Expression } */ ( declaration . initial ) )
274- )
275- ) &&
270+ get_rune ( declaration . initial , instance . scope ) === null &&
276271 // allow `import { derived } from 'svelte/store'` in the same file as `const x = $derived(..)` because one is not a subscription to the other
277272 ! (
278273 name === '$derived' &&
Original file line number Diff line number Diff line change @@ -3,11 +3,7 @@ import { walk } from 'zimmerframe';
33import { is_element_node } from './nodes.js' ;
44import * as b from '../utils/builders.js' ;
55import { error } from '../errors.js' ;
6- import {
7- extract_identifiers ,
8- extract_identifiers_from_expression ,
9- get_callee_name
10- } from '../utils/ast.js' ;
6+ import { extract_identifiers , extract_identifiers_from_expression } from '../utils/ast.js' ;
117import { Runes } from './constants.js' ;
128
139export class Scope {
Original file line number Diff line number Diff line change @@ -20,19 +20,6 @@ export function object(expression) {
2020 return expression ;
2121}
2222
23- /**
24- * Returns the name of callee if the given expression is a call expression.
25- * @param {import('estree').Expression | null | undefined } node
26- */
27- export function get_callee_name ( node ) {
28- if ( ! node ) return null ;
29- if ( node . type !== 'CallExpression' ) return null ;
30- if ( node . callee . type !== 'Identifier' && node . callee . type !== 'MemberExpression' ) return null ;
31-
32- const id = object ( node . callee ) ;
33- return id === null ? null : id . name ;
34- }
35-
3623/**
3724 * Returns true if the attribute contains a single static text node.
3825 * @param {import('#compiler').Attribute } attribute
You can’t perform that action at this time.
0 commit comments