@tsplc/compiler 0.5.17 → 0.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7785,7 +7785,7 @@ var namedFields = (pattern, declared) => pattern.elements.map((element) => {
7785
7785
 
7786
7786
  // packages/compiler/src/frontend/elaborate/dialect.ts
7787
7787
  import { canAssign as canAssign2, integerType, primitiveTypes as primitiveTypes3 } from "@tsplc/compiler/ir";
7788
- import { elementaryType as elementaryType2 } from "@tsplc/iec";
7788
+ import { elementaryType as elementaryType2, fitsNumber, isIntegerValued } from "@tsplc/iec";
7789
7789
  import ts31 from "typescript";
7790
7790
 
7791
7791
  // packages/compiler/src/frontend/elaborate/references.ts
@@ -8570,7 +8570,10 @@ class DialectText {
8570
8570
  const leftText = this.code(left, right.kind === "code" ? right.declared ?? declared : declared);
8571
8571
  const rightText = this.code(right, left.kind === "code" ? left.declared ?? declared : declared);
8572
8572
  if (left.kind !== "code" || right.kind !== "code") {
8573
- return [leftText, rightText];
8573
+ return [
8574
+ bigintBeside(left, right, leftText),
8575
+ bigintBeside(right, left, rightText)
8576
+ ];
8574
8577
  }
8575
8578
  const from = left.iec ?? defaultNumericTypes.number;
8576
8579
  const to = right.iec ?? defaultNumericTypes.number;
@@ -8586,7 +8589,10 @@ class DialectText {
8586
8589
  if (left.kind !== "code" || right.kind !== "code") {
8587
8590
  const operand = left.kind === "code" ? left : right;
8588
8591
  return {
8589
- texts: [leftText, rightText],
8592
+ texts: [
8593
+ bigintBeside(left, right, leftText),
8594
+ bigintBeside(right, left, rightText)
8595
+ ],
8590
8596
  iec: operand.kind === "code" ? operand.iec : undefined
8591
8597
  };
8592
8598
  }
@@ -8604,6 +8610,11 @@ class DialectText {
8604
8610
  };
8605
8611
  }
8606
8612
  }
8613
+ var bigintWidth = (iec) => {
8614
+ const type = iec === undefined ? undefined : elementaryType2(iec);
8615
+ return isIntegerValued(type) && !fitsNumber(type);
8616
+ };
8617
+ var bigintBeside = (value, other, text) => value.kind === "const" && typeof value.value === "number" && Number.isInteger(value.value) && other.kind === "code" && bigintWidth(other.iec) ? `${value.value}n` : text;
8607
8618
  var integerTypes = new Map(primitiveTypes3.filter(integerType).map((type) => [type.id, type]));
8608
8619
  var storedWidth = (declared, iec) => iec ?? (declared && declared.flags & ts31.TypeFlags.Number ? defaultNumericTypes.number : undefined);
8609
8620
  var commonWidth = (from, to) => {
@@ -12193,7 +12204,14 @@ class Storage {
12193
12204
  }
12194
12205
  flattened(root) {
12195
12206
  const node = this.model.node(root.value);
12196
- return node?.captured.kind === "object" || node?.captured.kind === "instance";
12207
+ if (node?.captured.kind === "instance") {
12208
+ return true;
12209
+ }
12210
+ if (node?.captured.kind !== "object") {
12211
+ return false;
12212
+ }
12213
+ const key = node.type && recordTypes(node.type)?.key;
12214
+ return !key || (key.flags & (ts36.TypeFlags.EnumLike | ts36.TypeFlags.NumberLike)) === 0;
12197
12215
  }
12198
12216
  reach(root) {
12199
12217
  const module = this.rootModule(root);
@@ -15343,5 +15361,5 @@ export {
15343
15361
  typeCheckOnly
15344
15362
  };
15345
15363
 
15346
- //# debugId=8E14995F9D4D6F2E64756E2164756E21
15364
+ //# debugId=AA61B96D6A9DD42B64756E2164756E21
15347
15365
  //# sourceMappingURL=index.js.map