Permalink
Browse files

Add various Array methods, Replaced Aggregate w. Reduce

  • Loading branch information...
1 parent bd5cc9d commit 2f6a24daa9da97df015fef7629dc277163e7d6d3 @nikhilk committed Sep 7, 2012
View
@@ -23,7 +23,15 @@ v0.7.6
static ctors have a local variable reference.
Should help optimize generation of jQuery scripts, by reducing one extra
function scope.
+ - Removed Aggregate method from Array, ArrayList and List. Use Reduce instead.
+ Removed the corresponding custom implementation from mscorlib.js.
- [git #131] Correctly detect member references within array initializers
+ - [git #161] Add Slice, Splice, Shift, Unshift, Reduce, ReduceRight to
+ Array, ArrayList and List.
+ - [git #228] Restore ability to generate public resource classes
+ (Change Custom Tool property of resx file to
+ ResxPublicScriptGenerator)
+ - [git #230] Add String.IsNullOrWhitespace
v0.7.5.0
- DOM metadata update (readyState property on Document,
View
@@ -33,14 +33,6 @@ public sealed class Array : IEnumerable {
}
}
- public object Aggregate(object seedValue, ArrayAggregator aggregator) {
- return null;
- }
-
- public object Aggregate(object seedValue, ArrayItemAggregator aggregator) {
- return null;
- }
-
public Array Clone() {
return null;
}
@@ -111,6 +103,14 @@ public sealed class Array : IEnumerable {
return null;
}
+ public int LastIndexOf(object item) {
+ return 0;
+ }
+
+ public int LastIndexOf(object item, int fromIndex) {
+ return 0;
+ }
+
public Array Map(ArrayMapCallback mapCallback) {
return null;
}
@@ -123,9 +123,53 @@ public sealed class Array : IEnumerable {
return null;
}
+ public object Reduce(ArrayReduceCallback callback) {
+ return null;
+ }
+
+ public object Reduce(ArrayReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object Reduce(ArrayItemReduceCallback callback) {
+ return null;
+ }
+
+ public object Reduce(ArrayItemReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayReduceCallback callback) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayItemReduceCallback callback) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayItemReduceCallback callback, object initialValue) {
+ return null;
+ }
+
public void Reverse() {
}
+ public object Shift() {
+ return null;
+ }
+
+ public Array Slice(int start) {
+ return null;
+ }
+
+ public Array Slice(int start, int end) {
+ return null;
+ }
+
public bool Some(ArrayFilterCallback filterCallback) {
return false;
}
@@ -140,8 +184,17 @@ public sealed class Array : IEnumerable {
public void Sort(CompareCallback compareCallback) {
}
+ public void Splice(int start, int deleteCount) {
+ }
+
+ public void Splice(int start, int deleteCount, params object[] itemsToInsert) {
+ }
+
public static Array ToArray(object o) {
return null;
}
+
+ public void Unshift(params object[] items) {
+ }
}
}
@@ -41,14 +41,6 @@ public sealed class ArrayGrouping : IEnumerable {
}
}
- public object Aggregate(object seedValue, ArrayAggregator aggregator) {
- return null;
- }
-
- public object Aggregate(object seedValue, ArrayItemAggregator aggregator) {
- return null;
- }
-
public Array Clone() {
return null;
}
@@ -119,6 +111,14 @@ public sealed class ArrayGrouping : IEnumerable {
return null;
}
+ public int LastIndexOf(object item) {
+ return 0;
+ }
+
+ public int LastIndexOf(object item, int fromIndex) {
+ return 0;
+ }
+
public Array Map(ArrayMapCallback mapCallback) {
return null;
}
@@ -1,4 +1,4 @@
-// ArrayItemAggregator.cs
+// ArrayItemReduceCallback.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
@@ -10,5 +10,5 @@ namespace System.Collections {
[IgnoreNamespace]
[Imported]
- public delegate object ArrayItemAggregator(object aggregatedValue, object value);
+ public delegate object ArrayItemReduceCallback(object previousValue, object value);
}
@@ -53,14 +53,6 @@ public sealed class ArrayList : IEnumerable {
public void AddRange(ArrayList items) {
}
- public object Aggregate(object seedValue, ArrayAggregator aggregator) {
- return null;
- }
-
- public object Aggregate(object seedValue, ArrayItemAggregator aggregator) {
- return null;
- }
-
public ArrayList Clone() {
return null;
}
@@ -140,6 +132,14 @@ public sealed class ArrayList : IEnumerable {
return null;
}
+ public int LastIndexOf(object item) {
+ return 0;
+ }
+
+ public int LastIndexOf(object item, int fromIndex) {
+ return 0;
+ }
+
public Array Map(ArrayMapCallback mapCallback) {
return null;
}
@@ -152,6 +152,38 @@ public sealed class ArrayList : IEnumerable {
return null;
}
+ public object Reduce(ArrayReduceCallback callback) {
+ return null;
+ }
+
+ public object Reduce(ArrayReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object Reduce(ArrayItemReduceCallback callback) {
+ return null;
+ }
+
+ public object Reduce(ArrayItemReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayReduceCallback callback) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayReduceCallback callback, object initialValue) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayItemReduceCallback callback) {
+ return null;
+ }
+
+ public object ReduceRight(ArrayItemReduceCallback callback, object initialValue) {
+ return null;
+ }
+
public bool Remove(object item) {
return false;
}
@@ -166,6 +198,18 @@ public sealed class ArrayList : IEnumerable {
public void Reverse() {
}
+ public object Shift() {
+ return null;
+ }
+
+ public Array Slice(int start) {
+ return null;
+ }
+
+ public Array Slice(int start, int end) {
+ return null;
+ }
+
public bool Some(ArrayFilterCallback filterCallback) {
return false;
}
@@ -180,6 +224,15 @@ public sealed class ArrayList : IEnumerable {
public void Sort(CompareCallback compareCallback) {
}
+ public void Splice(int start, int deleteCount) {
+ }
+
+ public void Splice(int start, int deleteCount, params object[] itemsToInsert) {
+ }
+
+ public void Unshift(params object[] items) {
+ }
+
public static explicit operator Array(ArrayList list) {
return null;
}
@@ -1,4 +1,4 @@
-// ArrayAggregator.cs
+// ArrayReduceCallback.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
@@ -10,5 +10,5 @@ namespace System.Collections {
[IgnoreNamespace]
[Imported]
- public delegate object ArrayAggregator(object aggregatedValue, object value, int index, Array array);
+ public delegate object ArrayReduceCallback(object previousValue, object value, int index, Array array);
}
@@ -50,14 +50,6 @@ public sealed class List<T> : ICollection<T> {
public void AddRange(List<T> items) {
}
- public TAccumulated Aggregate<TAccumulated>(TAccumulated seed, ListAggregator<TAccumulated, T> aggregator) {
- return default(TAccumulated);
- }
-
- public TAccumulated Aggregate<TAccumulated>(TAccumulated seed, ListItemAggregator<TAccumulated, T> aggregator) {
- return default(TAccumulated);
- }
-
public List<T> Clone() {
return null;
}
@@ -141,6 +133,14 @@ public sealed class List<T> : ICollection<T> {
return null;
}
+ public int LastIndexOf(object item) {
+ return 0;
+ }
+
+ public int LastIndexOf(object item, int fromIndex) {
+ return 0;
+ }
+
public List<TTarget> Map<TTarget>(ListMapCallback<T, TTarget> mapCallback) {
return null;
}
@@ -153,6 +153,38 @@ public sealed class List<T> : ICollection<T> {
return null;
}
+ public TReduced Reduce<TReduced>(ListReduceCallback<TReduced, T> callback) {
+ return default(TReduced);
+ }
+
+ public TReduced Reduce<TReduced>(ListReduceCallback<TReduced, T> callback, TReduced initialValue) {
+ return default(TReduced);
+ }
+
+ public TReduced Reduce<TReduced>(ListItemReduceCallback<TReduced, T> callback) {
+ return default(TReduced);
+ }
+
+ public TReduced Reduce<TReduced>(ListItemReduceCallback<TReduced, T> callback, TReduced initialValue) {
+ return default(TReduced);
+ }
+
+ public TReduced ReduceRight<TReduced>(ListReduceCallback<TReduced, T> callback) {
+ return default(TReduced);
+ }
+
+ public TReduced ReduceRight<TReduced>(ListReduceCallback<TReduced, T> callback, TReduced initialValue) {
+ return default(TReduced);
+ }
+
+ public TReduced ReduceRight<TReduced>(ListItemReduceCallback<TReduced, T> callback) {
+ return default(TReduced);
+ }
+
+ public TReduced ReduceRight<TReduced>(ListItemReduceCallback<TReduced, T> callback, TReduced initialValue) {
+ return default(TReduced);
+ }
+
public bool Remove(T item) {
return false;
}
@@ -167,6 +199,14 @@ public sealed class List<T> : ICollection<T> {
public void Reverse() {
}
+ public List<T> Slice(int start) {
+ return null;
+ }
+
+ public List<T> Slice(int start, int end) {
+ return null;
+ }
+
public bool Some(ListFilterCallback<T> filterCallback) {
return false;
}
@@ -181,6 +221,15 @@ public sealed class List<T> : ICollection<T> {
public void Sort(CompareCallback<T> compareCallback) {
}
+ public void Splice(int start, int deleteCount) {
+ }
+
+ public void Splice(int start, int deleteCount, params T[] itemsToInsert) {
+ }
+
+ public void Unshift(params T[] items) {
+ }
+
public static explicit operator Array(List<T> list) {
return null;
}
Oops, something went wrong.

0 comments on commit 2f6a24d

Please sign in to comment.