mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: Ignore obvious Array.prototype.concat calls
This commit is contained in:
@@ -55,6 +55,13 @@ module StringConcatenation {
|
||||
exists(DataFlow::MethodCallNode call |
|
||||
node = call and
|
||||
call.getMethodName() = "concat" and
|
||||
not (
|
||||
exists(DataFlow::ArrayCreationNode array |
|
||||
array.flowsTo(call.getAnArgument()) or array.flowsTo(call.getReceiver())
|
||||
)
|
||||
or
|
||||
DataFlow::reflectiveCallNode(_) = call
|
||||
) and
|
||||
(
|
||||
n = 0 and
|
||||
result = call.getReceiver()
|
||||
|
||||
@@ -95,3 +95,7 @@ function concatCall() {
|
||||
x = x.concat('two', 'three');
|
||||
return x;
|
||||
}
|
||||
|
||||
function arrayConcat(a, b) {
|
||||
return [].concat(a, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user