Remove labeled break #5

Closed
zefhemel wants to merge 1 commit from main into main
zefhemel commented 2022-02-25 09:50:07 +01:00 (Migrated from github.com)

When building bundles with e.g. Parcel (which uses terser) or UglifyJS minification fails:

@parcel/optimizer-terser: Undefined label scan

  /Users/zef/git/noot/webapp/node_modules/@lezer/common/dist/index.js:1441:34
    1440 |                     if (!cursor.parent())
  > 1441 |                         break scan;
  >      |                                  ^ Undefined label scan
    1442 |                     if (overlay && !--overlay.depth) {
    1443 |                         let ranges = punchRanges(this.ranges, overlay.ranges);

To circumvent this, I have replaced this particular labeled break with a return which, from what I can deduce should be 100% equivalent to the break (in this case). Both the break and return would effectively jump out of the outer for loop and immediately return (with no value).

When building bundles with e.g. Parcel (which uses terser) or UglifyJS minification fails: ``` @parcel/optimizer-terser: Undefined label scan /Users/zef/git/noot/webapp/node_modules/@lezer/common/dist/index.js:1441:34 1440 | if (!cursor.parent()) > 1441 | break scan; > | ^ Undefined label scan 1442 | if (overlay && !--overlay.depth) { 1443 | let ranges = punchRanges(this.ranges, overlay.ranges); ``` To circumvent this, I have replaced this particular labeled break with a `return` which, from what I can deduce should be 100% equivalent to the break (in this case). Both the `break` and `return` would effectively jump out of the outer `for` loop and immediately return (with no value).
marijnh commented 2022-02-25 11:01:21 +01:00 (Migrated from github.com)

Sorry, but if your tools can't handle JavaScript, I feel you should fix/replace the tools, not send PRs to your dependencies to avoid certain features in their code.

Sorry, but if your tools can't handle JavaScript, I feel you should fix/replace the tools, not send PRs to your dependencies to avoid certain features in their code.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/common!5
No description provided.