From 4cb1578147c83d8a5266dd1ba9609418733b466f Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 19 Apr 2017 14:10:00 -0400 Subject: [PATCH] reduce indirection --- src/generators/dom/Block.js | 5 ----- src/generators/dom/visitors/EachBlock.js | 2 +- src/generators/dom/visitors/IfBlock.js | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index e14d8591f4d1..aa023dfaaf94 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -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 ); } diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index bf7e63b4d065..049769132fb5 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -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; } diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index d9fd1b81c74a..e6c3d9952a7e 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -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; }