This repository has been archived by the owner on Jan 19, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Distinguish between DeclareFunction and FunctionDeclaration (#79)
Refs #78
- Loading branch information
1 parent
d58041f
commit 799fd63
Showing
3 changed files
with
329 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
313 changes: 313 additions & 0 deletions
313
tests/fixtures/typescript/basics/declare-function.result.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,313 @@ | ||
module.exports = { | ||
"type": "Program", | ||
"range": [ | ||
0, | ||
42 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 42 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "DeclareFunction", | ||
"range": [ | ||
0, | ||
42 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 42 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"range": [ | ||
17, | ||
20 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
} | ||
}, | ||
"name": "foo" | ||
}, | ||
"generator": false, | ||
"expression": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"range": [ | ||
21, | ||
24 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 21 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
}, | ||
"name": "bar" | ||
} | ||
], | ||
"body": null, | ||
"returnType": { | ||
"type": "TypeAnnotation", | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 35 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 41 | ||
} | ||
}, | ||
"range": [ | ||
35, | ||
41 | ||
], | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"range": [ | ||
35, | ||
41 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 35 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 41 | ||
} | ||
}, | ||
"flags": 0 | ||
} | ||
} | ||
} | ||
], | ||
"sourceType": "script", | ||
"tokens": [ | ||
{ | ||
"type": "Identifier", | ||
"value": "declare", | ||
"range": [ | ||
0, | ||
7 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 7 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Keyword", | ||
"value": "function", | ||
"range": [ | ||
8, | ||
16 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 16 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "foo", | ||
"range": [ | ||
17, | ||
20 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": "(", | ||
"range": [ | ||
20, | ||
21 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 20 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 21 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "bar", | ||
"range": [ | ||
21, | ||
24 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 21 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": ":", | ||
"range": [ | ||
24, | ||
25 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 24 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 25 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "string", | ||
"range": [ | ||
26, | ||
32 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 26 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 32 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": ")", | ||
"range": [ | ||
32, | ||
33 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 32 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 33 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": ":", | ||
"range": [ | ||
33, | ||
34 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 33 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"value": "string", | ||
"range": [ | ||
35, | ||
41 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 35 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 41 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Punctuator", | ||
"value": ";", | ||
"range": [ | ||
41, | ||
42 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 41 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 42 | ||
} | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare function foo(bar: string): string; |