Skip to content

Commit

Permalink
Improve DCE by code moving out of static block
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Feb 24, 2024
1 parent f8850db commit fc2a76a
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 250 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Expand Up @@ -18,6 +18,12 @@ module.exports = {
'no-constant-condition': 'off',
'no-unused-labels': 'off',
'prefer-rest-params': 'off',
'prefer-const': [
'error',
{
destructuring: 'all',
},
],
},
overrides: [
{
Expand Down
5 changes: 3 additions & 2 deletions src/by-source.ts
Expand Up @@ -34,13 +34,14 @@ export default function buildBySources(
// segment should go. Either way, we want to insert after that. And there may be multiple
// generated segments associated with an original location, so there may need to move several
// indexes before we find where we need to insert.
const index = upperBound(
let index = upperBound(
originalLine,
sourceColumn,
memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine),
);

insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
memo.lastIndex = ++index;
insert(originalLine, index, [sourceColumn, i, seg[COLUMN]]);
}
}

Expand Down

0 comments on commit fc2a76a

Please sign in to comment.