@@ -175,73 +175,74 @@ function convertTemplateType(tokens) {
175
175
var astTransformVisitor = {
176
176
noScope : true ,
177
177
exit : function ( node , parent ) {
178
- if ( t . isSpreadProperty ( node ) ) {
178
+ if ( this . isSpreadProperty ( ) ) {
179
179
node . type = "Property" ;
180
180
node . kind = "init" ;
181
181
node . computed = true ;
182
182
node . key = node . value = node . argument ;
183
183
delete node . argument ;
184
184
}
185
185
186
- if ( t . isRestElement ( node ) ) {
186
+ if ( this . isRestElement ( ) ) {
187
187
return node . argument ;
188
188
}
189
189
190
190
// flow
191
- if ( t . isTypeCastExpression ( node ) ) {
191
+ if ( this . isTypeCastExpression ( ) ) {
192
192
return node . expression ;
193
193
}
194
194
195
- if ( t . isFlow ( node ) ) {
195
+ if ( this . isFlow ( ) ) {
196
196
return this . remove ( ) ;
197
197
}
198
198
199
199
// modules
200
200
201
- if ( t . isImportDeclaration ( node ) ) {
201
+ if ( this . isImportDeclaration ( ) ) {
202
202
delete node . isType ;
203
203
}
204
204
205
- if ( t . isExportDeclaration ( node ) ) {
206
- if ( t . isClassExpression ( node . declaration ) ) {
205
+ if ( this . isExportDeclaration ( ) ) {
206
+ var declar = this . get ( "declaration" ) ;
207
+ if ( declar . isClassExpression ( ) ) {
207
208
node . declaration . type = "ClassDeclaration" ;
208
- } else if ( t . isFunctionExpression ( node . declaration ) ) {
209
+ } else if ( declar . isFunctionExpression ( ) ) {
209
210
node . declaration . type = "FunctionDeclaration" ;
210
211
}
211
212
}
212
213
213
- if ( t . isFunctionDeclaration ( node ) || t . isFunctionExpression ( node ) ) {
214
+ if ( this . isFunctionDeclaration ( ) || this . isFunctionExpression ( ) ) {
214
215
if ( ! node . defaults ) {
215
216
node . defaults = [ ] ;
216
217
}
217
218
}
218
219
219
220
// classes
220
221
221
- if ( t . isReferencedIdentifier ( node , parent , { name : "super" } ) ) {
222
+ if ( this . isReferencedIdentifier ( { name : "super" } ) ) {
222
223
return t . inherits ( t . thisExpression ( ) , node ) ;
223
224
}
224
225
225
- if ( t . isClassProperty ( node ) ) {
226
+ if ( this . isClassProperty ( ) ) {
226
227
delete node . key ;
227
228
}
228
229
229
230
// functions
230
231
231
- if ( t . isFunction ( node ) ) {
232
+ if ( this . isFunction ( ) ) {
232
233
if ( node . async ) node . generator = true ;
233
234
delete node . async ;
234
235
}
235
236
236
- if ( t . isAwaitExpression ( node ) ) {
237
+ if ( this . isAwaitExpression ( ) ) {
237
238
node . type = "YieldExpression" ;
238
239
node . delegate = node . all ;
239
240
delete node . all ;
240
241
}
241
242
242
243
// template strings
243
244
244
- if ( t . isTemplateLiteral ( node ) ) {
245
+ if ( this . isTemplateLiteral ( ) ) {
245
246
node . quasis . forEach ( function ( q ) {
246
247
q . range [ 0 ] -= 1 ;
247
248
if ( q . tail ) {
0 commit comments