0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 01:11:24 +01:00

reduce indirection

This commit is contained in:
Rich-Harris 2017-04-19 14:10:00 -04:00
parent 6587cbdbac
commit 4cb1578147
3 changed files with 2 additions and 7 deletions

View File

@ -78,11 +78,6 @@ export default class Block {
return this.generator.contextualise( this, expression, context, isEventHandler );
}
createAnchor ( name, parentNode ) {
const renderStatement = `${this.generator.helper( 'createComment' )}()`;
this.addElement( name, renderStatement, parentNode, true );
}
findDependencies ( expression ) {
return this.generator.findDependencies( this.contextDependencies, this.indexes, expression );
}

View File

@ -35,7 +35,7 @@ export default function visitEachBlock ( generator, block, state, node ) {
}
if ( node.needsAnchor ) {
block.createAnchor( anchor, state.parentNode );
block.addElement( anchor, `${generator.helper( 'createComment' )}()`, state.parentNode, true );
} else if ( node.next ) {
node.next.usedAsAnchor = true;
}

View File

@ -47,7 +47,7 @@ export default function visitIfBlock ( generator, block, state, node ) {
const vars = { name, anchor, params };
if ( node.needsAnchor ) {
block.createAnchor( anchor, state.parentNode );
block.addElement( anchor, `${generator.helper( 'createComment' )}()`, state.parentNode, true );
} else if ( node.next ) {
node.next.usedAsAnchor = true;
}