@@ -118,13 +118,13 @@ function transformer(args, body, isAsync, isGenerator, filename) {
118
118
__proto__ : null ,
119
119
pos : node . start ,
120
120
order : TO_RIGHT ,
121
- code : `catch($tmpname){try{throw ${ INTERNAL_STATE_NAME } .handleException($tmpname);}`
121
+ coder : ( ) => `catch(${ tmpname } ){try{throw( ${ tmpname } = ${ INTERNAL_STATE_NAME } .handleException(${ tmpname } ) );}`
122
122
} ) ;
123
123
insertions . push ( {
124
124
__proto__ : null ,
125
125
pos : node . body . end ,
126
126
order : TO_LEFT ,
127
- code : `}`
127
+ coder : ( ) => `}`
128
128
} ) ;
129
129
} else {
130
130
const name = assertType ( param , 'Identifier' ) . name ;
@@ -134,7 +134,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
134
134
__proto__ : null ,
135
135
pos : cBody . body [ 0 ] . start ,
136
136
order : TO_LEFT ,
137
- code : `${ name } =${ INTERNAL_STATE_NAME } .handleException(${ name } );`
137
+ coder : ( ) => `${ name } =${ INTERNAL_STATE_NAME } .handleException(${ name } );`
138
138
} ) ;
139
139
}
140
140
}
@@ -144,13 +144,13 @@ function transformer(args, body, isAsync, isGenerator, filename) {
144
144
__proto__ : null ,
145
145
pos : node . object . start ,
146
146
order : TO_LEFT ,
147
- code : INTERNAL_STATE_NAME + '.wrapWith('
147
+ coder : ( ) => INTERNAL_STATE_NAME + '.wrapWith('
148
148
} ) ;
149
149
insertions . push ( {
150
150
__proto__ : null ,
151
151
pos : node . object . end ,
152
152
order : TO_RIGHT ,
153
- code : ')'
153
+ coder : ( ) => ')'
154
154
} ) ;
155
155
} else if ( nodeType === 'Identifier' ) {
156
156
if ( node . name === INTERNAL_STATE_NAME ) {
@@ -165,7 +165,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
165
165
__proto__ : null ,
166
166
pos : node . start ,
167
167
order : TO_RIGHT ,
168
- code : INTERNAL_STATE_NAME + '.'
168
+ coder : ( ) => INTERNAL_STATE_NAME + '.'
169
169
} ) ;
170
170
}
171
171
} ) ;
@@ -186,7 +186,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
186
186
let curr = 0 ;
187
187
for ( let i = 0 ; i < insertions . length ; i ++ ) {
188
188
const change = insertions [ i ] ;
189
- ncode += code . substring ( curr , change . pos ) + change . code . replace ( / \$ t m p n a m e / g , tmpname ) ;
189
+ ncode += code . substring ( curr , change . pos ) + change . coder ( ) ;
190
190
curr = change . pos ;
191
191
}
192
192
ncode += code . substring ( curr ) ;
0 commit comments