Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 421ad89

Browse files
committed
JS: Fix join order
1 parent e397251 commit 421ad89

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

javascript/ql/src/semmle/javascript/JSDoc.qll

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ module JSDoc {
445445
* be resolved.
446446
*/
447447
DataFlow::Node getNodeFromAlias(string alias) {
448-
isPrefixUsedInFile(alias, getFile()) and // Restrict size of predicate
449448
exists(VarDef def, VarRef ref |
450449
def.getContainer() = this and
451450
ref = def.getTarget().(BindingPattern).getABindingVarRef() and
452-
ref.getName() = alias
451+
ref.getName() = alias and
452+
isTypenamePrefix(ref.getName()) // restrict size of predicate
453453
|
454454
exists(PropertyPattern p |
455455
ref = p.getValuePattern() and
@@ -480,13 +480,8 @@ module JSDoc {
480480
}
481481
}
482482

483-
/**
484-
* Holds if a JSDoc type in `f` referenced the given local name.
485-
*/
486-
private predicate isPrefixUsedInFile(string name, File f) {
487-
exists(JSDocNamedTypeExpr t |
488-
t.hasNameParts(name, _) and
489-
t.getFile() = f
490-
)
483+
pragma[noinline]
484+
private predicate isTypenamePrefix(string name) {
485+
any(JSDocNamedTypeExpr expr).hasNameParts(name, _)
491486
}
492487
}

0 commit comments

Comments
 (0)