webpack/webpack — pull request #316 by Taytay (2014-06-17 14:39:07+00:00)
Title: Fix: "*" was being appended to sources too often

The while loop construction was actually yielding false positives due to the placement of parentheses, and would append an "*" to sources even when unnecessary.

In the previous construction of the while loop, idx was being assigned the boolean value true or false, and NOT the index of the string. The comparison happened first, and then the assignment. So, unrolled, it looked like this before:

idx = (sourceMap.sources.indexof(str) >= 0);
//idx will now be true or false
//Now we'll compare true to our current index, which will always be true for i > 1.
if (idx < i){
...
}

This was causing the sourcemap dev tool to append "*" unnecessarily to some of my sources.
This same construct is also found in the other SourceMapDevTool plugins I believe.