return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine);
const UChar* data = m_source->provider()->data();
-
+
ASSERT(openBrace < closeBrace);
-
- int numBOMsBeforeOpenBrace = 0;
- int numBOMsBetweenBraces = 0;
-
int i;
- for (i = m_source->startOffset(); i < openBrace; ++i)
- numBOMsBeforeOpenBrace += data[i] == byteOrderMark;
- for (; i < closeBrace; ++i)
- numBOMsBetweenBraces += data[i] == byteOrderMark;
+ for (i = m_source->startOffset(); i < openBrace; ++i) {
+ if (data[i] == byteOrderMark) {
+ openBrace++;
+ closeBrace++;
+ }
+ }
+ for (; i < closeBrace; ++i) {
+ if (data[i] == byteOrderMark)
+ closeBrace++;
+ }
+
+ ASSERT(openBrace < closeBrace);
- return SourceCode(m_source->provider(), openBrace + numBOMsBeforeOpenBrace,
- closeBrace + numBOMsBeforeOpenBrace + numBOMsBetweenBraces + 1, firstLine);
+ return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine);
}
} // namespace JSC