You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/07/11 05:18:55 UTC

[royale-asjs] branch develop updated: add a custom string coercion support for XMLList instances (instead of Language.string in this case, to avoid implicit valueOf() calls)

This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 03f34f265a add a custom string coercion support for XMLList instances (instead of Language.string in this case, to avoid implicit valueOf() calls)
03f34f265a is described below

commit 03f34f265aadcd281dc85c4dab2ded74d72fc263
Author: greg-dove <gr...@gmail.com>
AuthorDate: Mon Jul 11 17:18:28 2022 +1200

    add a custom string coercion support for XMLList instances (instead of Language.string in this case, to avoid implicit valueOf() calls)
---
 frameworks/projects/XML/src/main/royale/XMLList.as | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/frameworks/projects/XML/src/main/royale/XMLList.as b/frameworks/projects/XML/src/main/royale/XMLList.as
index cdd907ea33..324f53d054 100644
--- a/frameworks/projects/XML/src/main/royale/XMLList.as
+++ b/frameworks/projects/XML/src/main/royale/XMLList.as
@@ -63,6 +63,16 @@ package
 			if (typeof other == 'boolean') other = ('' + other);//force a string comparison
 			return (list as Object) == other;
 		}
+
+		/**
+		 * Compiler-only method to stringification, which avoids valueOf calls.
+		 *
+		 * @private
+		 * @royalesuppressexport
+		 */
+		public static function coerce_string(list:XMLList):String{
+			return list !== null ? String(list) : null;
+		}
 		
 		public function XMLList(expression:Object = null)
 		{