Skip to content

Commit 1194b65

Browse files
committed
replace underscore with hashtag notation
1 parent 4d313cb commit 1194b65

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/lib/provable/dynamic-array.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
165165
* duplicated when doing it on the same variable multiple times.
166166
*/
167167
assertIndexInRange(i: Field): void {
168-
if (!this._indicesInRange.has(i)) {
168+
if (!this.#indicesInRange.has(i)) {
169169
if (i.isConstant() && this.length.isConstant()) {
170170
assert(i.toBigInt() < this.length.toBigInt(), 'assertIndexInRange');
171171
}
172172
i.lessThan(this.length).assertTrue();
173-
this._indicesInRange.add(i);
173+
this.#indicesInRange.add(i);
174174
}
175175
}
176176

@@ -235,7 +235,7 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
235235
* Sets a value at index i, or does nothing if the index is not in the array
236236
*/
237237
setOrDoNothing(i: Field, value: ProvableValue): void {
238-
zip(this.array, this._indexMask(i)).forEach(([t, equalsIJ], i) => {
238+
zip(this.array, this.#indexMask(i)).forEach(([t, equalsIJ], i) => {
239239
this.array[i] = Provable.if(equalsIJ, this.innerType, value, t);
240240
});
241241
}
@@ -255,9 +255,9 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
255255
let newArray = new Array(array, this.length);
256256

257257
// new array has same length/capacity, so it can use the same cached masks
258-
newArray._indexMasks = this._indexMasks;
259-
newArray._indicesInRange = this._indicesInRange;
260-
newArray._dummies = this._dummies;
258+
newArray.#indexMasks = this.#indexMasks;
259+
newArray.#indicesInRange = this.#indicesInRange;
260+
newArray.#dummies = this.#dummies;
261261
return newArray;
262262
}
263263

@@ -268,7 +268,7 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
268268
* whether the value is part of the actual array.
269269
*/
270270
forEach(f: (t: ProvableValue, isDummy: Bool) => void) {
271-
zip(this.array, this._dummyMask()).forEach(([t, isDummy]) => {
271+
zip(this.array, this.#dummyMask()).forEach(([t, isDummy]) => {
272272
f(t, isDummy);
273273
});
274274
}
@@ -500,9 +500,9 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
500500

501501
// cached variables to not duplicate constraints if we do something like
502502
// array.get(i), array.set(i, ..) on the same index
503-
_indexMasks: Map<Field, Bool[]> = new Map();
504-
_indicesInRange: Set<Field> = new Set();
505-
_dummies?: Bool[];
503+
#indexMasks: Map<Field, Bool[]> = new Map();
504+
#indicesInRange: Set<Field> = new Set();
505+
#dummies?: Bool[];
506506

507507
/**
508508
* Compute i.equals(j) for all indices j in the static-size array.
@@ -512,10 +512,10 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
512512
* ^
513513
* i
514514
*/
515-
_indexMask(i: Field): Bool[] {
516-
let mask = this._indexMasks.get(i);
515+
#indexMask(i: Field): Bool[] {
516+
let mask = this.#indexMasks.get(i);
517517
mask ??= this.array.map((_, j) => i.equals(j));
518-
this._indexMasks.set(i, mask);
518+
this.#indexMasks.set(i, mask);
519519
return mask;
520520
}
521521

@@ -526,16 +526,16 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
526526
* ^
527527
* length
528528
*/
529-
_dummyMask(): Bool[] {
530-
if (this._dummies !== undefined) return this._dummies;
531-
let isLength = this._indexMask(this.length);
529+
#dummyMask(): Bool[] {
530+
if (this.#dummies !== undefined) return this.#dummies;
531+
let isLength = this.#indexMask(this.length);
532532
let wasLength = new Bool(false);
533533

534534
let mask = isLength.map((isLength) => {
535535
wasLength = wasLength.or(isLength);
536536
return wasLength;
537537
});
538-
this._dummies = mask;
538+
this.#dummies = mask;
539539
return mask;
540540
}
541541

0 commit comments

Comments
 (0)