mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
JS: address comments
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<overview>
|
||||
<p>
|
||||
Items can be removed from an array using the <code>splice</code> method, but when doing so,
|
||||
all subseequent items will be shifted to a lower index. If this is done while iterating over
|
||||
all subsequent items will be shifted to a lower index. If this is done while iterating over
|
||||
the array, the shifting may cause the loop to skip over the element immediately after the
|
||||
removed element.
|
||||
</p>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import javascript
|
||||
|
||||
/**
|
||||
* Operation that inserts or removes elements from an array while shifting all elements
|
||||
* An operation that inserts or removes elements from an array while shifting all elements
|
||||
* occuring after the insertion/removal point.
|
||||
*
|
||||
* Does not include `push` and `pop` since these never shift any elements.
|
||||
@@ -160,4 +160,4 @@ class ArrayIterationLoop extends ForStmt {
|
||||
|
||||
from ArrayIterationLoop loop, SpliceCall splice
|
||||
where loop.hasPathThrough(splice, loop.getUpdate().getFirstControlFlowNode())
|
||||
select splice, "Missing loop index adjustment after removing array item. Some array items will be skipped due to shifting."
|
||||
select splice, "Removing an array item without adjusting the loop index '" + loop.getIndexVariable().getName() + "' causes the subsequent array item to be skipped."
|
||||
|
||||
Reference in New Issue
Block a user