@typeberry/jam 0.1.2-ef67dce → 0.1.3-707962d

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.
@@ -5500,13 +5500,15 @@ function validateLength(range, length, context) {
5500
5500
 
5501
5501
  /** A caching wrapper for either object or sequence item. */
5502
5502
  class ViewField {
5503
+ name;
5503
5504
  getView;
5504
5505
  getValue;
5505
5506
  getEncoded;
5506
5507
  cachedValue;
5507
5508
  cachedView;
5508
5509
  cachedBlob;
5509
- constructor(getView, getValue, getEncoded) {
5510
+ constructor(name, getView, getValue, getEncoded) {
5511
+ this.name = name;
5510
5512
  this.getView = getView;
5511
5513
  this.getValue = getValue;
5512
5514
  this.getEncoded = getEncoded;
@@ -5532,6 +5534,9 @@ class ViewField {
5532
5534
  }
5533
5535
  return this.cachedBlob;
5534
5536
  }
5537
+ toString() {
5538
+ return `ViewField<${this.name}>`;
5539
+ }
5535
5540
  }
5536
5541
  /**
5537
5542
  * A base class for all the lazy views.
@@ -5606,7 +5611,7 @@ class ObjectView {
5606
5611
  const fieldDecoder = skipper.decoder.clone();
5607
5612
  const field = this.descriptorsKeys[i];
5608
5613
  const type = this.descriptors[field];
5609
- lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
5614
+ lastItem = new ViewField(`${this.toString()}.${String(field)}`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
5610
5615
  // skip the field
5611
5616
  type.skip(skipper);
5612
5617
  // cache data
@@ -5618,6 +5623,9 @@ class ObjectView {
5618
5623
  }
5619
5624
  return lastItem;
5620
5625
  }
5626
+ toString() {
5627
+ return `View<${this.materializedConstructor.name}>(cache: ${this.cache.size})`;
5628
+ }
5621
5629
  }
5622
5630
  /**
5623
5631
  * A lazy-evaluated decoder of a sequence.
@@ -5706,7 +5714,7 @@ class SequenceView {
5706
5714
  // create new cached prop
5707
5715
  const fieldDecoder = skipper.decoder.clone();
5708
5716
  const type = this.descriptor;
5709
- lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
5717
+ lastItem = new ViewField(`${this.toString()}[${index}]`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
5710
5718
  // skip the field
5711
5719
  type.skip(skipper);
5712
5720
  // cache data
@@ -5718,6 +5726,9 @@ class SequenceView {
5718
5726
  }
5719
5727
  return lastItem;
5720
5728
  }
5729
+ toString() {
5730
+ return `SequenceView<${this.descriptor.name}>(cache: ${this.cache.size})`;
5731
+ }
5721
5732
  }
5722
5733
 
5723
5734
  ;// CONCATENATED MODULE: ./packages/core/codec/descriptors.ts