Fix Std.is() deprecation warnings with Haxe 4.2 (#1412)

This commit is contained in:
Jens Fischer
2020-07-18 09:24:01 +02:00
committed by GitHub
parent 16b81d617e
commit eac0c93b2c
9 changed files with 20 additions and 20 deletions

View File

@@ -81,7 +81,7 @@ class HTML5HTTPRequest
{ {
if (query.length > 0) query += "&"; if (query.length > 0) query += "&";
var value:Dynamic = parent.formData.get(key); var value:Dynamic = parent.formData.get(key);
if (key.indexOf("[]") > -1 && Std.is(value, Array)) if (key.indexOf("[]") > -1 && (value is Array))
{ {
var arrayValue:String = Lambda.map(value, function(v:String) var arrayValue:String = Lambda.map(value, function(v:String)
{ {

View File

@@ -114,7 +114,7 @@ class HTML5Window
parent.id = windowID++; parent.id = windowID++;
if (Std.is(element, CanvasElement)) if ((element is CanvasElement))
{ {
canvas = cast element; canvas = cast element;
} }

View File

@@ -201,11 +201,11 @@ class ImageBuffer
@:noCompletion private function set_src(value:Dynamic):Dynamic @:noCompletion private function set_src(value:Dynamic):Dynamic
{ {
#if (js && html5) #if (js && html5)
if (Std.is(value, HTMLImage)) if ((value is HTMLImage))
{ {
__srcImage = cast value; __srcImage = cast value;
} }
else if (Std.is(value, CanvasElement)) else if ((value is CanvasElement))
{ {
__srcCanvas = cast value; __srcCanvas = cast value;
__srcContext = cast __srcCanvas.getContext("2d"); __srcContext = cast __srcCanvas.getContext("2d");

View File

@@ -84,7 +84,7 @@ class System
{ {
var htmlElement:Element = null; var htmlElement:Element = null;
if (Std.is(element, String)) if ((element is String))
{ {
htmlElement = cast Browser.document.getElementById(element); htmlElement = cast Browser.document.getElementById(element);
} }
@@ -115,7 +115,7 @@ class System
if (config == null) config = {}; if (config == null) config = {};
if (Reflect.hasField(config, "background") && Std.is(config.background, String)) if (Reflect.hasField(config, "background") && (config.background is String))
{ {
var background = StringTools.replace(Std.string(config.background), "#", ""); var background = StringTools.replace(Std.string(config.background), "#", "");

View File

@@ -49,7 +49,7 @@ class AssetHelper
{ {
File.saveBytes(destination, Base64.decode(asset.data)); File.saveBytes(destination, Base64.decode(asset.data));
} }
else if (Std.is(asset.data, HaxeBytes)) else if ((asset.data is HaxeBytes))
{ {
File.saveBytes(destination, cast asset.data); File.saveBytes(destination, cast asset.data);
} }
@@ -86,7 +86,7 @@ class AssetHelper
{ {
File.saveBytes(destination, Base64.decode(asset.data)); File.saveBytes(destination, Base64.decode(asset.data));
} }
else if (Std.is(asset.data, HaxeBytes)) else if ((asset.data is HaxeBytes))
{ {
File.saveBytes(destination, cast asset.data); File.saveBytes(destination, cast asset.data);
} }

View File

@@ -499,7 +499,7 @@ class FlashHelper
{ {
bytes = Base64.decode(inAsset.data); bytes = Base64.decode(inAsset.data);
} }
else if (Std.is(inAsset.data, Bytes)) else if ((inAsset.data is Bytes))
{ {
bytes = cast inAsset.data; bytes = cast inAsset.data;
} }
@@ -807,7 +807,7 @@ class FlashHelper
{ {
File.saveBytes(sourcePath, Base64.decode(asset.data)); File.saveBytes(sourcePath, Base64.decode(asset.data));
} }
else if (Std.is(asset.data, Bytes)) else if ((asset.data is Bytes))
{ {
File.saveBytes(sourcePath, asset.data); File.saveBytes(sourcePath, asset.data);
} }

View File

@@ -24,7 +24,7 @@ abstract ArrayBuffer(Bytes) from Bytes to Bytes
public static inline function isView(arg:Dynamic):Bool public static inline function isView(arg:Dynamic):Bool
{ {
return (arg != null && Std.is(arg, ArrayBufferView)); return (arg != null && (arg is ArrayBufferView));
} }
public inline function slice(begin:Int, end:Null<Int> = null) public inline function slice(begin:Int, end:Null<Int> = null)

View File

@@ -62,12 +62,12 @@ class AssetCache
font.set(id, asset); font.set(id, asset);
case IMAGE: case IMAGE:
if (!Std.is(asset, Image)) throw "Cannot cache non-Image asset: " + asset + " as Image"; if (!(asset is Image)) throw "Cannot cache non-Image asset: " + asset + " as Image";
image.set(id, asset); image.set(id, asset);
case SOUND, MUSIC: case SOUND, MUSIC:
if (!Std.is(asset, AudioBuffer)) throw "Cannot cache non-AudioBuffer asset: " + asset + " as AudioBuffer"; if (!(asset is AudioBuffer)) throw "Cannot cache non-AudioBuffer asset: " + asset + " as AudioBuffer";
audio.set(id, asset); audio.set(id, asset);

View File

@@ -1860,15 +1860,15 @@ class CommandLineTools
if (Reflect.hasField(fieldValue, attribute)) if (Reflect.hasField(fieldValue, attribute))
{ {
if (Std.is(Reflect.field(fieldValue, attribute), String)) if ((Reflect.field(fieldValue, attribute) is String))
{ {
Reflect.setField(fieldValue, attribute, projectDefines.get(key)); Reflect.setField(fieldValue, attribute, projectDefines.get(key));
} }
else if (Std.is(Reflect.field(fieldValue, attribute), Float)) else if ((Reflect.field(fieldValue, attribute) is Float))
{ {
Reflect.setField(fieldValue, attribute, Std.parseFloat(projectDefines.get(key))); Reflect.setField(fieldValue, attribute, Std.parseFloat(projectDefines.get(key)));
} }
else if (Std.is(Reflect.field(fieldValue, attribute), Bool)) else if ((Reflect.field(fieldValue, attribute) is Bool))
{ {
Reflect.setField(fieldValue, attribute, (projectDefines.get(key).toLowerCase() == "true" Reflect.setField(fieldValue, attribute, (projectDefines.get(key).toLowerCase() == "true"
|| projectDefines.get(key) == "1")); || projectDefines.get(key) == "1"));
@@ -2121,19 +2121,19 @@ class CommandLineTools
{ {
var propertyReference = Reflect.field(fieldReference, property); var propertyReference = Reflect.field(fieldReference, property);
if (Std.is(propertyReference, Bool)) if ((propertyReference is Bool))
{ {
Reflect.setField(fieldReference, property, argValue == "true"); Reflect.setField(fieldReference, property, argValue == "true");
} }
else if (Std.is(propertyReference, Int)) else if ((propertyReference is Int))
{ {
Reflect.setField(fieldReference, property, Std.parseInt(argValue)); Reflect.setField(fieldReference, property, Std.parseInt(argValue));
} }
else if (Std.is(propertyReference, Float)) else if ((propertyReference is Float))
{ {
Reflect.setField(fieldReference, property, Std.parseFloat(argValue)); Reflect.setField(fieldReference, property, Std.parseFloat(argValue));
} }
else if (Std.is(propertyReference, String)) else if ((propertyReference is String))
{ {
Reflect.setField(fieldReference, property, argValue); Reflect.setField(fieldReference, property, argValue);
} }