Skip to content

Commit 6868f66

Browse files
committed
JS: Restrict size of hasNameParts
Test updates look OK. Some intermediate results are omitted but the qualified name of the final type names are still present.
1 parent b155444 commit 6868f66

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

javascript/ql/lib/semmle/javascript/JSDoc.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ class JSDocNamedTypeExpr extends JSDocTypeExpr {
372372
* - `Baz` has prefix `Baz` and an empty suffix.
373373
*/
374374
predicate hasNameParts(string prefix, string suffix) {
375+
not this = any(JSDocQualifiedTypeAccess a).getBase() and // restrict size of predicate
375376
exists(string regex, string name | regex = "([^.]+)(.*)" |
376377
name = this.getRawName() and
377378
prefix = name.regexpCapture(regex, 1) and
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| bar.js:5:14:5:18 | x | ns.very.long.namespace |
1+
| bar.js:5:14:5:18 | x | x |
22
| bar.js:5:14:5:18 | x.Foo | ns.very.long.namespace.Foo |
3-
| bar.js:12:14:12:21 | iife | IIFE |
3+
| bar.js:12:14:12:21 | iife | iife |
44
| bar.js:12:14:12:21 | iife.Foo | IIFE.Foo |
55
| closure.js:8:12:8:28 | goog | goog |
66
| closure.js:8:12:8:28 | goog.net | goog.net |
77
| closure.js:8:12:8:28 | goog.net.SomeType | goog.net.SomeType |
8-
| closure.js:9:12:9:23 | net | goog.net |
8+
| closure.js:9:12:9:23 | net | net |
99
| closure.js:9:12:9:23 | net.SomeType | goog.net.SomeType |
1010
| closure.js:10:12:10:19 | SomeType | goog.net.SomeType |

0 commit comments

Comments
 (0)