Fix Haxe4 dev warnings

This commit is contained in:
Joshua Granick
2019-03-20 11:28:13 -07:00
parent a4cc3c13a9
commit 4a7a9eae9e
18 changed files with 198 additions and 125 deletions

View File

@@ -649,7 +649,10 @@ class Bytes
}
#elseif js
#if !nodejs
#if (haxe_ver < 4.0)
#if haxe4
import js.lib.Uint8Array;
import js.lib.DataView;
#else
import js.html.compat.Uint8Array;
import js.html.compat.DataView;
#end
@@ -666,13 +669,13 @@ class Bytes
#else
public var length(default, null):Int;
#end
var b:js.html.Uint8Array;
var data:js.html.DataView;
var b:Uint8Array;
var data:DataView;
function new(data:BytesData)
{
this.length = data.byteLength;
this.b = new js.html.Uint8Array(data);
this.b = new Uint8Array(data);
untyped
{
b.bufferValue = data; // some impl does not return the same instance in .buffer
@@ -723,7 +726,7 @@ class Bytes
inline function initData():Void
{
if (data == null) data = new js.html.DataView(b.buffer, b.byteOffset, b.byteLength);
if (data == null) data = new DataView(b.buffer, b.byteOffset, b.byteLength);
}
public function getDouble(pos:Int):Float
@@ -889,7 +892,7 @@ class Bytes
a.push(0x80 | (c & 63));
}
}
return new Bytes(new js.html.Uint8Array(a).buffer);
return new Bytes(new Uint8Array(a).buffer);
}
public static function ofData(b:BytesData):Bytes
@@ -915,7 +918,7 @@ class Bytes
i++;
}
return new Bytes(new js.html.Uint8Array(a).buffer);
return new Bytes(new Uint8Array(a).buffer);
}
public inline static function fastGet(b:BytesData, pos:Int):Int

View File

@@ -14,13 +14,15 @@ import lime.net.HTTPRequestHeader;
import lime.net.HTTPRequestMethod;
import lime.system.ThreadPool;
#if sys
import sys.FileSystem;
#end
#if cpp
#if haxe4
import sys.thread.Deque;
#elseif cpp
import cpp.vm.Deque;
#elseif neko
import neko.vm.Deque;
#end
import sys.FileSystem;
#end
#if !lime_debug
@:fileXml('tags="haxe,release"')

View File

@@ -9,8 +9,12 @@ import js.html.CanvasElement;
import js.html.CanvasRenderingContext2D;
import js.html.Image as HTMLImage;
import js.html.ImageData;
import js.html.Uint8ClampedArray;
import js.Browser;
#if haxe4
import js.lib.Uint8ClampedArray;
#else
import js.html.Uint8ClampedArray;
#end
#elseif flash
import flash.display.BitmapData;
#end

View File

@@ -2,13 +2,18 @@ package lime.system;
import lime.app.Application;
import lime.app.Event;
#if cpp
#if sys
#if haxe4
import sys.thread.Deque;
import sys.thread.Thread;
#elseif cpp
import cpp.vm.Deque;
import cpp.vm.Thread;
#elseif neko
import neko.vm.Deque;
import neko.vm.Thread;
#end
#end
#if !lime_debug
@:fileXml('tags="haxe,release"')

View File

@@ -3,13 +3,18 @@ package lime.system;
import haxe.Constraints.Function;
import lime.app.Application;
import lime.app.Event;
#if cpp
#if sys
#if haxe4
import sys.thread.Deque;
import sys.thread.Thread;
#elseif cpp
import cpp.vm.Deque;
import cpp.vm.Thread;
#elseif neko
import neko.vm.Deque;
import neko.vm.Thread;
#end
#end
#if !lime_debug
@:fileXml('tags="haxe,release"')

View File

@@ -1,7 +1,7 @@
package lime.utils;
#if (js && !doc_gen)
typedef ArrayBuffer = js.html.ArrayBuffer;
typedef ArrayBuffer = #if haxe4 js.lib.ArrayBuffer #else js.html.ArrayBuffer #end;
#else
import haxe.io.Bytes;

View File

@@ -1,7 +1,7 @@
package lime.utils;
#if (js && !doc_gen)
typedef ArrayBufferView = js.html.ArrayBufferView;
typedef ArrayBufferView = #if haxe4 js.lib.ArrayBufferView #else js.html.ArrayBufferView #end;
#else #if !lime_debug @:fileXml('tags="haxe,release"')
@:noDebug #end
class ArrayBufferView

View File

@@ -2,15 +2,20 @@ package lime.utils;
import lime.utils.ArrayBufferView;
#if (js && !doc_gen)
#if haxe4
import js.lib.DataView as JSDataView;
#else
import js.html.DataView as JSDataView;
#end
@:forward
abstract DataView(js.html.DataView) from js.html.DataView to js.html.DataView
abstract DataView(JSDataView) from JSDataView to JSDataView
{
public inline function new(buffer:ArrayBuffer, byteOffset:Null<Int> = null, byteLength:Null<Int> = null)
{
if (byteOffset != null && byteLength == null) this = new js.html.DataView(buffer, byteOffset);
else if (byteOffset != null && byteLength != null) this = new js.html.DataView(buffer, byteOffset, byteLength);
if (byteOffset != null && byteLength == null) this = new JSDataView(buffer, byteOffset);
else if (byteOffset != null && byteLength != null) this = new JSDataView(buffer, byteOffset, byteLength);
else
this = new js.html.DataView(buffer);
this = new JSDataView(buffer);
}
#if !no_typedarray_inline

View File

@@ -1,9 +1,14 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Float32Array as JSFloat32Array;
#else
import js.html.Float32Array as JSFloat32Array;
#end
@:forward
@:arrayAccess
abstract Float32Array(js.html.Float32Array) from js.html.Float32Array to js.html.Float32Array
abstract Float32Array(JSFloat32Array) from JSFloat32Array to JSFloat32Array
{
public inline static var BYTES_PER_ELEMENT:Int = 4;
@@ -13,32 +18,32 @@ abstract Float32Array(js.html.Float32Array) from js.html.Float32Array to js.html
{
if (elements != null)
{
this = new js.html.Float32Array(elements);
this = new JSFloat32Array(elements);
}
else if (array != null)
{
this = new js.html.Float32Array(untyped array);
this = new JSFloat32Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Float32Array(untyped (vector));
else if (vector != null) {this = new JSFloat32Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Float32Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSFloat32Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Float32Array(untyped view);
this = new JSFloat32Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Float32Array(buffer, byteoffset);
this = new JSFloat32Array(buffer, byteoffset);
}
else
{
this = new js.html.Float32Array(buffer, byteoffset, len);
this = new JSFloat32Array(buffer, byteoffset, len);
}
}
else
@@ -56,14 +61,14 @@ abstract Float32Array(js.html.Float32Array) from js.html.Float32Array to js.html
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):Float32Array
{
if (byteOffset == null) return new js.html.Float32Array(cast bytes.getData());
if (len == null) return new js.html.Float32Array(cast bytes.getData(), byteOffset);
return new js.html.Float32Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSFloat32Array(cast bytes.getData());
if (len == null) return new JSFloat32Array(cast bytes.getData(), byteOffset);
return new JSFloat32Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUint8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Float64Array as JSFloat64Array;
#else
import js.html.Float64Array as JSFloat64Array;
#end
@:forward
abstract Float64Array(js.html.Float64Array) from js.html.Float64Array to js.html.Float64Array
abstract Float64Array(JSFloat64Array) from JSFloat64Array to JSFloat64Array
{
public inline static var BYTES_PER_ELEMENT:Int = 8;
@@ -12,32 +17,32 @@ abstract Float64Array(js.html.Float64Array) from js.html.Float64Array to js.html
{
if (elements != null)
{
this = new js.html.Float64Array(elements);
this = new JSFloat64Array(elements);
}
else if (array != null)
{
this = new js.html.Float64Array(untyped array);
this = new JSFloat64Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Float64Array(untyped (vector));
else if (vector != null) {this = new JSFloat64Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Float64Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSFloat64Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Float64Array(untyped view);
this = new JSFloat64Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Float64Array(buffer, byteoffset);
this = new JSFloat64Array(buffer, byteoffset);
}
else
{
this = new js.html.Float64Array(buffer, byteoffset, len);
this = new JSFloat64Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract Float64Array(js.html.Float64Array) from js.html.Float64Array to js.html
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):Float64Array
{
if (byteOffset == null) return new js.html.Float64Array(cast bytes.getData());
if (len == null) return new js.html.Float64Array(cast bytes.getData(), byteOffset);
return new js.html.Float64Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSFloat64Array(cast bytes.getData());
if (len == null) return new JSFloat64Array(cast bytes.getData(), byteOffset);
return new JSFloat64Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUint8Array(this.buffer));
}
function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Int16Array as JSInt16Array;
#else
import js.html.Int16Array as JSInt16Array;
#end
@:forward
abstract Int16Array(js.html.Int16Array) from js.html.Int16Array to js.html.Int16Array
abstract Int16Array(JSInt16Array) from JSInt16Array to JSInt16Array
{
public inline static var BYTES_PER_ELEMENT:Int = 2;
@@ -12,32 +17,32 @@ abstract Int16Array(js.html.Int16Array) from js.html.Int16Array to js.html.Int16
{
if (elements != null)
{
this = new js.html.Int16Array(elements);
this = new JSInt16Array(elements);
}
else if (array != null)
{
this = new js.html.Int16Array(untyped array);
this = new JSInt16Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Int16Array(untyped (vector));
else if (vector != null) {this = new JSInt16Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Int16Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSInt16Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Int16Array(untyped view);
this = new JSInt16Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Int16Array(buffer, byteoffset);
this = new JSInt16Array(buffer, byteoffset);
}
else
{
this = new js.html.Int16Array(buffer, byteoffset, len);
this = new JSInt16Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract Int16Array(js.html.Int16Array) from js.html.Int16Array to js.html.Int16
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):Int16Array
{
if (byteOffset == null) return new js.html.Int16Array(cast bytes.getData());
if (len == null) return new js.html.Int16Array(cast bytes.getData(), byteOffset);
return new js.html.Int16Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSInt16Array(cast bytes.getData());
if (len == null) return new JSInt16Array(cast bytes.getData(), byteOffset);
return new JSInt16Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUint8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Int32Array as JSInt32Array;
#else
import js.html.Int32Array as JSInt32Array;
#end
@:forward
abstract Int32Array(js.html.Int32Array) from js.html.Int32Array to js.html.Int32Array
abstract Int32Array(JSInt32Array) from JSInt32Array to JSInt32Array
{
public inline static var BYTES_PER_ELEMENT:Int = 4;
@@ -12,32 +17,32 @@ abstract Int32Array(js.html.Int32Array) from js.html.Int32Array to js.html.Int32
{
if (elements != null)
{
this = new js.html.Int32Array(elements);
this = new JSInt32Array(elements);
}
else if (array != null)
{
this = new js.html.Int32Array(untyped array);
this = new JSInt32Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Int32Array(untyped (vector));
else if (vector != null) {this = new JSInt32Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Int32Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSInt32Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Int32Array(untyped view);
this = new JSInt32Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Int32Array(buffer, byteoffset);
this = new JSInt32Array(buffer, byteoffset);
}
else
{
this = new js.html.Int32Array(buffer, byteoffset, len);
this = new JSInt32Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract Int32Array(js.html.Int32Array) from js.html.Int32Array to js.html.Int32
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):Int32Array
{
if (byteOffset == null) return new js.html.Int32Array(cast bytes.getData());
if (len == null) return new js.html.Int32Array(cast bytes.getData(), byteOffset);
return new js.html.Int32Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSInt32Array(cast bytes.getData());
if (len == null) return new JSInt32Array(cast bytes.getData(), byteOffset);
return new JSInt32Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUint8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Int8Array as JSInt8Array;
#else
import js.html.Int8Array as JSInt8Array;
#end
@:forward
abstract Int8Array(js.html.Int8Array) from js.html.Int8Array to js.html.Int8Array
abstract Int8Array(JSInt8Array) from JSInt8Array to JSInt8Array
{
public inline static var BYTES_PER_ELEMENT:Int = 1;
@@ -12,32 +17,32 @@ abstract Int8Array(js.html.Int8Array) from js.html.Int8Array to js.html.Int8Arra
{
if (elements != null)
{
this = new js.html.Int8Array(elements);
this = new JSInt8Array(elements);
}
else if (array != null)
{
this = new js.html.Int8Array(untyped array);
this = new JSInt8Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Int8Array(untyped (vector));
else if (vector != null) {this = new JSInt8Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Int8Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSInt8Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Int8Array(untyped view);
this = new JSInt8Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Int8Array(buffer, byteoffset);
this = new JSInt8Array(buffer, byteoffset);
}
else
{
this = new js.html.Int8Array(buffer, byteoffset, len);
this = new JSInt8Array(buffer, byteoffset, len);
}
}
else
@@ -55,12 +60,12 @@ abstract Int8Array(js.html.Int8Array) from js.html.Int8Array to js.html.Int8Arra
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):Int8Array
{
return new js.html.Int8Array(cast bytes.getData(), byteOffset, len);
return new JSInt8Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUint8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Uint16Array as JSUInt16Array;
#else
import js.html.Uint16Array as JSUInt16Array;
#end
@:forward
abstract UInt16Array(js.html.Uint16Array) from js.html.Uint16Array to js.html.Uint16Array
abstract UInt16Array(JSUInt16Array) from JSUInt16Array to JSUInt16Array
{
public inline static var BYTES_PER_ELEMENT:Int = 2;
@@ -12,32 +17,32 @@ abstract UInt16Array(js.html.Uint16Array) from js.html.Uint16Array to js.html.Ui
{
if (elements != null)
{
this = new js.html.Uint16Array(elements);
this = new JSUInt16Array(elements);
}
else if (array != null)
{
this = new js.html.Uint16Array(untyped array);
this = new JSUInt16Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Uint16Array(untyped (vector));
else if (vector != null) {this = new JSUInt16Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Uint16Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSUInt16Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Uint16Array(untyped view);
this = new JSUInt16Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Uint16Array(buffer, byteoffset);
this = new JSUInt16Array(buffer, byteoffset);
}
else
{
this = new js.html.Uint16Array(buffer, byteoffset, len);
this = new JSUInt16Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract UInt16Array(js.html.Uint16Array) from js.html.Uint16Array to js.html.Ui
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):UInt16Array
{
if (byteOffset == null) return new js.html.Uint16Array(cast bytes.getData());
if (len == null) return new js.html.Uint16Array(cast bytes.getData(), byteOffset);
return new js.html.Uint16Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSUInt16Array(cast bytes.getData());
if (len == null) return new JSUInt16Array(cast bytes.getData(), byteOffset);
return new JSUInt16Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUInt8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Uint32Array as JSUInt32Array;
#else
import js.html.Uint32Array as JSUInt32Array;
#end
@:forward
abstract UInt32Array(js.html.Uint32Array) from js.html.Uint32Array to js.html.Uint32Array
abstract UInt32Array(JSUInt32Array) from JSUInt32Array to JSUInt32Array
{
public inline static var BYTES_PER_ELEMENT:Int = 4;
@@ -12,32 +17,32 @@ abstract UInt32Array(js.html.Uint32Array) from js.html.Uint32Array to js.html.Ui
{
if (elements != null)
{
this = new js.html.Uint32Array(elements);
this = new JSUInt32Array(elements);
}
else if (array != null)
{
this = new js.html.Uint32Array(untyped array);
this = new JSUInt32Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Uint32Array(untyped (vector));
else if (vector != null) {this = new JSUInt32Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Uint32Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSUInt32Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Uint32Array(untyped view);
this = new JSUInt32Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Uint32Array(buffer, byteoffset);
this = new JSUInt32Array(buffer, byteoffset);
}
else
{
this = new js.html.Uint32Array(buffer, byteoffset, len);
this = new JSUInt32Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract UInt32Array(js.html.Uint32Array) from js.html.Uint32Array to js.html.Ui
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):UInt32Array
{
if (byteOffset == null) return new js.html.Uint32Array(cast bytes.getData());
if (len == null) return new js.html.Uint32Array(cast bytes.getData(), byteOffset);
return new js.html.Uint32Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSUInt32Array(cast bytes.getData());
if (len == null) return new JSUInt32Array(cast bytes.getData(), byteOffset);
return new JSUInt32Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUInt8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Uint8Array as JSUInt8Array;
#else
import js.html.Uint8Array as JSUInt8Array;
#end
@:forward
abstract UInt8Array(js.html.Uint8Array) from js.html.Uint8Array to js.html.Uint8Array
abstract UInt8Array(JSUInt8Array) from JSUInt8Array to JSUInt8Array
{
public inline static var BYTES_PER_ELEMENT:Int = 1;
@@ -12,32 +17,32 @@ abstract UInt8Array(js.html.Uint8Array) from js.html.Uint8Array to js.html.Uint8
{
if (elements != null)
{
this = new js.html.Uint8Array(elements);
this = new JSUInt8Array(elements);
}
else if (array != null)
{
this = new js.html.Uint8Array(untyped array);
this = new JSUInt8Array(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Uint8Array(untyped (vector));
else if (vector != null) {this = new JSUInt8Array(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Uint8Array(untyped untyped (vector).__array);
else if (vector != null) {this = new JSUInt8Array(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Uint8Array(untyped view);
this = new JSUInt8Array(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Uint8Array(buffer, byteoffset);
this = new JSUInt8Array(buffer, byteoffset);
}
else
{
this = new js.html.Uint8Array(buffer, byteoffset, len);
this = new JSUInt8Array(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract UInt8Array(js.html.Uint8Array) from js.html.Uint8Array to js.html.Uint8
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int, ?len:Int):UInt8Array
{
if (byteOffset == null) return new js.html.Uint8Array(cast bytes.getData());
if (len == null) return new js.html.Uint8Array(cast bytes.getData(), byteOffset);
return new js.html.Uint8Array(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSUInt8Array(cast bytes.getData());
if (len == null) return new JSUInt8Array(cast bytes.getData(), byteOffset);
return new JSUInt8Array(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUInt8Array(this.buffer));
}
inline function toString()

View File

@@ -1,8 +1,13 @@
package lime.utils;
#if (js && !doc_gen)
#if haxe4
import js.lib.Uint8ClampedArray as JSUInt8ClampedArray;
#else
import js.html.Uint8ClampedArray as JSUInt8ClampedArray;
#end
@:forward
abstract UInt8ClampedArray(js.html.Uint8ClampedArray) from js.html.Uint8ClampedArray to js.html.Uint8ClampedArray
abstract UInt8ClampedArray(JSUInt8ClampedArray) from JSUInt8ClampedArray to JSUInt8ClampedArray
{
public inline static var BYTES_PER_ELEMENT:Int = 1;
@@ -12,32 +17,32 @@ abstract UInt8ClampedArray(js.html.Uint8ClampedArray) from js.html.Uint8ClampedA
{
if (elements != null)
{
this = new js.html.Uint8ClampedArray(elements);
this = new JSUInt8ClampedArray(elements);
}
else if (array != null)
{
this = new js.html.Uint8ClampedArray(untyped array);
this = new JSUInt8ClampedArray(untyped array);
#if (openfl && commonjs)
}
else if (vector != null) {this = new js.html.Uint8ClampedArray(untyped (vector));
else if (vector != null) {this = new JSUInt8ClampedArray(untyped (vector));
#elseif openfl
}
else if (vector != null) {this = new js.html.Uint8ClampedArray(untyped untyped (vector).__array);
else if (vector != null) {this = new JSUInt8ClampedArray(untyped untyped (vector).__array);
#end
}
else if (view != null)
{
this = new js.html.Uint8ClampedArray(untyped view);
this = new JSUInt8ClampedArray(untyped view);
}
else if (buffer != null)
{
if (len == null)
{
this = new js.html.Uint8ClampedArray(buffer, byteoffset);
this = new JSUInt8ClampedArray(buffer, byteoffset);
}
else
{
this = new js.html.Uint8ClampedArray(buffer, byteoffset, len);
this = new JSUInt8ClampedArray(buffer, byteoffset, len);
}
}
else
@@ -55,14 +60,14 @@ abstract UInt8ClampedArray(js.html.Uint8ClampedArray) from js.html.Uint8ClampedA
// non spec haxe conversions
inline public static function fromBytes(bytes:haxe.io.Bytes, ?byteOffset:Int = 0, ?len:Int):UInt8ClampedArray
{
if (byteOffset == null) return new js.html.Uint8ClampedArray(cast bytes.getData());
if (len == null) return new js.html.Uint8ClampedArray(cast bytes.getData(), byteOffset);
return new js.html.Uint8ClampedArray(cast bytes.getData(), byteOffset, len);
if (byteOffset == null) return new JSUInt8ClampedArray(cast bytes.getData());
if (len == null) return new JSUInt8ClampedArray(cast bytes.getData(), byteOffset);
return new JSUInt8ClampedArray(cast bytes.getData(), byteOffset, len);
}
inline public function toBytes():haxe.io.Bytes
{
return @:privateAccess new haxe.io.Bytes(cast new js.html.Uint8Array(this.buffer));
return @:privateAccess new haxe.io.Bytes(cast new JSUInt8Array(this.buffer));
}
inline function toString()

View File

@@ -18,8 +18,12 @@ import lime.tools.PlatformTarget;
import sys.io.File;
import sys.FileSystem;
#if neko
#if haxe4
import sys.thread.Thread;
#else
import neko.vm.Thread;
#end
#end
class FlashPlatform extends PlatformTarget
{