Skip to content

Commit ac3913e

Browse files
committed
JS: Fix bad join in DuplicateProperty.ql
1 parent e72232f commit ac3913e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

javascript/ql/src/Expressions/DuplicateProperty.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,26 @@
1414

1515
import Clones
1616

17+
bindingset[init]
18+
pragma[inline_late]
19+
private Property getPropertyFromInitializerStrict(Expr init) { result.getInit() = init }
20+
21+
pragma[nomagic]
22+
private predicate duplicateProperties(
23+
DuplicatePropertyInitDetector dup, Property prop1, Property prop2
24+
) {
25+
exists(Expr init2 |
26+
dup.same(init2) and
27+
prop1 = getPropertyFromInitializerStrict(dup) and
28+
prop2 = getPropertyFromInitializerStrict(init2)
29+
)
30+
}
31+
1732
from ObjectExpr oe, int i, int j, Property p, Property q, DuplicatePropertyInitDetector dpid
1833
where
34+
duplicateProperties(dpid, p, q) and
1935
p = oe.getProperty(i) and
2036
q = oe.getProperty(j) and
21-
dpid = p.getInit() and
22-
dpid.same(q.getInit()) and
2337
i < j and
2438
// only report the next duplicate
2539
not exists(int mid | mid in [i + 1 .. j - 1] | dpid.same(oe.getProperty(mid).getInit()))

0 commit comments

Comments
 (0)