Skip to content

Commit e4eaa81

Browse files
committed
JS: Fix handling of re-exported paths
1 parent 23004ff commit e4eaa81

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

javascript/ql/lib/semmle/javascript/internal/UnderlyingTypes.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ module UnderlyingTypes {
3333
* If `mod` is the string `"global"`, `node` refers to a global access path.
3434
*/
3535
predicate nodeRefersToModule(Node node, string mod, string qualifiedName) {
36-
exists(Import imprt |
37-
node = imprt.getImportedPath() and
38-
mod = normalizeModuleName(imprt.getImportedPath().getValue()) and
36+
exists(PathExpr path |
37+
path = any(Import imprt).getImportedPath() or
38+
path = any(ReExportDeclaration e).getImportedPath()
39+
|
40+
node = path and
41+
mod = normalizeModuleName(path.getValue()) and
3942
isExternalModuleName(mod) and
4043
qualifiedName = ""
4144
)

javascript/ql/test/library-tests/UnderlyingTypes/expressWrapperExport.use.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ function t1(req: Request) { // none
77
function t2(res: Response) { // none
88
}
99

10-
function t3(req: wrapper.Request) { // $ MISSING: hasUnderlyingType='express'.Request
10+
function t3(req: wrapper.Request) { // $ hasUnderlyingType='express'.Request
1111
}
1212

13-
function t4(res: wrapper.Response) { // $ MISSING: hasUnderlyingType='express'.Response
13+
function t4(res: wrapper.Response) { // $ hasUnderlyingType='express'.Response
1414
}
1515

16-
function t5(req: w.wrapper.Request) { // $ MISSING: hasUnderlyingType='express'.Request
16+
function t5(req: w.wrapper.Request) { // $ hasUnderlyingType='express'.Request
1717
}
1818

19-
function t6(res: w.wrapper.Response) { // $ MISSING: hasUnderlyingType='express'.Response
19+
function t6(res: w.wrapper.Response) { // $ hasUnderlyingType='express'.Response
2020
}
2121

2222
function t7(req: w.Request) { // none

0 commit comments

Comments
 (0)