Skip to content

Commit 8b7bb8c

Browse files
author
Max Schaefer
committed
JavaScript: Add test case for type inference in the presence of non-toplevel imports.
1 parent db32dc2 commit 8b7bb8c

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

javascript/ql/test/library-tests/Flow/AbstractValues.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@
180180
| n.js:3:16:3:23 | object literal |
181181
| namespace-reexport.js:1:1:4:0 | exports object of module namespace-reexport |
182182
| namespace-reexport.js:1:1:4:0 | module object of module namespace-reexport |
183+
| nestedImport.js:1:1:13:0 | exports object of module nestedImport |
184+
| nestedImport.js:1:1:13:0 | module object of module nestedImport |
185+
| nestedImport.js:9:1:12:1 | function tst |
186+
| nestedImport.js:9:1:12:1 | instance of function tst |
183187
| nodeJsClient.js:1:1:6:0 | exports object of module nodeJsClient |
184188
| nodeJsClient.js:1:1:6:0 | module object of module nodeJsClient |
185189
| nodeJsLib.js:1:1:4:0 | exports object of module nodeJsLib |

javascript/ql/test/library-tests/Flow/abseval.expected

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
| b.js:42:5:42:7 | z11 | b.js:42:11:42:18 | toString | file://:0:0:0:0 | indefinite value (import) |
5555
| b.js:45:5:45:7 | z12 | b.js:45:11:45:12 | f2 | ts2.ts:1:1:6:0 | exports object of module ts2 |
5656
| b.js:45:5:45:7 | z12 | b.js:45:11:45:12 | f2 | ts2.ts:1:10:1:22 | anonymous function |
57+
| b.js:45:5:45:7 | z12 | b.js:45:11:45:12 | f2 | ts2.ts:4:12:4:13 | object literal |
5758
| b.js:48:5:48:7 | z13 | b.js:48:11:48:11 | w | file://:0:0:0:0 | non-empty, non-numeric string |
5859
| b.js:51:5:51:7 | z14 | b.js:51:11:51:24 | foo_reexported | file://:0:0:0:0 | indefinite value (import) |
5960
| b.js:54:5:54:7 | z15 | b.js:54:11:54:19 | something | file://:0:0:0:0 | indefinite value (import) |
@@ -171,6 +172,10 @@
171172
| mixed.js:9:5:9:6 | fn | mixed.js:9:10:9:19 | __filename | file://:0:0:0:0 | numeric string |
172173
| mixed.js:10:5:10:6 | dn | mixed.js:10:10:10:18 | __dirname | file://:0:0:0:0 | non-empty, non-numeric string |
173174
| mixed.js:10:5:10:6 | dn | mixed.js:10:10:10:18 | __dirname | file://:0:0:0:0 | numeric string |
175+
| nestedImport.js:2:5:2:6 | x1 | nestedImport.js:2:10:2:12 | foo | esLib.js:3:8:3:24 | function foo |
176+
| nestedImport.js:6:7:6:8 | x2 | nestedImport.js:6:12:6:14 | foo | file://:0:0:0:0 | indefinite value (import) |
177+
| nestedImport.js:6:7:6:8 | x2 | nestedImport.js:6:12:6:14 | foo | nodeJsLib.js:3:15:3:37 | function nodeJsFoo |
178+
| nestedImport.js:11:7:11:8 | x3 | nestedImport.js:11:12:11:14 | foo | esLib.js:3:8:3:24 | function foo |
174179
| nodeJsClient.js:1:5:1:6 | nj | nodeJsClient.js:1:10:1:31 | require ... JsLib') | file://:0:0:0:0 | indefinite value (call) |
175180
| nodeJsClient.js:1:5:1:6 | nj | nodeJsClient.js:1:10:1:31 | require ... JsLib') | nodeJsLib.js:1:1:4:0 | exports object of module nodeJsLib |
176181
| nodeJsClient.js:1:5:1:6 | nj | nodeJsClient.js:1:10:1:31 | require ... JsLib') | nodeJsLib.js:1:18:1:43 | function nodeJsModule |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { foo } from './esLib';
2+
let x1 = foo;
3+
4+
if (!foo) {
5+
import { foo } from './nodeJsLib';
6+
let x2 = foo;
7+
}
8+
9+
function tst() {
10+
import { foo } from './esLib';
11+
let x3 = foo;
12+
}

javascript/ql/test/library-tests/Flow/types.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
| mixed.js:8:5:8:7 | exp | mixed.js:8:11:8:17 | exports | object |
9999
| mixed.js:9:5:9:6 | fn | mixed.js:9:10:9:19 | __filename | string |
100100
| mixed.js:10:5:10:6 | dn | mixed.js:10:10:10:18 | __dirname | string |
101+
| nestedImport.js:2:5:2:6 | x1 | nestedImport.js:2:10:2:12 | foo | function |
102+
| nestedImport.js:6:7:6:8 | x2 | nestedImport.js:6:12:6:14 | foo | boolean, class, date, function, null, number, object, regular expression,string or undefined |
103+
| nestedImport.js:11:7:11:8 | x3 | nestedImport.js:11:12:11:14 | foo | function |
101104
| nodeJsClient.js:1:5:1:6 | nj | nodeJsClient.js:1:10:1:31 | require ... JsLib') | boolean, class, date, function, null, number, object, regular expression,string or undefined |
102105
| nodeJsClient.js:2:5:2:6 | es | nodeJsClient.js:2:10:2:27 | require('./esLib') | boolean, class, date, function, null, number, object, regular expression,string or undefined |
103106
| nodeJsClient.js:4:5:4:6 | x1 | nodeJsClient.js:4:10:4:15 | nj.foo | boolean, class, date, function, null, number, object, regular expression,string or undefined |

0 commit comments

Comments
 (0)