@@ -28,11 +28,11 @@ export function RenderTag(node, context) {
2828let resolved = callee . type === 'Identifier' && is_resolved_snippet ( binding ) ;
2929
3030/** @type {AST.SnippetBlock | undefined } */
31- let snippet
31+ let snippet ;
3232
3333if ( binding ?. initial ?. type === 'SnippetBlock' ) {
3434// if this render tag unambiguously references a local snippet, our job is easy
35- snippet = binding . initial
35+ snippet = binding . initial ;
3636node . metadata . snippets . add ( snippet ) ;
3737}
3838
@@ -53,20 +53,22 @@ export function RenderTag(node, context) {
5353) {
5454e . render_tag_invalid_call_expression ( node ) ;
5555}
56-
56+
5757const parent = context . path . at ( - 2 ) ;
58- const is_animated = snippet ?. body . nodes . some ( n => is_animate_directive ( n ) ) ;
58+ const is_animated = snippet ?. body . nodes . some ( ( n ) => is_animate_directive ( n ) ) ;
5959
60- if ( is_animated ) {
60+ if ( is_animated ) {
6161if ( parent ?. type !== 'EachBlock' ) {
6262e . animation_invalid_placement ( node ) ;
63- }
64- else if ( ! parent . key ) {
63+ } else if ( ! parent . key ) {
6564e . animation_missing_key ( parent ) ;
66- } else if ( parent . body . nodes . filter ( ( n ) =>
67- n . type !== 'Comment' &&
68- n . type !== 'ConstTag' &&
69- ( n . type !== 'Text' || n . data . trim ( ) !== '' ) ) . length > 1
65+ } else if (
66+ parent . body . nodes . filter (
67+ ( n ) =>
68+ n . type !== 'Comment' &&
69+ n . type !== 'ConstTag' &&
70+ ( n . type !== 'Text' || n . data . trim ( ) !== '' )
71+ ) . length > 1
7072) {
7173e . animation_invalid_placement ( node ) ;
7274}
@@ -77,17 +79,17 @@ export function RenderTag(node, context) {
7779context . next ( { ...context . state , render_tag : node } ) ;
7880}
7981
80- /**
82+ /**
8183 * @param {AST.Text | AST.Tag | AST.ElementLike | AST.Comment | AST.Block } child
8284 * @param {boolean } render_snippet
8385 * @returns {boolean }
84- */
86+ */
8587function is_animate_directive ( child , render_snippet = false ) {
8688if ( child . type === 'RenderTag' ) {
87- if ( render_snippet ) return false // Prevent infinite recursion
89+ if ( render_snippet ) return false ; // Prevent infinite recursion
8890for ( const snippet_block of child . metadata . snippets ) {
89- if ( snippet_block . body . nodes . includes ( child ) ) break
90- return snippet_block . body . nodes . some ( n => is_animate_directive ( n , true ) ) ;
91+ if ( snippet_block . body . nodes . includes ( child ) ) break ;
92+ return snippet_block . body . nodes . some ( ( n ) => is_animate_directive ( n , true ) ) ;
9193}
9294}
9395if ( child . type !== 'RegularElement' && child . type !== 'SvelteElement' ) return false ;
0 commit comments