0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

remove unnecessary if statement

This commit is contained in:
Rich-Harris 2017-05-03 21:35:15 -04:00
parent fa80261ae2
commit d8364f6e0a
6 changed files with 10 additions and 11 deletions

View File

@ -83,7 +83,6 @@ export default function dom ( parsed, source, options ) {
` );
}
// TODO is the `if ( this._fragment )` condition necessary?
builders._set.addBlock( deindent`
${options.dev && deindent`
if ( typeof newState !== 'object' ) {
@ -99,7 +98,7 @@ export default function dom ( parsed, source, options ) {
this._state = ${generator.helper( 'assign' )}( {}, oldState, newState );
${computations.length && `${generator.alias( 'recompute' )}( this._state, newState, oldState, false )`}
${generator.helper( 'dispatchObservers' )}( this, this._observers.pre, newState, oldState );
${block.hasUpdateMethod && `if ( this._fragment ) this._fragment.update( newState, this._state );`}
${block.hasUpdateMethod && `this._fragment.update( newState, this._state );`}
${generator.helper( 'dispatchObservers' )}( this, this._observers.post, newState, oldState );
${generator.hasComplexBindings && `while ( this._bindings.length ) this._bindings.pop()();`}
${( generator.hasComponents || generator.hasIntroTransitions ) && `this._flush();`}

View File

@ -69,7 +69,7 @@ SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
if ( this._fragment ) this._fragment.update( newState, this._state );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
@ -83,4 +83,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio
this._torndown = true;
};
export default SvelteComponent;
export default SvelteComponent;

View File

@ -145,7 +145,7 @@ SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
if ( this._fragment ) this._fragment.update( newState, this._state );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
@ -159,4 +159,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio
this._torndown = true;
};
export default SvelteComponent;
export default SvelteComponent;

View File

@ -95,7 +95,7 @@ SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
if ( this._fragment ) this._fragment.update( newState, this._state );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};

View File

@ -76,7 +76,7 @@ SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
if ( this._fragment ) this._fragment.update( newState, this._state );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
@ -90,4 +90,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio
this._torndown = true;
};
export default SvelteComponent;
export default SvelteComponent;

View File

@ -226,7 +226,7 @@ SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
if ( this._fragment ) this._fragment.update( newState, this._state );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
@ -240,4 +240,4 @@ SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = functio
this._torndown = true;
};
export default SvelteComponent;
export default SvelteComponent;