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];
|
var outputFile = args[1];
|
||||||
|
|
||||||
HXProject._command = inputData.command;
|
HXProject._command = inputData.command;
|
||||||
HXProject._target = cast inputData.target;
|
HXProject._target = inputData.target;
|
||||||
HXProject._debug = inputData.debug;
|
HXProject._debug = inputData.debug;
|
||||||
HXProject._targetFlags = inputData.targetFlags;
|
HXProject._targetFlags = inputData.targetFlags;
|
||||||
HXProject._templatePaths = inputData.templatePaths;
|
HXProject._templatePaths = inputData.templatePaths;
|
||||||
@@ -742,7 +742,7 @@ class HXProject extends Script
|
|||||||
defines.set("uwp", "1");
|
defines.set("uwp", "1");
|
||||||
defines.set("winjs", "1");
|
defines.set("winjs", "1");
|
||||||
}
|
}
|
||||||
else if (platformType == DESKTOP && target != cast System.hostPlatform)
|
else if (platformType == DESKTOP && target != System.hostPlatform)
|
||||||
{
|
{
|
||||||
defines.set("native", "1");
|
defines.set("native", "1");
|
||||||
|
|
||||||
@@ -834,7 +834,7 @@ class HXProject extends Script
|
|||||||
{
|
{
|
||||||
if (_target == null)
|
if (_target == null)
|
||||||
{
|
{
|
||||||
_target = cast System.hostPlatform;
|
_target = System.hostPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_targetFlags == null)
|
if (_targetFlags == null)
|
||||||
@@ -1040,7 +1040,7 @@ class HXProject extends Script
|
|||||||
// Getters & Setters
|
// Getters & Setters
|
||||||
private function get_host():Platform
|
private function get_host():Platform
|
||||||
{
|
{
|
||||||
return cast System.hostPlatform;
|
return System.hostPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_templateContext():Dynamic
|
private function get_templateContext():Dynamic
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package lime.tools;
|
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 AIR = "air";
|
||||||
var ANDROID = "android";
|
var ANDROID = "android";
|
||||||
@@ -24,4 +24,10 @@ package lime.tools;
|
|||||||
var EMSCRIPTEN = "emscripten";
|
var EMSCRIPTEN = "emscripten";
|
||||||
var TVOS = "tvos";
|
var TVOS = "tvos";
|
||||||
var CUSTOM = null;
|
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)
|
switch (targetName)
|
||||||
{
|
{
|
||||||
case "cpp":
|
case "cpp":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cpp", "");
|
targetFlags.set("cpp", "");
|
||||||
|
|
||||||
case "neko":
|
case "neko":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("neko", "");
|
targetFlags.set("neko", "");
|
||||||
|
|
||||||
case "hl", "hashlink":
|
case "hl", "hashlink":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("hl", "");
|
targetFlags.set("hl", "");
|
||||||
|
|
||||||
case "cppia":
|
case "cppia":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cppia", "");
|
targetFlags.set("cppia", "");
|
||||||
|
|
||||||
case "java":
|
case "java":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("java", "");
|
targetFlags.set("java", "");
|
||||||
|
|
||||||
case "nodejs":
|
case "nodejs":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("nodejs", "");
|
targetFlags.set("nodejs", "");
|
||||||
|
|
||||||
case "cs":
|
case "cs":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cs", "");
|
targetFlags.set("cs", "");
|
||||||
|
|
||||||
case "iphone", "iphoneos":
|
case "iphone", "iphoneos":
|
||||||
@@ -1511,31 +1511,31 @@ class CommandLineTools
|
|||||||
switch (targetName)
|
switch (targetName)
|
||||||
{
|
{
|
||||||
case "cpp":
|
case "cpp":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cpp", "");
|
targetFlags.set("cpp", "");
|
||||||
|
|
||||||
case "neko":
|
case "neko":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("neko", "");
|
targetFlags.set("neko", "");
|
||||||
|
|
||||||
case "hl", "hashlink":
|
case "hl", "hashlink":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("hl", "");
|
targetFlags.set("hl", "");
|
||||||
|
|
||||||
case "cppia":
|
case "cppia":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cppia", "");
|
targetFlags.set("cppia", "");
|
||||||
|
|
||||||
case "java":
|
case "java":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("java", "");
|
targetFlags.set("java", "");
|
||||||
|
|
||||||
case "nodejs":
|
case "nodejs":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("nodejs", "");
|
targetFlags.set("nodejs", "");
|
||||||
|
|
||||||
case "cs":
|
case "cs":
|
||||||
target = cast System.hostPlatform;
|
target = System.hostPlatform;
|
||||||
targetFlags.set("cs", "");
|
targetFlags.set("cs", "");
|
||||||
|
|
||||||
case "iphone", "iphoneos":
|
case "iphone", "iphoneos":
|
||||||
|
|||||||
Reference in New Issue
Block a user