All files / src/compiler/phases/2-analyze/visitors SvelteSelf.js

100% Statements 26/26
100% Branches 7/7
100% Functions 1/1
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 252x 2x 2x 2x 2x 2x 2x 2x 2x 2x 20x 20x 47x 47x 47x 28x 20x 20x 20x 1x 1x 19x 19x 19x  
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import { visit_component } from './shared/component.js';
import * as e from '../../../errors.js';
 
/**
 * @param {AST.SvelteSelf} node
 * @param {Context} context
 */
export function SvelteSelf(node, context) {
	const valid = context.path.some(
		(node) =>
			node.type === 'IfBlock' ||
			node.type === 'EachBlock' ||
			node.type === 'Component' ||
			node.type === 'SnippetBlock'
	);
 
	if (!valid) {
		e.svelte_self_invalid_placement(node);
	}
 
	visit_component(node, context);
}