Handle null toString in typed arrays
This commit is contained in:
@@ -241,7 +241,9 @@ class ArrayBufferView {
|
|||||||
|
|
||||||
#if !no_typedarray_inline inline #end
|
#if !no_typedarray_inline inline #end
|
||||||
function toString() {
|
function toString() {
|
||||||
|
|
||||||
|
if (this == null) return null;
|
||||||
|
|
||||||
var name =
|
var name =
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case Int8: 'Int8Array';
|
case Int8: 'Int8Array';
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Float32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Float32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ abstract Float32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
|
|
||||||
//Internal
|
//Internal
|
||||||
|
|
||||||
function toString() return 'Float32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Float32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
inline function get_length() return this.length;
|
inline function get_length() return this.length;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Float64Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Float64Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract Float64Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setFloat64(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
return ArrayBufferIO.setFloat64(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Float64Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Float64Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int16Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract Int16Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setInt16(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
return ArrayBufferIO.setInt16(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int16Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract Int32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
return ArrayBufferIO.setInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int8Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract Int8Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setInt8(this.buffer, this.byteOffset+idx, val);
|
return ArrayBufferIO.setInt8(this.buffer, this.byteOffset+idx, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'Int8Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'Int8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt16Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract UInt16Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setUint16(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
return ArrayBufferIO.setUint16(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt16Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt16Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ abstract UInt32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
return ArrayBufferIO.setUint32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
return ArrayBufferIO.setUint32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt32Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt32Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ abstract UInt8Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView {
|
|||||||
|
|
||||||
//Internal
|
//Internal
|
||||||
|
|
||||||
function toString() return 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
inline function get_length() return this.length;
|
inline function get_length() return this.length;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ package lime.utils;
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt8ClampedArray [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt8ClampedArray [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
//internal
|
//internal
|
||||||
//clamp a Int to a 0-255 Uint8
|
//clamp a Int to a 0-255 Uint8
|
||||||
@@ -129,7 +129,7 @@ abstract UInt8ClampedArray(ArrayBufferView) from ArrayBufferView to ArrayBufferV
|
|||||||
return ArrayBufferIO.setUint8Clamped(this.buffer, this.byteOffset+idx, val);
|
return ArrayBufferIO.setUint8Clamped(this.buffer, this.byteOffset+idx, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString() return 'UInt8ClampedArray [byteLength:${this.byteLength}, length:${this.length}]';
|
function toString() return this != null ? 'UInt8ClampedArray [byteLength:${this.byteLength}, length:${this.length}]' : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user