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 2019/05/23 07:05:39 UTC

[royale-asjs] 03/07: minor Vector optimizations

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

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

commit bc4bf05ad1aab648e14c13300899bd29c7a731ed
Author: greg-dove <gr...@gmail.com>
AuthorDate: Mon May 20 12:23:54 2019 +1200

    minor Vector optimizations
---
 .../src/main/royale/org/apache/royale/utils/Language.as   | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

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 8f2a7f2..f21cfce 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
@@ -544,7 +544,7 @@ package org.apache.royale.utils
                         fixed = l == 2 ? a[--l] : false;
                         size = l == 1 ? a[0] : 0;
                         instance[VectorSupport.ELEMENT_TYPE] = elementType;
-                        instance[VectorSupport.TYPE] = typeName;
+                        instance['type'] = typeName;
                         instance[VectorSupport.FIXED_LEN] = fixed ? size : -1;
                         return VectorSupport.arrayVector([], size, elementType, fixed, instance);
                     },
@@ -628,7 +628,6 @@ class VectorSupport {
     public static const COERCE_ELEMENT:String = goog.DEBUG ? 'coerceElement' : 'cE';
     public static const DEFAULT_VALUE:String = goog.DEBUG ? 'defaultValue' : 'dV';
     public static const ELEMENT_TYPE:String = goog.DEBUG ? 'elementType' : 'eT';
-    public static const TYPE:String = goog.DEBUG ? 'type' : 'ty';
     
     public static const FIXED_LEN:String = goog.DEBUG ? 'fixedLen' : 'fL';
     
@@ -897,21 +896,21 @@ class VectorSupport {
      * @royaleignorecoercion Array
      */
     public function splice():* {
-        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.splice.apply(this, a) as Array; if (inst[FIXED_LEN] > -1) inst[FIXED_LEN] = this['length']; return arrayVector(ret, ret.length, inst[ELEMENT_TYPE], false, null, false);
+        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.splice.apply(this, a) as Array; if (inst[FIXED_LEN] > -1) inst[FIXED_LEN] = this['length']; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
     }
     
     /**
      * @royaleignorecoercion Array
      */
     public function slice():* {
-        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.slice.apply(this, a) as Array; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null)//arrayVector(ret, ret.length, inst[ELEMENT_TYPE], false, null, false);
+        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.slice.apply(this, a) as Array; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
     }
     
     /**
      * @royaleignorecoercion Array
      */
     public function filter():* {
-        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.filter.apply(this, a) as Array; return arrayVector(ret, ret.length, inst[ELEMENT_TYPE], false, null, false);
+        var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.filter.apply(this, a) as Array; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
     }
     
     /**
@@ -923,12 +922,12 @@ class VectorSupport {
         var l:uint = a.length;
         for (var i:int = 0; i<l; i++) {
             var contender:Array = a[i] as Array;
-            if (!checkIsVector(contender, inst[TYPE] as String)) {
-                throw new TypeError('Error #1034: Type Coercion failed: cannot convert ' + contender[Language.SYNTH_TAG_FIELD][TYPE] + ' to ' + inst[TYPE]);
+            if (!checkIsVector(contender, inst['type'] as String)) {
+                throw new TypeError('Error #1034: Type Coercion failed: cannot convert ' + contender[Language.SYNTH_TAG_FIELD]['type'] + ' to ' + inst['type']);
             }
         }
         var ret:Array = Array.prototype.concat.apply(this, a) as Array;
-        return arrayVector(ret, ret.length, inst[ELEMENT_TYPE], false, null, false);
+        return tagVectorArray(ret,inst[ELEMENT_TYPE], false, null);
     }
     
     public function uncheckedInsertAt(index:Number,item:*):* {