From d613d7c125a2990275e4cc0ab5cb9f3a4774bbc7 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Fri, 10 Nov 2023 10:37:11 -0800 Subject: [PATCH] RenderUtil: put back a comment about string profiles --- src/starling/utils/RenderUtil.hx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/starling/utils/RenderUtil.hx b/src/starling/utils/RenderUtil.hx index 59e4e440..305c9135 100644 --- a/src/starling/utils/RenderUtil.hx +++ b/src/starling/utils/RenderUtil.hx @@ -236,7 +236,12 @@ class RenderUtil else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, Int)) profiles = [cast profile]; else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, String)) + { + // ensure that the Haxe compiler knows it's a String instead of Dynamic + // it's not required on all targets, but some may throw exceptions with Dynamic + // for instance, on HashLink, it throws 'Can't cast String to i32' profiles = [Std.string(profile)]; + } else if (#if (haxe_ver < 4.2) Std.is #else Std.isOfType #end(profile, Array)) { var dynProfiles:Array = cast(profile, Array); @@ -249,6 +254,9 @@ class RenderUtil } else { + // ensure that the Haxe compiler knows it's a String instead of Dynamic + // it's not required on all targets, but some may throw exceptions with Dynamic + // for instance, on HashLink, it throws 'Can't cast String to i32' profiles.push(Std.string(prof)); } }