Skip to content

Commit 2cbba65

Browse files
committed
JS: Sync with JS
fixup JS
1 parent afd0016 commit 2cbba65

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,14 @@ pragma[nomagic]
427427
private API::Node getNodeFromType(string package, string type) {
428428
exists(string package2, string type2, AccessPath path2 |
429429
typeModel(package, type, package2, type2, path2) and
430-
result = getNodeFromPath(package2, type2, path2, path2.getNumToken())
430+
result = getNodeFromPath(package2, type2, path2)
431431
)
432432
or
433433
result = any(TypeModelUseEntry e).getNodeForType(package, type)
434434
or
435435
result = any(TypeModelDefEntry e).getNodeForType(package, type)
436436
or
437-
isRelevantFullPath(package, type, _) and
438-
result = Specific::getExtraNodeFromPath(package, type, _, 0)
437+
result = Specific::getExtraNodeFromType(package, type)
439438
}
440439

441440
/**

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ private API::Node getGlobalNode(string globalName) {
7979
/** Gets a JavaScript-specific interpretation of the `(package, type, path)` tuple after resolving the first `n` access path tokens. */
8080
bindingset[package, type, path]
8181
API::Node getExtraNodeFromPath(string package, string type, AccessPath path, int n) {
82-
type = "" and
83-
n = 0 and
84-
result = API::moduleImport(package)
85-
or
8682
// Global variable accesses is via the 'global' package
8783
exists(AccessPathToken token |
8884
package = getAPackageAlias("global") and
@@ -92,9 +88,14 @@ API::Node getExtraNodeFromPath(string package, string type, AccessPath path, int
9288
result = getGlobalNode(token.getAnArgument()) and
9389
n = 1
9490
)
91+
}
92+
93+
/** Gets a JavaScript-specific interpretation of the `(package, type)` tuple. */
94+
API::Node getExtraNodeFromType(string package, string type) {
95+
type = "" and
96+
result = API::moduleImport(package)
9597
or
9698
// Access instance of a type based on type annotations
97-
n = 0 and
9899
result = API::Node::ofType(getAPackageAlias(package), type)
99100
}
100101

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
| body-parser | | index.ts:4:20:4:41 | require ... arser") |
2+
| express | | index.ts:3:17:3:34 | require("express") |
3+
| mongodb | | index.ts:1:8:1:19 | * as mongodb |
14
| mongodb | Collection | index.ts:14:3:14:17 | getCollection() |
5+
| mongoose | | index.ts:17:8:17:20 | * as mongoose |
26
| mongoose | Model | index.ts:22:3:22:20 | getMongooseModel() |
37
| mongoose | Query | index.ts:23:3:23:20 | getMongooseQuery() |
8+
| puppeteer | | index.ts:26:8:26:21 | * as puppeteer |
49
| puppeteer | Browser | index.ts:30:22:30:33 | this.browser |

0 commit comments

Comments
 (0)