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 25 26 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 1072x 312x 312x 312x 312x 294x 294x 312x 1072x 1072x 1072x 995x 995x 1072x 1072x 1072x | /** @import { OnDirective } from '#compiler' */
/** @import { Context } from '../types' */
import * as w from '../../../warnings.js';
/**
* @param {OnDirective} node
* @param {Context} context
*/
export function OnDirective(node, context) {
if (context.state.analysis.runes) {
const parent_type = context.path.at(-1)?.type;
// Don't warn on component events; these might not be under the author's control so the warning would be unactionable
if (parent_type === 'RegularElement' || parent_type === 'SvelteElement') {
w.event_directive_deprecated(node, node.name);
}
}
const parent = context.path.at(-1);
if (parent?.type === 'SvelteElement' || parent?.type === 'RegularElement') {
context.state.analysis.event_directive_node ??= node;
}
context.next({ ...context.state, expression: node.metadata.expression });
}
|