@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.
@@ -6908,13 +6908,15 @@ function validateLength(range, length, context) {
6908
6908
 
6909
6909
  /** A caching wrapper for either object or sequence item. */
6910
6910
  class ViewField {
6911
+ name;
6911
6912
  getView;
6912
6913
  getValue;
6913
6914
  getEncoded;
6914
6915
  cachedValue;
6915
6916
  cachedView;
6916
6917
  cachedBlob;
6917
- constructor(getView, getValue, getEncoded) {
6918
+ constructor(name, getView, getValue, getEncoded) {
6919
+ this.name = name;
6918
6920
  this.getView = getView;
6919
6921
  this.getValue = getValue;
6920
6922
  this.getEncoded = getEncoded;
@@ -6940,6 +6942,9 @@ class ViewField {
6940
6942
  }
6941
6943
  return this.cachedBlob;
6942
6944
  }
6945
+ toString() {
6946
+ return `ViewField<${this.name}>`;
6947
+ }
6943
6948
  }
6944
6949
  /**
6945
6950
  * A base class for all the lazy views.
@@ -7014,7 +7019,7 @@ class ObjectView {
7014
7019
  const fieldDecoder = skipper.decoder.clone();
7015
7020
  const field = this.descriptorsKeys[i];
7016
7021
  const type = this.descriptors[field];
7017
- lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
7022
+ lastItem = new ViewField(`${this.toString()}.${String(field)}`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
7018
7023
  // skip the field
7019
7024
  type.skip(skipper);
7020
7025
  // cache data
@@ -7026,6 +7031,9 @@ class ObjectView {
7026
7031
  }
7027
7032
  return lastItem;
7028
7033
  }
7034
+ toString() {
7035
+ return `View<${this.materializedConstructor.name}>(cache: ${this.cache.size})`;
7036
+ }
7029
7037
  }
7030
7038
  /**
7031
7039
  * A lazy-evaluated decoder of a sequence.
@@ -7114,7 +7122,7 @@ class SequenceView {
7114
7122
  // create new cached prop
7115
7123
  const fieldDecoder = skipper.decoder.clone();
7116
7124
  const type = this.descriptor;
7117
- lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
7125
+ lastItem = new ViewField(`${this.toString()}[${index}]`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
7118
7126
  // skip the field
7119
7127
  type.skip(skipper);
7120
7128
  // cache data
@@ -7126,6 +7134,9 @@ class SequenceView {
7126
7134
  }
7127
7135
  return lastItem;
7128
7136
  }
7137
+ toString() {
7138
+ return `SequenceView<${this.descriptor.name}>(cache: ${this.cache.size})`;
7139
+ }
7129
7140
  }
7130
7141
 
7131
7142
  ;// CONCATENATED MODULE: ./packages/core/codec/descriptors.ts