@@ -13,6 +13,7 @@ namespace ts {
1313 * @param visitor An optional visitor to use to visit expressions.
1414 */
1515 export function flattenDestructuringAssignment (
16+ context : TransformationContext ,
1617 node : BinaryExpression ,
1718 needsValue : boolean ,
1819 recordTempVariable : ( node : Identifier ) => void ,
@@ -44,7 +45,7 @@ namespace ts {
4445 location = node . right ;
4546 }
4647
47- flattenDestructuring ( node , value , location , emitAssignment , emitTempVariableAssignment , visitor ) ;
48+ flattenDestructuring ( context , node , value , location , emitAssignment , emitTempVariableAssignment , visitor ) ;
4849
4950 if ( needsValue ) {
5051 expressions . push ( value ) ;
@@ -57,7 +58,7 @@ namespace ts {
5758 function emitAssignment ( name : Identifier , value : Expression , location : TextRange ) {
5859 const expression = createAssignment ( name , value , location ) ;
5960 if ( isSimpleExpression ( value ) ) {
60- expression . disableSourceMap = true ;
61+ context . setNodeEmitFlags ( expression , NodeEmitFlags . NoNestedSourceMaps ) ;
6162 }
6263
6364 aggregateTransformFlags ( expression ) ;
@@ -79,17 +80,21 @@ namespace ts {
7980 * @param value The rhs value for the binding pattern.
8081 * @param visitor An optional visitor to use to visit expressions.
8182 */
82- export function flattenParameterDestructuring ( node : ParameterDeclaration , value : Expression , visitor ?: ( node : Node ) => VisitResult < Node > ) {
83+ export function flattenParameterDestructuring (
84+ context : TransformationContext ,
85+ node : ParameterDeclaration ,
86+ value : Expression ,
87+ visitor ?: ( node : Node ) => VisitResult < Node > ) {
8388 const declarations : VariableDeclaration [ ] = [ ] ;
8489
85- flattenDestructuring ( node , value , node , emitAssignment , emitTempVariableAssignment , visitor ) ;
90+ flattenDestructuring ( context , node , value , node , emitAssignment , emitTempVariableAssignment , visitor ) ;
8691
8792 return declarations ;
8893
8994 function emitAssignment ( name : Identifier , value : Expression , location : TextRange ) {
9095 const declaration = createVariableDeclaration ( name , value , location ) ;
9196 if ( isSimpleExpression ( value ) ) {
92- declaration . disableSourceMap = true ;
97+ context . setNodeEmitFlags ( declaration , NodeEmitFlags . NoNestedSourceMaps ) ;
9398 }
9499
95100 aggregateTransformFlags ( declaration ) ;
@@ -110,10 +115,14 @@ namespace ts {
110115 * @param value An optional rhs value for the binding pattern.
111116 * @param visitor An optional visitor to use to visit expressions.
112117 */
113- export function flattenVariableDestructuring ( node : VariableDeclaration , value ?: Expression , visitor ?: ( node : Node ) => VisitResult < Node > ) {
118+ export function flattenVariableDestructuring (
119+ context : TransformationContext ,
120+ node : VariableDeclaration ,
121+ value ?: Expression ,
122+ visitor ?: ( node : Node ) => VisitResult < Node > ) {
114123 const declarations : VariableDeclaration [ ] = [ ] ;
115124
116- flattenDestructuring ( node , value , node , emitAssignment , emitTempVariableAssignment , visitor ) ;
125+ flattenDestructuring ( context , node , value , node , emitAssignment , emitTempVariableAssignment , visitor ) ;
117126
118127 return declarations ;
119128
@@ -124,7 +133,7 @@ namespace ts {
124133 }
125134
126135 if ( isSimpleExpression ( value ) ) {
127- declaration . disableSourceMap = true ;
136+ context . setNodeEmitFlags ( declaration , NodeEmitFlags . NoNestedSourceMaps ) ;
128137 }
129138
130139 declaration . original = original ;
@@ -148,14 +157,15 @@ namespace ts {
148157 * @param visitor An optional visitor to use to visit expressions.
149158 */
150159 export function flattenVariableDestructuringToExpression (
160+ context : TransformationContext ,
151161 node : VariableDeclaration ,
152162 recordTempVariable : ( name : Identifier ) => void ,
153163 nameSubstitution ?: ( name : Identifier ) => Expression ,
154164 visitor ?: ( node : Node ) => VisitResult < Node > ) {
155165
156166 const pendingAssignments : Expression [ ] = [ ] ;
157167
158- flattenDestructuring ( node , /*value*/ undefined , node , emitAssignment , emitTempVariableAssignment ) ;
168+ flattenDestructuring ( context , node , /*value*/ undefined , node , emitAssignment , emitTempVariableAssignment ) ;
159169
160170 const expression = inlineExpressions ( pendingAssignments ) ;
161171 aggregateTransformFlags ( expression ) ;
@@ -176,7 +186,7 @@ namespace ts {
176186 function emitPendingAssignment ( name : Expression , value : Expression , location : TextRange , original : Node ) {
177187 const expression = createAssignment ( name , value , location ) ;
178188 if ( isSimpleExpression ( value ) ) {
179- expression . disableSourceMap = true ;
189+ context . setNodeEmitFlags ( expression , NodeEmitFlags . NoNestedSourceMaps ) ;
180190 }
181191
182192 expression . original = original ;
@@ -186,6 +196,7 @@ namespace ts {
186196 }
187197
188198 function flattenDestructuring (
199+ context : TransformationContext ,
189200 root : BindingElement | BinaryExpression ,
190201 value : Expression ,
191202 location : TextRange ,
0 commit comments