@@ -943,6 +943,10 @@ module.exports = function(ast, extra) {
943
943
}
944
944
}
945
945
946
+ if ( ! node . body ) {
947
+ functionDeclarationType = "TSEmptyBodyFunctionDeclaration" ;
948
+ }
949
+
946
950
/**
947
951
* Prefix FunctionDeclarations within TypeScript namespaces with "TS"
948
952
*/
@@ -1142,6 +1146,7 @@ module.exports = function(ast, extra) {
1142
1146
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1143
1147
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1144
1148
isAmbient = ts . isInAmbientContext ( node ) ,
1149
+ isEmptyBody = ! ( node . body ) ,
1145
1150
method = {
1146
1151
type : "FunctionExpression" ,
1147
1152
id : null ,
@@ -1198,9 +1203,10 @@ module.exports = function(ast, extra) {
1198
1203
var methodDefinitionType = hasModifier ( SyntaxKind . AbstractKeyword , node )
1199
1204
? "TSAbstractMethodDefinition"
1200
1205
: "MethodDefinition" ;
1201
- var methodDefinitionType = "MethodDefinition" ;
1206
+ var methodDefinitionType = "MethodDefinition" ,
1207
+ isAbstractMethod = false ;
1202
1208
if ( node . modifiers && node . modifiers . length ) {
1203
- var isAbstractMethod = node . modifiers . some ( function ( modifier ) {
1209
+ isAbstractMethod = node . modifiers . some ( function ( modifier ) {
1204
1210
return modifier . kind === ts . SyntaxKind . AbstractKeyword ;
1205
1211
} ) ;
1206
1212
if ( isAbstractMethod ) {
@@ -1212,6 +1218,13 @@ module.exports = function(ast, extra) {
1212
1218
method . type = "TSAmbientFunctionExpression" ;
1213
1219
}
1214
1220
1221
+ if ( isEmptyBody ) {
1222
+ if ( ! isAbstractMethod ) {
1223
+ methodDefinitionType = "TSEmptyBodyMethodDefinition" ;
1224
+ }
1225
+ method . type = "TSEmptyBodyFunctionExpression" ;
1226
+ }
1227
+
1215
1228
assign ( result , {
1216
1229
type : methodDefinitionType ,
1217
1230
key : convertChild ( node . name ) ,
@@ -1250,6 +1263,7 @@ module.exports = function(ast, extra) {
1250
1263
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1251
1264
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1252
1265
constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1266
+ constructorIsEmptyBody = ! ( node . body ) ,
1253
1267
constructor = {
1254
1268
type : "FunctionExpression" ,
1255
1269
id : null ,
@@ -1320,6 +1334,9 @@ module.exports = function(ast, extra) {
1320
1334
if ( constructorIsAmbient ) {
1321
1335
constructorMethodDefinitionType = "TSAmbientMethodDefinition" ;
1322
1336
constructor . type = "TSAmbientFunctionExpression" ;
1337
+ } else if ( constructorIsEmptyBody ) {
1338
+ constructorMethodDefinitionType = "TSEmptyBodyMethodDefinition" ;
1339
+ constructor . type = "TSEmptyBodyFunctionExpression" ;
1323
1340
}
1324
1341
1325
1342
assign ( result , {
0 commit comments