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 2020/10/07 21:07:42 UTC

[royale-asjs] branch develop updated (93a84df -> 9796a22)

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

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


    from 93a84df  Adding RenderetExistenceEvent
     new 8f4b8e1  Ensure that native emulations reference singleton data for each type in case they are added to ExtraData multiple times. (transient values such as class alias settings will now survive this)
     new 26cb150  Make constructorMethod consistent between swf and js.
     new 070f64d  Updated tests for recent Reflection improvements
     new 9796a22  Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/royale/reflection/MethodDefinition.as   |  4 +++
 .../org/apache/royale/reflection/TypeDefinition.as |  6 +++++
 .../apache/royale/reflection/nativejs/AS3Array.as  |  5 ++--
 .../royale/reflection/nativejs/AS3Boolean.as       |  5 ++--
 .../apache/royale/reflection/nativejs/AS3Number.as |  4 ++-
 .../apache/royale/reflection/nativejs/AS3Object.as |  5 ++--
 .../apache/royale/reflection/nativejs/AS3String.as |  5 ++--
 .../apache/royale/reflection/nativejs/AS3Vector.as |  9 ++++++-
 .../apache/royale/reflection/nativejs/AS3int.as    |  4 ++-
 .../apache/royale/reflection/nativejs/AS3uint.as   |  4 ++-
 .../reflection/ReflectionTesterTest.as             | 31 ++++++++++++++++++++--
 .../reflection/ReflectionTesterTestAlias.as        | 23 +++++++++++++++-
 .../reflection/ReflectionTesterTestDynamic.as      | 11 +++-----
 .../reflection/ReflectionTesterTestUseCache.as     |  1 +
 .../flexUnitTests/reflection/support/TestClass1.as |  4 +--
 15 files changed, 97 insertions(+), 24 deletions(-)


[royale-asjs] 01/04: Ensure that native emulations reference singleton data for each type in case they are added to ExtraData multiple times. (transient values such as class alias settings will now survive this)

Posted by gr...@apache.org.
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

commit 8f4b8e11b5547a5036be12ee748f3b057dfd8b6a
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Oct 8 10:04:35 2020 +1300

    Ensure that native emulations reference singleton data for each type in case they are added to ExtraData multiple times.
    (transient values such as class alias settings will now survive this)
---
 .../royale/org/apache/royale/reflection/nativejs/AS3Array.as     | 5 +++--
 .../royale/org/apache/royale/reflection/nativejs/AS3Boolean.as   | 5 +++--
 .../royale/org/apache/royale/reflection/nativejs/AS3Number.as    | 4 +++-
 .../royale/org/apache/royale/reflection/nativejs/AS3Object.as    | 5 +++--
 .../royale/org/apache/royale/reflection/nativejs/AS3String.as    | 5 +++--
 .../royale/org/apache/royale/reflection/nativejs/AS3Vector.as    | 9 ++++++++-
 .../main/royale/org/apache/royale/reflection/nativejs/AS3int.as  | 4 +++-
 .../main/royale/org/apache/royale/reflection/nativejs/AS3uint.as | 4 +++-
 8 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Array.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Array.as
index f4563ce..b661588 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Array.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Array.as
@@ -23,6 +23,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3Array():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = Array;
         ret['name'] = 'Array';
@@ -44,8 +45,8 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-        
+        singleton = ret;
         return ret;
     }
-    
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Boolean.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Boolean.as
index 4a3da17..025658b 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Boolean.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Boolean.as
@@ -24,6 +24,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3Boolean():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = Boolean;
         ret['name'] = 'Boolean';
@@ -40,9 +41,9 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-    
+        singleton = ret;
         return ret;
     
     }
-    
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Number.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Number.as
index b1612eb..0c7e58a 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Number.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Number.as
@@ -23,6 +23,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3Number():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = Number;
         ret['name'] = 'Number';
@@ -57,9 +58,10 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-    
+        singleton = ret;
         return ret;
     
     }
     
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Object.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Object.as
index 12b7e22..c9b6009 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Object.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Object.as
@@ -23,6 +23,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3Object():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = Object;
         ret['name'] = 'Object';
@@ -44,8 +45,8 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-        
+        singleton = ret;
         return ret;
     }
-    
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3String.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3String.as
index 91dbacb..6022701 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3String.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3String.as
@@ -23,6 +23,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3String():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = String;
         ret['name'] = 'String';
@@ -44,9 +45,9 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-        
+        singleton = ret;
         return ret;
     
     }
-    
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Vector.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Vector.as
index 5fe7d96..86c7505 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Vector.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3Vector.as
@@ -27,6 +27,11 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3Vector(typeName:String='Vector.<*>'):Object{
+        if (singletons) {
+            if (singletons[typeName]) return singletons[typeName];
+        } else {
+            singletons = {}
+        }
         var ret:Object= {};
         ret['classRef'] = Language.synthVector(typeName.substring(8, typeName.length - 1));
         ret['name'] = typeName;
@@ -56,8 +61,10 @@ package org.apache.royale.reflection.nativejs {
                 return AS3Vector(subType);
             };
         }
-        
+        singletons[typeName] = ret;
         return ret;
     }
     
 }
+
+var singletons:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3int.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3int.as
index 45459d4..eb3db26 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3int.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3int.as
@@ -27,6 +27,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3int():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = int;
         ret['name'] = 'int';
@@ -43,9 +44,10 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-    
+        singleton = ret;
         return ret;
     
     }
     
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3uint.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3uint.as
index 4e6074f..eff8e45 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3uint.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/nativejs/AS3uint.as
@@ -27,6 +27,7 @@ package org.apache.royale.reflection.nativejs {
      */
     COMPILE::JS
     public function AS3uint():Object{
+        if (singleton) return singleton;
         var ret:Object= {};
         ret['classRef'] = uint;
         ret['name'] = 'uint';
@@ -43,8 +44,9 @@ package org.apache.royale.reflection.nativejs {
                 }
             };
         };
-    
+        singleton = ret;
         return ret;
     }
     
 }
+var singleton:Object = null; //the explicit assignment with null is necessary here
\ No newline at end of file


[royale-asjs] 03/04: Updated tests for recent Reflection improvements

Posted by gr...@apache.org.
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

commit 070f64d8cb4de84a49b52845345acf9f0b9a5253
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Oct 8 10:06:51 2020 +1300

    Updated tests for recent Reflection improvements
---
 .../reflection/ReflectionTesterTest.as             | 31 ++++++++++++++++++++--
 .../reflection/ReflectionTesterTestAlias.as        | 23 +++++++++++++++-
 .../reflection/ReflectionTesterTestDynamic.as      | 11 +++-----
 .../reflection/ReflectionTesterTestUseCache.as     |  1 +
 .../flexUnitTests/reflection/support/TestClass1.as |  4 +--
 5 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
index 3eefc5e..e57f631 100644
--- a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
@@ -76,6 +76,7 @@ package flexUnitTests.reflection
         public function testBasicDescribeTypeClass():void
         {
             var def:TypeDefinition = describeType(TestClass2);
+
             
             assertEquals( def.packageName, "flexUnitTests.reflection.support", "Unexpected package name");
             assertEquals( def.name, "TestClass2", "Unexpected type name");
@@ -122,14 +123,40 @@ package flexUnitTests.reflection
             assertEquals(
                     "flexUnitTests.reflection.support.TestClass4",
                     constructor.declaredBy.qualifiedName, "unexpected constructor declaredBy");
-            
+
+            assertEquals(
+                    0,
+                    constructor.parameters.length, "unexpected constructor params");
+            //TestClass3 extends TestClass1
+            def =  describeType(TestClass3);
+            //TestClass3 has no explicit constructor defined, it should still be represented and has no parameters
+            constructor = def.constructorMethod;
+
+            assertEquals(
+                    "flexUnitTests.reflection.support.TestClass3",
+                    constructor.declaredBy.qualifiedName, "unexpected constructor declaredBy");
+
             assertEquals(
                     0,
                     constructor.parameters.length, "unexpected constructor params");
+
+            def =  describeType(TestClass1);
+
+            constructor = def.constructorMethod;
+
+            assertEquals(
+                    "flexUnitTests.reflection.support.TestClass1",
+                    constructor.declaredBy.qualifiedName, "unexpected constructor declaredBy");
+
+
+            //there is one optional parameter in the base class
+            assertEquals(
+                    1,
+                    constructor.parameters.length, "unexpected constructor params");
             
             
         }
-        
+
         
         [TestVariance(variance="JS", description="Variance in test due to current inability for js target to reflect into non-Royale base classes or typedefs")]
         [Test]
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as
index 57aeb95..729454f 100644
--- a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as
@@ -35,11 +35,13 @@ package flexUnitTests.reflection
         [BeforeClass]
         public static function setUpBeforeClass():void
         {
+            ExtraData.addAll()
         }
         
         [AfterClass]
         public static function tearDownAfterClass():void
         {
+            ExtraData.reset();
         }
         
         [Before]
@@ -73,7 +75,26 @@ package flexUnitTests.reflection
             //class is retrievable by alias
             assertEquals( TestClass3, getClassByAlias("fjsTest"), "unexpected Class value");
             
-            
+        }
+
+        [Test]
+        public function testNativeTypes():void
+        {
+            //no initial alias
+            assertNull(getAliasByClass(String));
+            registerClassAlias("myStringAlias", String);
+            //alias is registered
+            assertEquals( "myStringAlias", getAliasByClass(String), "unexpected Alias value");
+            //register same alias for another class
+            registerClassAlias("myStringAlias", TestClass3);
+            //original alias mapping is deregistered
+            assertNull(getAliasByClass(String));
+            //alias is registered for new class
+            assertEquals( "myStringAlias", getAliasByClass(TestClass3), "unexpected Alias value");
+
+            //class is retrievable by alias
+            assertEquals( TestClass3, getClassByAlias("myStringAlias"), "unexpected Class value");
+
         }
         
         
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as
index 4064790..730ef71 100644
--- a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as
@@ -113,13 +113,10 @@ package flexUnitTests.reflection
             assertTrue( contentStringsMatch(getDynamicFields(Object), singleDynField), "dynamic fields should match reference list");
             delete Object['test'];
             
-            //temporarily disable dynamic fields test for class because
-            //goog.exportSymbol for static method creates enumerable field -JT
-            //goog.exportSymbol creates enumerable static methods, these won't work
-            //assertTrue( contentStringsMatch(getDynamicFields(TestClass1), emptyArray), "dynamic fields should match reference list");
-            //TestClass1['test'] = true;
-            //assertTrue( contentStringsMatch(getDynamicFields(TestClass1), singleDynField), "dynamic fields should match reference list");
-            //delete TestClass1['test'];
+            assertTrue( contentStringsMatch(getDynamicFields(TestClass1), emptyArray), "dynamic fields should match reference list");
+            TestClass1['test'] = true;
+            assertTrue( contentStringsMatch(getDynamicFields(TestClass1), singleDynField), "dynamic fields should match reference list");
+            delete TestClass1['test'];
             
             //interface is dynamic (even if it doesn't make much sense)
             assertTrue( contentStringsMatch(getDynamicFields(ITestInterface), emptyArray), "dynamic fields should match reference list");
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as
index 547325d..08d8b49 100644
--- a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as
@@ -40,6 +40,7 @@ package flexUnitTests.reflection
         [AfterClass]
         public static function tearDownAfterClass():void
         {
+            TypeDefinition.useCache = false;
         }
         
         [Before]
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as
index 91b9f35..bca4eb0 100644
--- a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as
@@ -27,9 +27,9 @@ package flexUnitTests.reflection.support
      */
     public class TestClass1 implements ITestInterface
     {
-        public function TestClass1()
+        public function TestClass1(somethingElse:ITestInterface = null)
         {
-            //	var something:ITestInterface2;
+
         }
         
         [Bindable]


[royale-asjs] 04/04: Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

Posted by gr...@apache.org.
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

commit 9796a223c7fd0f0b2955ffe771c6262b2bf60c2f
Merge: 070f64d 93a84df
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Oct 8 10:07:09 2020 +1300

    Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

 frameworks/projects/MXRoyale/src/main/royale/mx/effects/Effect.as    | 2 ++
 frameworks/projects/MXRoyale/src/main/royale/mx/effects/Sequence.as  | 1 +
 .../SparkRoyale/src/main/resources/spark-royale-manifest.xml         | 2 ++
 .../projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as       | 1 +
 .../projects/SparkRoyale/src/main/royale/spark/effects/Fade.as       | 2 +-
 .../src/main/royale/spark/events/RendererExistenceEvent.as           | 4 ++--
 .../SparkRoyale/src/main/royale/spark/primitives/BitmapImage.as      | 2 +-
 .../projects/SparkRoyale/src/main/royale/spark/primitives/Line.as    | 5 +++++
 8 files changed, 15 insertions(+), 4 deletions(-)


[royale-asjs] 02/04: Make constructorMethod consistent between swf and js.

Posted by gr...@apache.org.
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

commit 26cb1509e53ee3c54f92f2a6c2f9ee13a9987e67
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Oct 8 10:05:42 2020 +1300

    Make constructorMethod consistent between swf and js.
---
 .../main/royale/org/apache/royale/reflection/MethodDefinition.as    | 4 ++++
 .../src/main/royale/org/apache/royale/reflection/TypeDefinition.as  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/MethodDefinition.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/MethodDefinition.as
index 6b40f98..77daebb 100755
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/MethodDefinition.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/MethodDefinition.as
@@ -43,12 +43,16 @@ package org.apache.royale.reflection
          */
         public function get declaredBy():TypeDefinition
         {
+            /* possible alternate here, @todo review:
+                return owner;
+            */
             COMPILE::SWF{
                 var declareBy:String = _rawData.@declaredBy;
             }
             COMPILE::JS{
                 var declareBy:String = _rawData.declaredBy;
             }
+
             return TypeDefinition.internalGetDefinition(declareBy);
         }
 
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
index 7ed7890..a7d3415 100755
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
@@ -332,6 +332,12 @@ COMPILE::SWF {
                             break;
                         }
                     }
+                    if (!_constructorMethod) {
+                        //constructor with no params
+                        _constructorMethod =
+                                new MethodDefinition(_name, false, this, { type: '', declaredBy: qualifiedName});
+
+                    }
                 }
             }