Skip to content

Commit 2ef150f

Browse files
committed
bind getByteWidth to the vector type
1 parent 9acfaa3 commit 2ef150f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

js/src/vector/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ BaseVector.prototype[Symbol.iterator] = function baseVectorSymbolIterator<T exte
134134
VectorCtor.prototype['set'] = partial2(setVisitor.getVisitFn(typeId));
135135
VectorCtor.prototype['indexOf'] = partial2(indexOfVisitor.getVisitFn(typeId));
136136
VectorCtor.prototype['toArray'] = partial0(toArrayVisitor.getVisitFn(typeId));
137-
VectorCtor.prototype['getByteWidth'] = partial0(byteWidthVisitor.getVisitFn(typeId));
137+
VectorCtor.prototype['getByteWidth'] = partialType0(byteWidthVisitor.getVisitFn(typeId));
138138
VectorCtor.prototype[Symbol.iterator] = partial0(iteratorVisitor.getVisitFn(typeId));
139139
});
140140
});
@@ -144,6 +144,11 @@ function partial0<T>(visit: (node: T) => any) {
144144
return function(this: T) { return visit(this); };
145145
}
146146

147+
/** @ignore */
148+
function partialType0<T extends Vector>(visit: (node: T['type']) => any) {
149+
return function(this: T) { return visit(this.type); };
150+
}
151+
147152
/** @ignore */
148153
function partial1<T>(visit: (node: T, a: any) => any) {
149154
return function(this: T, a: any) { return visit(this, a); };

0 commit comments

Comments
 (0)