回退 'Pull Request !490 : Fix the bug of incorrect sourcemap when enabling compact [tsc]'

This commit is contained in:
oh_ci 2024-11-05 09:14:24 +00:00 committed by Gitee
parent af46b5f1ef
commit 55e65f4a7c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 29 additions and 144 deletions

View File

@ -39191,12 +39191,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -39220,13 +39217,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -39237,15 +39230,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -39260,7 +39248,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -47603,14 +47603,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
// If the last character of string is the one of below chars, there is no need to write space again.
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -47634,15 +47629,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -47653,16 +47642,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
// Get the last character of a string.
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -47677,7 +47660,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -47602,14 +47602,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
// If the last character of string is the one of below chars, there is no need to write space again.
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -47633,15 +47628,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -47652,16 +47641,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
// Get the last character of a string.
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -47676,7 +47659,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -47593,14 +47593,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
// If the last character of string is the one of below chars, there is no need to write space again.
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -47624,15 +47619,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -47643,16 +47632,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
// Get the last character of a string.
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -47667,7 +47650,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -47593,14 +47593,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
// If the last character of string is the one of below chars, there is no need to write space again.
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -47624,15 +47619,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -47643,16 +47632,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
// Get the last character of a string.
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -47667,7 +47650,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -47583,14 +47583,9 @@ var ts;
var output;
var lineStart;
var linePos;
var lineCount;
// If the last character of string is the one of below chars, there is no need to write space again.
var noSpaceTrailingChars = new ts.Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s) {
var lineStartsOfS = ts.computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + ts.last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -47614,15 +47609,9 @@ var ts;
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -47633,16 +47622,10 @@ var ts;
}
}
function writeLine(force) {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input) {
// Get the last character of a string.
var lastChar = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
return lineStart ? output.length : (output.length + space.length);
@ -47657,7 +47640,7 @@ var ts;
decreaseIndent: ts.noop,
getIndent: function () { return 0; },
getTextPos: function () { return output.length; },
getLine: function () { return lineCount; },
getLine: function () { return 0; },
getColumn: function () { return lineStart ? 0 : output.length - linePos; },
getText: function () { return output; },
isAtStartOfLine: function () { return lineStart; },

View File

@ -930,15 +930,10 @@ namespace ts {
let output: string;
let lineStart: boolean;
let linePos: number;
let lineCount: number;
// If the last character of string is the one of below chars, there is no need to write space again.
const noSpaceTrailingChars: Set<string> = new Set([' ', ';', ',', '(', ')', '{', '}']);
function updateLineCountAndPosFor(s: string) {
const lineStartsOfS = computeLineStarts(s);
if (lineStartsOfS.length > 1) {
// 1: The first element of the lineStartsOfS
lineCount = lineCount + lineStartsOfS.length - 1;
linePos = output.length - s.length + last(lineStartsOfS);
lineStart = (linePos - output.length) === 0;
}
@ -965,16 +960,10 @@ namespace ts {
output = "";
lineStart = true;
linePos = 0;
lineCount = 0;
}
// This method is used to write indentation and line breaks. If the string is blank, the writing is skipped.
// In addition, this method can be called to write comments and code in bundle mode, but obfuscation is not in bundle mode.
function rawWrite(s: string) {
if (s !== undefined) {
if ((lineStart || endsWithNoSpaceTrailingChar(output)) && s.trim().length === 0) {
return;
}
output += s;
updateLineCountAndPosFor(s);
}
@ -986,18 +975,11 @@ namespace ts {
}
}
function writeLine(force?: boolean): void {
if (!force && (lineStart || endsWithNoSpaceTrailingChar(output))) {
return;
function writeLine(force?: boolean) {
if (!lineStart || force) {
output += space;
linePos = output.length;
}
output += space;
lineStart = false;
}
function endsWithNoSpaceTrailingChar(input: string): boolean {
// Get the last character of a string.
const lastChar: string = input.charAt(input.length - 1);
return noSpaceTrailingChars.has(lastChar);
}
function getTextPosWithWriteLine() {
@ -1015,7 +997,7 @@ namespace ts {
decreaseIndent: noop,
getIndent: () => 0,
getTextPos: () => output.length,
getLine: () => lineCount,
getLine: () => 0,
getColumn: () => lineStart ? 0 : output.length - linePos,
getText: () => output,
isAtStartOfLine: () => lineStart,