!121 Fix bug with no spaces between decorators and modifiers

Merge pull request !121 from zhangchen168/0829-fix-space
This commit is contained in:
openharmony_ci 2023-08-30 10:10:11 +00:00 committed by Gitee
commit 70f69da718
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 4 deletions

View File

@ -7411,6 +7411,7 @@ namespace ts {
namespace ts {
export function createObfTextSingleLineWriter(): EmitTextWriter {
const space: string = " ";
let output: string;
let lineStart: boolean;
let linePos: number;
@ -7440,7 +7441,6 @@ namespace ts {
writeText(s);
}
function reset(): void {
output = "";
lineStart = true;
@ -7460,8 +7460,15 @@ namespace ts {
}
}
function writeLine(force?: boolean) {
if (!lineStart || force) {
output += space;
linePos = output.length;
}
}
function getTextPosWithWriteLine() {
return output.length;
return lineStart ? output.length : (output.length + space.length);
}
reset();
@ -7470,7 +7477,7 @@ namespace ts {
write,
rawWrite,
writeLiteral,
writeLine: noop,
writeLine,
increaseIndent: noop,
decreaseIndent: noop,
getIndent: () => 0,
@ -7480,7 +7487,7 @@ namespace ts {
getText: () => output,
isAtStartOfLine: () => lineStart,
hasTrailingComment: () => false,
hasTrailingWhitespace: () => false,
hasTrailingWhitespace: () => !!output.length && isWhiteSpaceLike(output.charCodeAt(output.length - 1)),
clear: reset,
reportInaccessibleThisError: noop,
reportPrivateInBaseOfClassExpression: noop,