lex file to the end for isMinified check to not start from the middle of string literal

fixes JSIndexTest.testMinifiedFile2(right-slider.m.js)
This commit is contained in:
Konstantin Ulitin
2017-04-18 17:17:38 +03:00
parent 853385a6e9
commit b99e7e0616

View File

@@ -80,7 +80,12 @@ public class MinifiedFilesUtil {
if (startOffset <= 0) {
return true;
}
lexer.start(fileContent, startOffset, fileContent.length());
while (lexer.getTokenType() != null && lexer.getTokenStart() < startOffset) lexer.advance();
if (lexer.getTokenType() == null || (fileContent.length() - lexer.getTokenStart() < MIN_SIZE * 2)) {
return true;
}
return isMinified(lexer, parserDefinition, noWSRequireBeforeTokenSet, noWSRequireAfterTokenSet, stringsTokenSet);
}