Skip to content

Commit 15dc2b9

Browse files
committed
ignore warning
1 parent c27510f commit 15dc2b9

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/LabeledStatement.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/** @import { Expression, LabeledStatement, Statement } from 'estree' */
33
/** @import { ReactiveStatement } from '#compiler' */
44
/** @import { ComponentContext } from '../types' */
5-
import { dev, locator } from '../../../../state.js';
5+
import { dev, is_ignored, locator } from '../../../../state.js';
66
import * as b from '../../../../utils/builders.js';
77
import { build_getter } from '../utils.js';
88

@@ -50,7 +50,10 @@ export function LabeledStatement(node, context) {
5050
sequence.push(serialized);
5151
}
5252

53-
const location = dev ? locator(/** @type {number} */ (node.start)) : undefined;
53+
const location =
54+
dev && !is_ignored(node, 'reactive_declaration_non_reactive_property')
55+
? locator(/** @type {number} */ (node.start))
56+
: undefined;
5457

5558
// these statements will be topologically ordered later
5659
context.state.legacy_reactive_statements.set(

packages/svelte/src/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([
4444
'hydration_attribute_changed',
4545
'hydration_html_changed',
4646
'ownership_invalid_binding',
47-
'ownership_invalid_mutation'
47+
'ownership_invalid_mutation',
48+
'reactive_declaration_non_reactive_property'
4849
]);
4950

5051
/**

packages/svelte/src/internal/client/dev/location.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { dev_current_component_function } from '../runtime.js';
88
* @param {number} [column]
99
*/
1010
export function get_location(line, column) {
11-
if (!DEV) return undefined;
11+
if (!DEV || line === undefined) return undefined;
1212

1313
var filename = dev_current_component_function?.[FILENAME];
1414
var location = filename && `${filename}:${line}:${column}`;

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export function legacy_pre_effect(deps, fn, line, column) {
275275
var token = { effect: null, ran: false };
276276
context.l.r1.push(token);
277277

278-
if (DEV) {
278+
if (DEV && line !== undefined) {
279279
var location = get_location(line, column);
280280
var explicit_deps = capture_signals(deps);
281281
}
@@ -290,7 +290,7 @@ export function legacy_pre_effect(deps, fn, line, column) {
290290
token.ran = true;
291291
set(context.l.r2, true);
292292

293-
if (DEV) {
293+
if (location) {
294294
var implicit_deps = capture_signals(() => untrack(fn));
295295

296296
for (const signal of implicit_deps) {

0 commit comments

Comments
 (0)