From a849d3fb2d299105b614fb7f849fea4857e079f1 Mon Sep 17 00:00:00 2001 From: Asger F Date: Mon, 7 Apr 2025 06:51:52 +0200 Subject: [PATCH] Simplify a bit --- .../ql/lib/semmle/javascript/internal/PathResolution.qll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/internal/PathResolution.qll b/javascript/ql/lib/semmle/javascript/internal/PathResolution.qll index a933143b88f..896cae25574 100644 --- a/javascript/ql/lib/semmle/javascript/internal/PathResolution.qll +++ b/javascript/ql/lib/semmle/javascript/internal/PathResolution.qll @@ -193,13 +193,14 @@ module PathResolution { ) } + pragma[nomagic] private TSConfig getTSConfigFromPathExpr(PathExpr expr) { - result.getAnAffectedFile() = expr.getFile() + result.getAnAffectedFile() = expr.getFile() and + expr = any(Import imprt).getImportedPath() } pragma[nomagic] private predicate replacedPath1(PathExpr expr, Container base, string newPath) { - expr = any(Import imprt).getImportedPath() and exists(TSConfig config, string value, string mappedPath | config = getTSConfigFromPathExpr(expr).getExtendedTSConfig*() and value = expr.getValue() @@ -222,7 +223,6 @@ module PathResolution { replacedPath1(expr, base, newPath) or // resolve from baseUrl - expr = any(Import imprt).getImportedPath() and not replacedPath1(expr, _, _) and newPath = expr.getValue() and newPath.charAt(0) != "." and