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.
This commit is contained in:
Asger F
2025-03-20 14:14:08 +01:00
parent b1554443d8
commit 6868f66108
2 changed files with 4 additions and 3 deletions

View File

@@ -372,6 +372,7 @@ class JSDocNamedTypeExpr extends JSDocTypeExpr {
* - `Baz` has prefix `Baz` and an empty suffix.
*/
predicate hasNameParts(string prefix, string suffix) {
not this = any(JSDocQualifiedTypeAccess a).getBase() and // restrict size of predicate
exists(string regex, string name | regex = "([^.]+)(.*)" |
name = this.getRawName() and
prefix = name.regexpCapture(regex, 1) and

View File

@@ -1,10 +1,10 @@
| bar.js:5:14:5:18 | x | ns.very.long.namespace |
| bar.js:5:14:5:18 | x | x |
| bar.js:5:14:5:18 | x.Foo | ns.very.long.namespace.Foo |
| bar.js:12:14:12:21 | iife | IIFE |
| bar.js:12:14:12:21 | iife | iife |
| bar.js:12:14:12:21 | iife.Foo | IIFE.Foo |
| closure.js:8:12:8:28 | goog | goog |
| closure.js:8:12:8:28 | goog.net | goog.net |
| closure.js:8:12:8:28 | goog.net.SomeType | goog.net.SomeType |
| closure.js:9:12:9:23 | net | goog.net |
| closure.js:9:12:9:23 | net | net |
| closure.js:9:12:9:23 | net.SomeType | goog.net.SomeType |
| closure.js:10:12:10:19 | SomeType | goog.net.SomeType |