This is an automated email from the ASF dual-hosted git repository.
harbs 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 f5983e1c26 Collection function expressions
f5983e1c26 is described below
commit f5983e1c264f93ad71aaf6997fb358053fd28d53
Author: Harbs <[email protected]>
AuthorDate: Mon Feb 16 21:13:33 2026 +0200
Collection function expressions
---
.../main/royale/org/apache/royale/collections/ISort.as | 6 +++---
.../royale/org/apache/royale/collections/ISortField.as | 2 +-
.../main/royale/org/apache/royale/collections/Sort.as | 16 ++++++++--------
.../royale/org/apache/royale/collections/SortField.as | 6 +++---
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISort.as
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISort.as
index 14073e1da9..d39c9a3b46 100644
---
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISort.as
+++
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISort.as
@@ -123,13 +123,13 @@ public interface ISort {
* @playerversion AIR 2.6
* @productversion Flex 4.5
*/
- function get compareFunction():Function;
+ function get compareFunction():(a:Object, b:Object, fields?:Array)=>int;
/**
* @deprecated A future release of Apache Flex SDK will remove this
function. Please use the constructor
* argument instead.
*/
- function set compareFunction(value:Function):void;
+ function set compareFunction(value:(a:Object, b:Object,
fields?:Array)=>int):void;
/**
* An <code>Array</code> of <code>ISortField</code> objects that
@@ -280,7 +280,7 @@ public interface ISort {
values:Object,
mode:String,
returnInsertionIndex:Boolean = false,
- compareFunction:Function = null):int;
+ compareFunction:(a:Object, b:Object, fields?:Array)=>int =
null):int;
/**
* Return whether the specified property is used to control the sort.
diff --git
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISortField.as
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISortField.as
index 44ae7eb791..5363ba5f46 100644
---
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISortField.as
+++
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ISortField.as
@@ -74,7 +74,7 @@ public interface ISortField
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
- function get compareFunction():Function;
+ function get compareFunction():(a:Object, b:Object)=>int;
/**
* Specifies whether this field should be sorted in descending
diff --git
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/Sort.as
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/Sort.as
index d16869fa1f..caf80b6559 100644
---
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/Sort.as
+++
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/Sort.as
@@ -186,7 +186,7 @@ public class Sort extends EventDispatcher implements ISort
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
- public function Sort(fields:Array = null, customCompareFunction:Function =
null, unique:Boolean = false)
+ public function Sort(fields:Array = null, customCompareFunction:(a:Object,
b:Object, fields?:Array)=>int = null, unique:Boolean = false)
{
super();
@@ -236,7 +236,7 @@ public class Sort extends EventDispatcher implements ISort
* @private
* Storage for the compareFunction property.
*/
- private var _compareFunction:Function;
+ private var _compareFunction:(a:Object, b:Object, fields?:Array)=>int;
/**
* @private
@@ -253,7 +253,7 @@ public class Sort extends EventDispatcher implements ISort
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
- public function get compareFunction():Function
+ public function get compareFunction():(a:Object, b:Object,
fields?:Array)=>int
{
return usingCustomCompareFunction ? _compareFunction : internalCompare;
}
@@ -261,7 +261,7 @@ public class Sort extends EventDispatcher implements ISort
/**
* @private
*/
- public function set compareFunction(value:Function):void
+ public function set compareFunction(value:(a:Object, b:Object,
fields?:Array)=>int):void
{
_compareFunction = value;
usingCustomCompareFunction = _compareFunction != null;
@@ -376,9 +376,9 @@ public class Sort extends EventDispatcher implements ISort
values:Object,
mode:String,
returnInsertionIndex:Boolean = false,
- compareFunction:Function = null):int
+ compareFunction:(a:Object, b:Object,
fields?:Array)=>int = null):int
{
- var compareForFind:Function;
+ var compareForFind:(a:Object, b:Object, fields?:Array)=>int;
var fieldsForCompare:Array;
var message:String;
@@ -615,7 +615,7 @@ public class Sort extends EventDispatcher implements ISort
// the Sort.internalCompare function knows to use Sort._fields;
that same logic
// needs to be part of calling a custom compareFunction. Of
course, a user shouldn't
// be doing this -- so I wrap calls to compareFunction with
_fields as the last parameter
- const fixedCompareFunction:Function =
+ const fixedCompareFunction:(a:Object, b:Object)=>int =
function (a:Object, b:Object):int
{
// append our fields to the call, since items.sort()
won't
@@ -760,7 +760,7 @@ public class Sort extends EventDispatcher implements ISort
var len:int = fields ? fields.length : _fields.length;
while (result == 0 && (i < len))
{
- var sf:ISortField = ISortField(_fields[i]);
+ var sf:ISortField = (_fields[i] as ISortField);
result = sf.compareFunction(a, b);
if (sf.descending)
result *= -1;
diff --git
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/SortField.as
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/SortField.as
index 540cb3a5ee..e464350dc7 100644
---
a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/SortField.as
+++
b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/SortField.as
@@ -130,7 +130,7 @@ public class SortField extends EventDispatcher implements
ISortField
descending:Boolean =
false,
numeric:Object = null,
sortCompareType:String = null,
-
customCompareFunction:Function = null)
+
customCompareFunction:(a:Object, b:Object)=>int = null)
{
super();
@@ -210,7 +210,7 @@ public class SortField extends EventDispatcher implements
ISortField
* @private
* Storage for the compareFunction property.
*/
- private var _compareFunction:Function;
+ private var _compareFunction:(a:Object, b:Object)=>int;
[Inspectable(category="General")]
@@ -253,7 +253,7 @@ public class SortField extends EventDispatcher implements
ISortField
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
- public function get compareFunction():Function
+ public function get compareFunction():(a:Object, b:Object)=>int
{
return _compareFunction;
}