Skip to content

Commit d7c2377

Browse files
committed
Address PR comments
Except for the textToToken map exemption
1 parent 42d357a commit d7c2377

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/compiler/parser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8698,12 +8698,12 @@ namespace Parser {
86988698

86998699
function removeTrailingWhitespace(comments: string[]) {
87008700
while (comments.length) {
8701-
const trimmed = trimString(comments[comments.length - 1]);
8701+
const trimmed = trimStringEnd(comments[comments.length - 1]);
87028702
if (trimmed === "") {
87038703
comments.pop();
87048704
}
87058705
else if (trimmed.length < comments[comments.length - 1].length) {
8706-
comments[comments.length - 1] = trimStringEnd(comments[comments.length - 1]);
8706+
comments[comments.length - 1] = trimmed;
87078707
break;
87088708
}
87098709
else {

src/compiler/scanner.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2465,16 +2465,16 @@ export function createScanner(languageVersion: ScriptTarget,
24652465
if (pos >= end) {
24662466
return token = SyntaxKind.EndOfFileToken;
24672467
}
2468-
for (let ch = codePointAt(text, pos);
2469-
pos < end && (ch !== CharacterCodes.lineFeed && ch !== CharacterCodes.carriageReturn && ch !== CharacterCodes.backtick);
2470-
ch = codePointAt(text, pos += charSize(ch))) {
2468+
for (let ch = text.charCodeAt(pos);
2469+
pos < end && (!isLineBreak(ch) && ch !== CharacterCodes.backtick);
2470+
ch = codePointAt(text, ++pos)) {
24712471
if (!inBackticks) {
24722472
if (ch === CharacterCodes.openBrace) {
24732473
break;
24742474
}
24752475
else if (ch === CharacterCodes.at
2476-
&& pos - 1 >= 0 && isWhiteSpaceSingleLine(codePointAt(text, pos - 1))
2477-
&& !(pos + 1 < end && isWhiteSpaceLike(codePointAt(text, pos + 1)))) {
2476+
&& pos - 1 >= 0 && isWhiteSpaceSingleLine(text.charCodeAt(pos - 1))
2477+
&& !(pos + 1 < end && isWhiteSpaceLike(text.charCodeAt(pos + 1)))) {
24782478
// @ doesn't start a new tag inside ``, and elsewhere, only after whitespace and before non-whitespace
24792479
break;
24802480
}

0 commit comments

Comments
 (0)