Skip to content

Commit

Permalink
deletionBraceCount
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Dec 11, 2019
1 parent caa269b commit 943e19c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 7 additions & 8 deletions build/build-cdt-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for (const [input, output] of Object.entries(files)) {
lines = lines.splice(0, cutoffIndex);

let deletionMode = false;
let deletionCounter = 0;
let deletionBraceCount = 0;

const modifiedLines = lines.map((line, i) => {
// Don't modify jsdoc comments.
Expand All @@ -35,23 +35,22 @@ for (const [input, output] of Object.entries(files)) {
if (input.endsWith('SourceMap.js')) {
if (line.includes('static load(')) deletionMode = true;
if (line.includes('sourceContentProvider(')) deletionMode = true;
// if (line.includes('Common.UIString')) newLine = '';
if (line.includes('Common.UIString')) newLine = '';
if (line.includes('export class WasmSourceMap')) deletionMode = true;
if (line.includes('WasmSourceMap')) newLine = '';
if (line.includes('export class EditResult')) deletionMode = true;
newLine = newLine.replace(`Common.ParsedURL.completeURL(this._baseURL, href)`, `''`);
}

if (deletionMode) {
if (line.trim().endsWith('{')) deletionCounter += 1;
if (line.trim().startsWith('}')) deletionCounter -= 1;
if (deletionCounter >= 0) {
if (line.trim().endsWith('{')) deletionBraceCount += 1;
if (line.trim().startsWith('}')) deletionBraceCount -= 1;
if (deletionBraceCount >= 0) {
newLine = '';
// newLine = newLine.trim() + ` /* hi ${deletionCounter} */\n`;
}
if (deletionCounter === 0) {
if (deletionBraceCount === 0) {
deletionMode = false;
deletionCounter = 0;
deletionBraceCount = 0;
}
}

Expand Down
1 change: 0 additions & 1 deletion lighthouse-core/lib/cdt/generated/SourceMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ const TextSourceMap = module.exports.TextSourceMap = class TextSourceMap {
let url = '' || href;
const source = sourceMap.sourcesContent && sourceMap.sourcesContent[i];
if (url === this._compiledURL && source) {
url += Common.UIString('? [sm]');
}
this._sourceInfos.set(url, new TextSourceMap.SourceInfo(source, null));
sourcesList.push(url);
Expand Down

0 comments on commit 943e19c

Please sign in to comment.