@@ -311,7 +311,10 @@ namespace ts {
311311 for ( let i = 0 ; i < properties . length ; i ++ ) {
312312 const p = properties [ i ] ;
313313 if ( p . kind === SyntaxKind . PropertyAssignment || p . kind === SyntaxKind . ShorthandPropertyAssignment ) {
314- if ( ! transformRest || p . transformFlags & TransformFlags . ContainsSpreadExpression ) {
314+ if ( transformRest && ! ( p . transformFlags & TransformFlags . ContainsSpreadExpression ) ) {
315+ es2015 . push ( p ) ;
316+ }
317+ else {
315318 if ( es2015 . length ) {
316319 emitRestAssignment ( es2015 , value , location , target ) ;
317320 es2015 = [ ] ;
@@ -321,9 +324,6 @@ namespace ts {
321324 // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
322325 emitDestructuringAssignment ( bindingTarget , createDestructuringPropertyAccess ( value , propName ) , p ) ;
323326 }
324- else {
325- es2015 . push ( p ) ;
326- }
327327 }
328328 else if ( i === properties . length - 1 && p . kind === SyntaxKind . SpreadElementExpression ) {
329329 Debug . assert ( ( p as SpreadElementExpression ) . expression . kind === SyntaxKind . Identifier ) ;
@@ -460,7 +460,11 @@ namespace ts {
460460 name ) ;
461461 emitBindingElement ( element , restCall ) ;
462462 }
463- else if ( ! transformRest || element . transformFlags & TransformFlags . ContainsSpreadExpression ) {
463+ else if ( transformRest && ! ( element . transformFlags & TransformFlags . ContainsSpreadExpression ) ) {
464+ // do not emit until we have a complete bundle of ES2015 syntax
465+ es2015 . push ( element ) ;
466+ }
467+ else {
464468 if ( es2015 . length ) {
465469 emitRestAssignment ( es2015 , value , target , target ) ;
466470 es2015 = [ ] ;
@@ -469,10 +473,6 @@ namespace ts {
469473 const propName = element . propertyName || < Identifier > element . name ;
470474 emitBindingElement ( element , createDestructuringPropertyAccess ( value , propName ) ) ;
471475 }
472- else {
473- // do not emit until we have a complete bundle of ES2015 syntax
474- es2015 . push ( element ) ;
475- }
476476 }
477477 if ( es2015 . length ) {
478478 emitRestAssignment ( es2015 , value , target , target ) ;
0 commit comments