Improve lime.tools.Platform type safety.
We shouldn't have to cast it every time!
This commit is contained in:
@@ -87,7 +87,7 @@ class HXProject extends Script
|
||||
var outputFile = args[1];
|
||||
|
||||
HXProject._command = inputData.command;
|
||||
HXProject._target = cast inputData.target;
|
||||
HXProject._target = inputData.target;
|
||||
HXProject._debug = inputData.debug;
|
||||
HXProject._targetFlags = inputData.targetFlags;
|
||||
HXProject._templatePaths = inputData.templatePaths;
|
||||
@@ -742,7 +742,7 @@ class HXProject extends Script
|
||||
defines.set("uwp", "1");
|
||||
defines.set("winjs", "1");
|
||||
}
|
||||
else if (platformType == DESKTOP && target != cast System.hostPlatform)
|
||||
else if (platformType == DESKTOP && target != System.hostPlatform)
|
||||
{
|
||||
defines.set("native", "1");
|
||||
|
||||
@@ -834,7 +834,7 @@ class HXProject extends Script
|
||||
{
|
||||
if (_target == null)
|
||||
{
|
||||
_target = cast System.hostPlatform;
|
||||
_target = System.hostPlatform;
|
||||
}
|
||||
|
||||
if (_targetFlags == null)
|
||||
@@ -1040,7 +1040,7 @@ class HXProject extends Script
|
||||
// Getters & Setters
|
||||
private function get_host():Platform
|
||||
{
|
||||
return cast System.hostPlatform;
|
||||
return System.hostPlatform;
|
||||
}
|
||||
|
||||
private function get_templateContext():Dynamic
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package lime.tools;
|
||||
|
||||
#if (haxe_ver >= 4.0) enum #else @:enum #end abstract Platform(String)
|
||||
#if (haxe_ver >= 4.0) enum #else @:enum #end abstract Platform(String) from hxp.HostPlatform
|
||||
{
|
||||
var AIR = "air";
|
||||
var ANDROID = "android";
|
||||
@@ -24,4 +24,10 @@ package lime.tools;
|
||||
var EMSCRIPTEN = "emscripten";
|
||||
var TVOS = "tvos";
|
||||
var CUSTOM = null;
|
||||
|
||||
@:op(A == B) @:commutative
|
||||
private inline function equalsHostPlatform(hostPlatform:hxp.HostPlatform):Bool
|
||||
{
|
||||
return this == hostPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,31 +231,31 @@ class CommandLineTools
|
||||
switch (targetName)
|
||||
{
|
||||
case "cpp":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cpp", "");
|
||||
|
||||
case "neko":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("neko", "");
|
||||
|
||||
case "hl", "hashlink":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("hl", "");
|
||||
|
||||
case "cppia":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cppia", "");
|
||||
|
||||
case "java":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("java", "");
|
||||
|
||||
case "nodejs":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("nodejs", "");
|
||||
|
||||
case "cs":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cs", "");
|
||||
|
||||
case "iphone", "iphoneos":
|
||||
@@ -1511,31 +1511,31 @@ class CommandLineTools
|
||||
switch (targetName)
|
||||
{
|
||||
case "cpp":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cpp", "");
|
||||
|
||||
case "neko":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("neko", "");
|
||||
|
||||
case "hl", "hashlink":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("hl", "");
|
||||
|
||||
case "cppia":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cppia", "");
|
||||
|
||||
case "java":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("java", "");
|
||||
|
||||
case "nodejs":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("nodejs", "");
|
||||
|
||||
case "cs":
|
||||
target = cast System.hostPlatform;
|
||||
target = System.hostPlatform;
|
||||
targetFlags.set("cs", "");
|
||||
|
||||
case "iphone", "iphoneos":
|
||||
|
||||
Reference in New Issue
Block a user