get rid of tmp variable, we dont need it

pull/490/head
Rich-Harris 9 years ago
parent 950f2ce2fd
commit 2e7a429684

@ -154,9 +154,4 @@ export default class Block {
}
`;
}
tmp () {
if ( !this._tmp ) this._tmp = this.getUniqueName( 'tmp' );
return this._tmp;
}
}

@ -81,8 +81,7 @@ export default function visitAttribute ( generator, block, state, node, attribut
block.builders.create.addLine( updater );
block.builders.update.addBlock( deindent`
if ( ( ${block.tmp()} = ${value} ) !== ${last} ) {
${last} = ${block.tmp()};
if ( ${last} !== ( ${last} = ${value} ) ) {
${updater}
}
` );

@ -9,8 +9,8 @@ export default function visitMustacheTag ( generator, block, state, node ) {
block.addElement( name, `${generator.helper( 'createText' )}( last_${name} )`, state.parentNode, true );
block.builders.update.addBlock( deindent`
if ( ( ${block.tmp()} = ${snippet} ) !== last_${name} ) {
${name}.data = last_${name} = ${block.tmp()};
if ( last_${name} !== ( last_${name} = ${snippet} ) ) {
${name}.data = last_${name};
}
` );
}

@ -26,8 +26,7 @@ export default function visitRawMustacheTag ( generator, block, state, node ) {
}
block.builders.update.addBlock( deindent`
if ( ( ${block.tmp()} = ${snippet} ) !== last_${name} ) {
last_${name} = ${block.tmp()};
if ( last_${name} !== ( last_${name} = ${snippet} ) ) {
${detachStatement}
${mountStatement}
}

@ -75,18 +75,15 @@ function create_each_block ( root, each_block_value, comment, comment_index, com
},
update: function ( changed, root, each_block_value, comment, comment_index ) {
var tmp;
if ( ( tmp = comment.author ) !== last_text ) {
text.data = last_text = tmp;
if ( last_text !== ( last_text = comment.author ) ) {
text.data = last_text;
}
if ( ( tmp = root.elapsed(comment.time, root.time) ) !== last_text_2 ) {
text_2.data = last_text_2 = tmp;
if ( last_text_2 !== ( last_text_2 = root.elapsed(comment.time, root.time) ) ) {
text_2.data = last_text_2;
}
if ( ( tmp = comment.html ) !== last_raw ) {
last_raw = tmp;
if ( last_raw !== ( last_raw = comment.html ) ) {
detachBetween( raw_before, raw_after );
raw_before.insertAdjacentHTML( 'afterend', last_raw );
}

Loading…
Cancel
Save