JS: Sync with JS

fixup JS
This commit is contained in:
Asger F
2022-09-06 09:19:10 +02:00
parent afd00161e8
commit 2cbba65617
3 changed files with 13 additions and 8 deletions

View File

@@ -427,15 +427,14 @@ pragma[nomagic]
private API::Node getNodeFromType(string package, string type) {
exists(string package2, string type2, AccessPath path2 |
typeModel(package, type, package2, type2, path2) and
result = getNodeFromPath(package2, type2, path2, path2.getNumToken())
result = getNodeFromPath(package2, type2, path2)
)
or
result = any(TypeModelUseEntry e).getNodeForType(package, type)
or
result = any(TypeModelDefEntry e).getNodeForType(package, type)
or
isRelevantFullPath(package, type, _) and
result = Specific::getExtraNodeFromPath(package, type, _, 0)
result = Specific::getExtraNodeFromType(package, type)
}
/**

View File

@@ -79,10 +79,6 @@ private API::Node getGlobalNode(string globalName) {
/** Gets a JavaScript-specific interpretation of the `(package, type, path)` tuple after resolving the first `n` access path tokens. */
bindingset[package, type, path]
API::Node getExtraNodeFromPath(string package, string type, AccessPath path, int n) {
type = "" and
n = 0 and
result = API::moduleImport(package)
or
// Global variable accesses is via the 'global' package
exists(AccessPathToken token |
package = getAPackageAlias("global") and
@@ -92,9 +88,14 @@ API::Node getExtraNodeFromPath(string package, string type, AccessPath path, int
result = getGlobalNode(token.getAnArgument()) and
n = 1
)
}
/** Gets a JavaScript-specific interpretation of the `(package, type)` tuple. */
API::Node getExtraNodeFromType(string package, string type) {
type = "" and
result = API::moduleImport(package)
or
// Access instance of a type based on type annotations
n = 0 and
result = API::Node::ofType(getAPackageAlias(package), type)
}

View File

@@ -1,4 +1,9 @@
| body-parser | | index.ts:4:20:4:41 | require ... arser") |
| express | | index.ts:3:17:3:34 | require("express") |
| mongodb | | index.ts:1:8:1:19 | * as mongodb |
| mongodb | Collection | index.ts:14:3:14:17 | getCollection() |
| mongoose | | index.ts:17:8:17:20 | * as mongoose |
| mongoose | Model | index.ts:22:3:22:20 | getMongooseModel() |
| mongoose | Query | index.ts:23:3:23:20 | getMongooseQuery() |
| puppeteer | | index.ts:26:8:26:21 | * as puppeteer |
| puppeteer | Browser | index.ts:30:22:30:33 | this.browser |