Skip to content

Commit 8c3b44a

Browse files
committed
JS: address comments
1 parent f9d7f8b commit 8c3b44a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

javascript/ql/src/Statements/MissingIndexAdjustmentAfterConcurrentModification.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<overview>
66
<p>
77
Items can be removed from an array using the <code>splice</code> method, but when doing so,
8-
all subseequent items will be shifted to a lower index. If this is done while iterating over
8+
all subsequent items will be shifted to a lower index. If this is done while iterating over
99
the array, the shifting may cause the loop to skip over the element immediately after the
1010
removed element.
1111
</p>

javascript/ql/src/Statements/MissingIndexAdjustmentAfterConcurrentModification.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import javascript
1212

1313
/**
14-
* Operation that inserts or removes elements from an array while shifting all elements
14+
* An operation that inserts or removes elements from an array while shifting all elements
1515
* occuring after the insertion/removal point.
1616
*
1717
* Does not include `push` and `pop` since these never shift any elements.
@@ -160,4 +160,4 @@ class ArrayIterationLoop extends ForStmt {
160160

161161
from ArrayIterationLoop loop, SpliceCall splice
162162
where loop.hasPathThrough(splice, loop.getUpdate().getFirstControlFlowNode())
163-
select splice, "Missing loop index adjustment after removing array item. Some array items will be skipped due to shifting."
163+
select splice, "Removing an array item without adjusting the loop index '" + loop.getIndexVariable().getName() + "' causes the subsequent array item to be skipped."
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| tst.js:4:27:4:44 | parts.splice(i, 1) | Missing loop index adjustment after removing array item. Some array items will be skipped due to shifting. |
2-
| tst.js:13:29:13:46 | parts.splice(i, 1) | Missing loop index adjustment after removing array item. Some array items will be skipped due to shifting. |
3-
| tst.js:24:9:24:26 | parts.splice(i, 1) | Missing loop index adjustment after removing array item. Some array items will be skipped due to shifting. |
1+
| tst.js:4:27:4:44 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent item to be skipped. |
2+
| tst.js:13:29:13:46 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent item to be skipped. |
3+
| tst.js:24:9:24:26 | parts.splice(i, 1) | Removing an array item without adjusting the loop index 'i' causes the subsequent item to be skipped. |

0 commit comments

Comments
 (0)