Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Fixed the flow summary for `Array.prototype.flatMap`. The `thisArg` argument now flows to the callback's `this` instead of its index parameter.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class FlatMap extends SummarizedCallable::Range {
output = "Argument[0].Parameter[2]"
or
input = "Argument[1]" and
output = "Argument[0].Parameter[1]"
output = "Argument[0].Parameter[this]"
or
input = "Argument[0].ReturnValue." + ["ArrayElement", "WithoutArrayElement"] and
output = "ReturnValue.ArrayElement"
Expand Down
7 changes: 7 additions & 0 deletions javascript/ql/test/library-tests/TripleDot/array-flatmap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function flatMapThisArg() {
[0].flatMap(function (x, i) {
sink(this); // $ hasValueFlow=flatMap.thisArg
sink(i); // OK - the index, not thisArg
return [];
}, source('flatMap.thisArg'));
}
Loading