dont extract regular expressions from strings that are leaves in a string concat

This commit is contained in:
Erik Krogh Kristensen
2021-11-10 14:11:48 +01:00
parent f01ee5914b
commit 98da532c46
7 changed files with 843 additions and 945 deletions

View File

@@ -596,7 +596,7 @@ public class ASTExtractor {
offsets.set(0, 1); // skip the initial '/'
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, offsets), startPos);
regexpExtractor.extract(source.substring(1, source.lastIndexOf('/')), sourceMap, nd, false);
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000) {
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000 && !c.isBinopOperand()) {
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, makeStringLiteralOffsets(nd.getRaw())), startPos);
regexpExtractor.extract(valueString, sourceMap, nd, true);