Skip to content

Commit 80a5a59

Browse files
committed
JS: Use getUnderlyingValue() a few places in VariableCapture
1 parent d2daec4 commit 80a5a59

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/VariableCapture.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module VariableCaptureConfig implements InputSig<js::DbLocation> {
88
private js::Function getLambdaFromVariable(js::LocalVariable variable) {
99
result.getVariable() = variable
1010
or
11-
result = variable.getAnAssignedExpr()
11+
result = variable.getAnAssignedExpr().getUnderlyingValue()
1212
or
1313
exists(js::ClassDeclStmt cls |
1414
result = cls.getConstructor().getBody() and
@@ -148,9 +148,11 @@ module VariableCaptureConfig implements InputSig<js::DbLocation> {
148148
predicate hasAliasedAccess(Expr e) {
149149
e = this
150150
or
151+
e.(js::Expr).getUnderlyingValue() = this
152+
or
151153
exists(js::LocalVariable variable |
152154
this = getLambdaFromVariable(variable) and
153-
e = variable.getAnAccess()
155+
e.(js::Expr).getUnderlyingValue() = variable.getAnAccess()
154156
)
155157
}
156158
}

javascript/ql/test/library-tests/TripleDot/iife.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function f2() {
1616
})(x);
1717
return y;
1818
}
19-
sink(inner(source("f2.1"))); // $ MISSING: hasValueFlow=f2.1
20-
sink(inner(source("f2.2"))); // $ MISSING: hasValueFlow=f2.2
19+
sink(inner(source("f2.1"))); // $ hasValueFlow=f2.1
20+
sink(inner(source("f2.2"))); // $ hasValueFlow=f2.2
2121
}
2222

2323
function f3() {
@@ -64,8 +64,8 @@ function f6() {
6464
(nested)(x); // same as f5, except the callee is parenthesised here
6565
return y;
6666
}
67-
sink(inner(source("f6.1"))); // $ MISSING: hasValueFlow=f6.1
68-
sink(inner(source("f6.2"))); // $ MISSING: hasValueFlow=f6.2
67+
sink(inner(source("f6.1"))); // $ hasValueFlow=f6.1
68+
sink(inner(source("f6.2"))); // $ hasValueFlow=f6.2
6969
}
7070

7171
function f7() {
@@ -77,6 +77,6 @@ function f7() {
7777
nested(x); // same as f5, except the function definition is parenthesised
7878
return y;
7979
}
80-
sink(inner(source("f7.1"))); // $ MISSING: hasValueFlow=f7.1
81-
sink(inner(source("f7.2"))); // $ MISSING: hasValueFlow=f7.2
80+
sink(inner(source("f7.1"))); // $ hasValueFlow=f7.1
81+
sink(inner(source("f7.2"))); // $ hasValueFlow=f7.2
8282
}

0 commit comments

Comments
 (0)