Skip to content

Commit

Permalink
Fix discarded bit array pattern segments resulting in unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-viney committed Feb 10, 2025
1 parent 255e24e commit b011d2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions compiler-core/src/javascript/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ impl<'module_ctx, 'expression_gen, 'a> Generator<'module_ctx, 'expression_gen, '
}
}

Pattern::Discard { .. } => {
offset.increment(details.size);
}

_ => {
let start = offset.bits;
let increment = details.size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn go(x) {


----- COMPILED JAVASCRIPT
import { makeError, bitArraySliceToInt } from "../gleam.mjs";
import { makeError } from "../gleam.mjs";

function go(x) {
if (!(x.bitSize == 24)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn go(x) {


----- COMPILED JAVASCRIPT
import { makeError, toBitArray, bitArraySlice, bitArraySliceToInt, sizedInt } from "../gleam.mjs";
import { makeError, toBitArray, bitArraySlice, sizedInt } from "../gleam.mjs";

function go(x) {
let $ = toBitArray([sizedInt(0x77, 7, true)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn go(x) {


----- COMPILED JAVASCRIPT
import { makeError, toBitArray, bitArraySlice, bitArraySliceToInt } from "../gleam.mjs";
import { makeError, toBitArray, bitArraySlice } from "../gleam.mjs";

function go(x) {
let $ = toBitArray([1, 2, 3]);
Expand Down

0 comments on commit b011d2d

Please sign in to comment.