Remove unneeded Ctor variables.

This commit is contained in:
John-David Dalton
2016-02-23 10:42:04 -08:00
parent 45d2fb8a30
commit 21f9cfa6d3

View File

@@ -3792,9 +3792,7 @@
if (isDeep) {
return buffer.slice();
}
var Ctor = buffer.constructor,
result = new Ctor(buffer.length);
var result = new buffer.constructor(buffer.length);
buffer.copy(result);
return result;
}
@@ -3807,11 +3805,8 @@
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var Ctor = arrayBuffer.constructor,
result = new Ctor(arrayBuffer.byteLength),
view = new Uint8Array(result);
view.set(new Uint8Array(arrayBuffer));
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
@@ -3823,8 +3818,7 @@
* @returns {Object} Returns the cloned map.
*/
function cloneMap(map) {
var Ctor = map.constructor;
return arrayReduce(mapToArray(map), addMapEntry, new Ctor);
return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
}
/**
@@ -3835,9 +3829,7 @@
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var Ctor = regexp.constructor,
result = new Ctor(regexp.source, reFlags.exec(regexp));
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
@@ -3850,8 +3842,7 @@
* @returns {Object} Returns the cloned set.
*/
function cloneSet(set) {
var Ctor = set.constructor;
return arrayReduce(setToArray(set), addSetEntry, new Ctor);
return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
}
/**
@@ -3874,11 +3865,8 @@
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var arrayBuffer = typedArray.buffer,
buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer,
Ctor = typedArray.constructor;
return new Ctor(buffer, typedArray.byteOffset, typedArray.length);
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
/**