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

yishayw 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 5d8a4aa  Add conditonalBind.
     new 8f9e696  Merge branch 'develop' of 
https://gitbox.apache.org/repos/asf/royale-asjs into develop
5d8a4aa is described below

commit 5d8a4aabf763c4b16462fdfd0392ceffdc399a44
Author: DESKTOP-RH4S838\Yishay <[email protected]>
AuthorDate: Thu Apr 9 12:36:00 2020 +0300

    Add conditonalBind.
    
    Needed for fix to compiler bug #143
---
 .../src/main/royale/org/apache/royale/utils/Language.as   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
 
b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
index 086d772..1663954 100644
--- 
a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
+++ 
b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
@@ -271,6 +271,21 @@ package org.apache.royale.utils
         }
         
         /**
+         * Checks for null before returning a closure
+         *
+         * @param fn The method on the instance.
+         * @param object The instance.
+         * @return The closure, or null.
+         *
+         */
+        static public function conditionalBind(fn:Function, 
object:Object):Function
+        {
+            if (fn == null)
+                return null;
+            return goog.bind(fn, object);
+        }
+        
+        /**
          * caches closures and returns the one closure
          *
          * @param fn The method on the instance.

Reply via email to