You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/04/09 09:37:47 UTC

[royale-asjs] branch develop updated: Add conditonalBind.

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 <yi...@hotmail.com>
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.


Re: [royale-asjs] branch develop updated: Add conditonalBind.

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Without digging deeper, my first impression is that this isn't complete.  Doesn't Language.closure() add a third param so two calls return the same binding?  I think that should happen here too.

-Alex

On 4/9/20, 2:37 AM, "yishayw@apache.org" <yi...@apache.org> wrote:

    This is an automated email from the ASF dual-hosted git repository.
    
    yishayw pushed a commit to branch develop
    in repository https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&amp;data=02%7C01%7Caharui%40adobe.com%7C437694cdfe744e48882108d7dc69aa0e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637220218691486746&amp;sdata=x%2Bx9XrN20tEqtcDoTtlBXkvbjqK%2BS3aU2UpCObp%2FFG4%3D&amp;reserved=0
    
    
    The following commit(s) were added to refs/heads/develop by this push:
         new 5d8a4aa  Add conditonalBind.
         new 8f9e696  Merge branch 'develop' of https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs&amp;data=02%7C01%7Caharui%40adobe.com%7C437694cdfe744e48882108d7dc69aa0e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637220218691496741&amp;sdata=hiYc8P73bDlru2kp%2FLeHfjGOZW5VExZcH3iClXdYUvo%3D&amp;reserved=0 into develop
    5d8a4aa is described below
    
    commit 5d8a4aabf763c4b16462fdfd0392ceffdc399a44
    Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
    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.