Skip to content

Commit 9a1eb6e

Browse files
committed
lint
1 parent 44c9c89 commit 9a1eb6e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export function IfBlock(node, context) {
1414
const consequent = /** @type {BlockStatement} */ (context.visit(node.consequent));
1515
context.state.template.push('<!>');
1616
if (evaluated.is_truthy) {
17-
context.state.init.push(b.stmt(b.call(b.arrow([b.id('$$anchor')], consequent), context.state.node)));
17+
context.state.init.push(
18+
b.stmt(b.call(b.arrow([b.id('$$anchor')], consequent), context.state.node))
19+
);
1820
} else {
1921
const statements = [];
2022
const consequent_id = context.state.scope.generate('consequent');

packages/svelte/src/compiler/phases/3-transform/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,12 @@ export function transform_inspect_rune(node, context) {
488488
}
489489

490490
/**
491-
* Whether a `BlockStatement` needs to be a block statement as opposed to just inlining all of its statements.
491+
* Whether a `BlockStatement` needs to be a block statement as opposed to just inlining all of its statements.
492492
* @param {BlockStatement} block
493493
*/
494494
export function needs_new_scope(block) {
495-
const has_vars = block.body.some(child => child.type === 'VariableDeclaration');
496-
const has_fns = block.body.some(child => child.type === 'FunctionDeclaration');
497-
const has_class = block.body.some(child => child.type === 'ClassDeclaration');
495+
const has_vars = block.body.some((child) => child.type === 'VariableDeclaration');
496+
const has_fns = block.body.some((child) => child.type === 'FunctionDeclaration');
497+
const has_class = block.body.some((child) => child.type === 'ClassDeclaration');
498498
return has_vars || has_fns || has_class;
499-
}
499+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ export class Scope {
10111011
/**
10121012
* A set of all the names referenced with this scope
10131013
* — useful for generating unique names
1014-
* @type {Map<string, { node: Identifier; path: AST.SvelteNode[] }[]>}
1014+
* @type {Map<string, { node: Identifier; path: AST.SvelteNode[], scope: Scope }[]>}
10151015
*/
10161016
references = new Map();
10171017

@@ -1145,7 +1145,7 @@ export class Scope {
11451145

11461146
if (!references) this.references.set(node.name, (references = []));
11471147

1148-
references.push({ node, path });
1148+
references.push({ node, path, scope: this });
11491149

11501150
const binding = this.declarations.get(node.name);
11511151
if (binding) {

0 commit comments

Comments
 (0)