@@ -939,7 +939,7 @@ module.exports = function(ast, extra) {
939
939
if ( node . modifiers && node . modifiers . length ) {
940
940
var isDeclareFunction = hasModifier ( ts . SyntaxKind . DeclareKeyword , node ) ;
941
941
if ( isDeclareFunction ) {
942
- functionDeclarationType = "DeclareFunction " ;
942
+ functionDeclarationType = "TSAmbientFunctionDeclaration " ;
943
943
}
944
944
}
945
945
@@ -1141,6 +1141,7 @@ module.exports = function(ast, extra) {
1141
1141
// TODO: double-check that these positions are correct
1142
1142
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1143
1143
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1144
+ isAmbient = ts . isInAmbientContext ( node ) ,
1144
1145
method = {
1145
1146
type : "FunctionExpression" ,
1146
1147
id : null ,
@@ -1197,6 +1198,19 @@ module.exports = function(ast, extra) {
1197
1198
var methodDefinitionType = hasModifier ( SyntaxKind . AbstractKeyword , node )
1198
1199
? "TSAbstractMethodDefinition"
1199
1200
: "MethodDefinition" ;
1201
+ var methodDefinitionType = "MethodDefinition" ;
1202
+ if ( node . modifiers && node . modifiers . length ) {
1203
+ var isAbstractMethod = node . modifiers . some ( function ( modifier ) {
1204
+ return modifier . kind === ts . SyntaxKind . AbstractKeyword ;
1205
+ } ) ;
1206
+ if ( isAbstractMethod ) {
1207
+ methodDefinitionType = "TSAbstractMethodDefinition" ;
1208
+ }
1209
+ }
1210
+ if ( isAmbient ) {
1211
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1212
+ method . type = "TSAmbientFunctionExpression" ;
1213
+ }
1200
1214
1201
1215
assign ( result , {
1202
1216
type : methodDefinitionType ,
@@ -1235,6 +1249,7 @@ module.exports = function(ast, extra) {
1235
1249
constructorIsAbstract = hasModifier ( SyntaxKind . AbstractKeyword , node ) ,
1236
1250
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1237
1251
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1252
+ constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1238
1253
constructor = {
1239
1254
type : "FunctionExpression" ,
1240
1255
id : null ,
@@ -1301,6 +1316,12 @@ module.exports = function(ast, extra) {
1301
1316
} ;
1302
1317
}
1303
1318
1319
+ var constructorMethodDefinitionType = "MethodDefinition" ;
1320
+ if ( constructorIsAmbient ) {
1321
+ constructorMethodDefinitionType = "TSAmbientMethodDefinition" ;
1322
+ constructor . type = "TSAmbientFunctionExpression" ;
1323
+ }
1324
+
1304
1325
assign ( result , {
1305
1326
type : constructorIsAbstract ? "TSAbstractMethodDefinition" : "MethodDefinition" ,
1306
1327
key : constructorKey ,
0 commit comments