@@ -879,6 +879,10 @@ module.exports = function(ast, extra) {
879
879
}
880
880
}
881
881
882
+ if ( ! node . body ) {
883
+ functionDeclarationType = "TSEmptyBodyFunctionDeclaration" ;
884
+ }
885
+
882
886
/**
883
887
* Prefix FunctionDeclarations within TypeScript namespaces with "TS"
884
888
*/
@@ -1074,6 +1078,7 @@ module.exports = function(ast, extra) {
1074
1078
// TODO: double-check that these positions are correct
1075
1079
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1076
1080
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1081
+ isEmptyBody = ! ( node . body ) ,
1077
1082
method = {
1078
1083
type : "FunctionExpression" ,
1079
1084
id : null ,
@@ -1137,6 +1142,11 @@ module.exports = function(ast, extra) {
1137
1142
}
1138
1143
}
1139
1144
1145
+ if ( isEmptyBody ) {
1146
+ methodDefinitionType = "TSEmptyBodyMethodDefinition" ;
1147
+ method . type = "TSEmptyBodyFunctionExpression" ;
1148
+ }
1149
+
1140
1150
assign ( result , {
1141
1151
type : methodDefinitionType ,
1142
1152
key : convertChild ( node . name ) ,
@@ -1167,6 +1177,7 @@ module.exports = function(ast, extra) {
1167
1177
var constructorIsStatic = Boolean ( node . flags & ts . NodeFlags . Static ) ,
1168
1178
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1169
1179
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1180
+ constructorIsEmptyBody = ! ( node . body ) ,
1170
1181
constructor = {
1171
1182
type : "FunctionExpression" ,
1172
1183
id : null ,
@@ -1230,8 +1241,14 @@ module.exports = function(ast, extra) {
1230
1241
} ;
1231
1242
}
1232
1243
1244
+ var constructorMethodDefinitionType = "MethodDefinition" ;
1245
+ if ( constructorIsEmptyBody ) {
1246
+ constructorMethodDefinitionType = "TSEmptyBodyMethodDefinition" ;
1247
+ constructor . type = "TSEmptyBodyFunctionExpression" ;
1248
+ }
1249
+
1233
1250
assign ( result , {
1234
- type : "MethodDefinition" ,
1251
+ type : constructorMethodDefinitionType ,
1235
1252
key : constructorKey ,
1236
1253
value : constructor ,
1237
1254
computed : constructorIsComputed ,
0 commit comments