diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2013-12-16 19:54:53 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2013-12-16 19:54:53 +0400 |
commit | 843701ac6d7f705655c72e3c0f3a9f7fb0679d55 (patch) | |
tree | ba2ccf00caa05ef378796f9bd34ff0680d2b521d /Rx/NET/Source | |
parent | 44dec827ddbe3bc2bc420dbd60eeedf06d814635 (diff) |
Fixed some bogus merge.
Diffstat (limited to 'Rx/NET/Source')
6 files changed, 11 insertions, 225 deletions
diff --git a/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs b/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs index 14b4b39..45d8424 100644 --- a/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs +++ b/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs @@ -143,44 +143,6 @@ namespace Microsoft.Reactive.Testing } /// <summary> - /// Factory method for an OnError notification record at a given time with a given error. - /// </summary> - /// <typeparam name="T">The element type for the resulting notification object.</typeparam> - /// <param name="dummy">An unused instance of type T, to force the compiler to infer that T as part of the method's return value.</param> - /// <param name="ticks">Recorded virtual time the OnError notification occurs.</param> - /// <param name="exception">Recorded exception stored in the OnError notification.</param> - /// <returns>Recorded OnError notification.</returns> - /// <exception cref="ArgumentNullException"><paramref name="exception"/> is null.</exception> - /// <remarks>This overload is used for anonymous types - by passing in an instance of the type, the compiler can infer the - /// anonymous type without you having to try naming the type.</remarks> - public static Recorded<Notification<T>> OnError<T>(T dummy, long ticks, Exception exception) - { - if (exception == null) - throw new ArgumentNullException("exception"); - - return new Recorded<Notification<T>>(ticks, Notification.CreateOnError<T>(exception)); - } - - /// <summary> - /// Factory method for writing an assert that checks for an OnError notification record at a given time, using the specified predicate to check the exception. - /// </summary> - /// <typeparam name="T">The element type for the resulting notification object.</typeparam> - /// <param name="dummy">An unused instance of type T, to force the compiler to infer that T as part of the method's return value.</param> - /// <param name="ticks">Recorded virtual time the OnError notification occurs.</param> - /// <param name="predicate">Predicate function to check the OnError notification value against an expected exception.</param> - /// <returns>Recorded OnError notification with a predicate to assert a given exception.</returns> - /// <exception cref="ArgumentNullException"><paramref name="predicate"/> is null.</exception> - /// <remarks>This overload is used for anonymous types - by passing in an instance of the type, the compiler can infer the - /// anonymous type without you having to try naming the type.</remarks> - public static Recorded<Notification<T>> OnError<T>(T dummy, long ticks, Func<Exception, bool> predicate) - { - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return new Recorded<Notification<T>>(ticks, new OnErrorPredicate<T>(predicate)); - } - - /// <summary> /// Factory method for a subscription record based on a given subscription and disposal time. /// </summary> /// <param name="start">Virtual time indicating when the subscription was created.</param> diff --git a/Rx/NET/Source/Rx.sln b/Rx/NET/Source/Rx.sln index f2cf10f..a5ac016 100644 --- a/Rx/NET/Source/Rx.sln +++ b/Rx/NET/Source/Rx.sln @@ -51,16 +51,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Observable.Aliases", "System.Reactive.Observable.Aliases\System.Reactive.Observable.Aliases.csproj", "{9FFAC385-10A4-4DDD-B800-DE67E8469CC0}" EndProject Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 1 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs1:8085/tfs/interop%20team%20projects - SccProjectUniqueName0 = Playground\\Playground.csproj - SccProjectName0 = Playground - SccAuxPath0 = http://tfs1:8085/tfs/interop%20team%20projects - SccLocalPath0 = Playground - SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - EndGlobalSection GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = Rx.vsmdi EndGlobalSection diff --git a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/SelectMany.cs b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/SelectMany.cs index 3d1ec0c..49d7cf9 100644 --- a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/SelectMany.cs +++ b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/SelectMany.cs @@ -71,7 +71,7 @@ namespace System.Reactive.Linq.ObservableImpl protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink) { - if (_collectionSelector != null || _collectionSelectorWithIndex != null) + if (_collectionSelector != null) { var sink = new _(this, observer, cancel); setSink(sink); @@ -119,14 +119,12 @@ namespace System.Reactive.Linq.ObservableImpl : base(observer, cancel) { _parent = parent; - _indexInSource = -1; } private object _gate; private bool _isStopped; private CompositeDisposable _group; private SingleAssignmentDisposable _sourceSubscription; - private int _indexInSource; public IDisposable Run() { @@ -147,13 +145,7 @@ namespace System.Reactive.Linq.ObservableImpl try { - if (_parent._collectionSelector != null) - collection = _parent._collectionSelector(value); - else - { - checked { _indexInSource++; } - collection = _parent._collectionSelectorWithIndex(value, _indexInSource); - } + collection = _parent._collectionSelector(value); } catch (Exception ex) { @@ -208,16 +200,12 @@ namespace System.Reactive.Linq.ObservableImpl private readonly _ _parent; private readonly TSource _value; private readonly IDisposable _self; - private int _indexInSource; - private int _indexInIntermediate = -1; public Iter(_ parent, TSource value, IDisposable self) { _parent = parent; _value = value; _self = self; - _indexInSource = indexInSource; - _indexInIntermediate = -1; } public void OnNext(TCollection value) @@ -226,13 +214,7 @@ namespace System.Reactive.Linq.ObservableImpl try { - if (_parent._parent._resultSelector != null) - res = _parent._parent._resultSelector(_value, value); - else - { - checked { _indexInIntermediate++; } - res = _parent._parent._resultSelectorWithIndex(_value, _indexInSource, value, _indexInIntermediate); - } + res = _parent._parent._resultSelector(_value, value); } catch (Exception ex) { @@ -438,13 +420,11 @@ namespace System.Reactive.Linq.ObservableImpl class NoSelectorImpl : Sink<TResult>, IObserver<TSource> { private readonly SelectMany<TSource, TCollection, TResult> _parent; - private int _indexInSource; // The "Weird SelectMany" requires indices in the original collection as well as an intermediate collection public NoSelectorImpl(SelectMany<TSource, TCollection, TResult> parent, IObserver<TResult> observer, IDisposable cancel) : base(observer, cancel) { _parent = parent; - _indexInSource = -1; } public void OnNext(TSource value) @@ -452,13 +432,7 @@ namespace System.Reactive.Linq.ObservableImpl var xs = default(IEnumerable<TCollection>); try { - if (_parent._collectionSelectorE != null) - xs = _parent._collectionSelectorE(value); - else - { - checked { _indexInSource++; } - xs = _parent._collectionSelectorEWithIndex(value, _indexInSource); - } + xs = _parent._collectionSelectorE(value); } catch (Exception exception) { @@ -481,7 +455,6 @@ namespace System.Reactive.Linq.ObservableImpl try { - int indexInIntermediate = -1; var hasNext = true; while (hasNext) { @@ -492,15 +465,7 @@ namespace System.Reactive.Linq.ObservableImpl { hasNext = e.MoveNext(); if (hasNext) - { - if (_parent._resultSelector != null) - current = _parent._resultSelector(value, e.Current); - else - { - checked { indexInIntermediate++; } - current = _parent._resultSelectorWithIndex(value, _indexInSource, e.Current, indexInIntermediate); - } - } + current = _parent._resultSelector(value, e.Current); } catch (Exception exception) { @@ -964,7 +929,7 @@ namespace System.Reactive.Linq.ObservableImpl protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink) { - if (_selector != null || _selectorWithIndex != null) + if (_selector != null) { var sink = new _(this, observer, cancel); setSink(sink); @@ -1200,7 +1165,6 @@ namespace System.Reactive.Linq.ObservableImpl : base(observer, cancel) { _parent = parent; - _index = -1; } private object _gate; @@ -1251,13 +1215,7 @@ namespace System.Reactive.Linq.ObservableImpl try { - if (_parent._selectorOnError != null) - inner = _parent._selectorOnError(error); - else - { - checked { _index++; } - inner = _parent._selectorWithIndexOnError(error, _index); - } + inner = _parent._selectorOnError(error); } catch (Exception ex) { @@ -1291,10 +1249,7 @@ namespace System.Reactive.Linq.ObservableImpl try { - if (_parent._selectorOnCompleted != null) - inner = _parent._selectorOnCompleted(); - else - inner = _parent._selectorWithIndexOnCompleted(_index); + inner = _parent._selectorOnCompleted(); } catch (Exception ex) { @@ -1394,13 +1349,11 @@ namespace System.Reactive.Linq.ObservableImpl class NoSelectorImpl : Sink<TResult>, IObserver<TSource> { private readonly SelectMany<TSource, TResult> _parent; - private int _index; public NoSelectorImpl(SelectMany<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel) : base(observer, cancel) { _parent = parent; - _index = -1; } public void OnNext(TSource value) @@ -1408,13 +1361,7 @@ namespace System.Reactive.Linq.ObservableImpl var xs = default(IEnumerable<TResult>); try { - if (_parent._selectorE != null) - xs = _parent._selectorE(value); - else - { - checked { _index++; } - xs = _parent._selectorEWithIndex(value, _index); - } + xs = _parent._selectorE(value); } catch (Exception exception) { @@ -1789,4 +1736,4 @@ namespace System.Reactive.Linq.ObservableImpl #endif } } -#endif +#endif
\ No newline at end of file diff --git a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs index 52fb54f..41ceb9c 100644 --- a/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs +++ b/Rx/NET/Source/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs @@ -986,15 +986,6 @@ namespace System.Reactive.Linq #endif } - private static IObservable<TResult> SelectMany_<TSource, TResult>(IObservable<TSource> source, Func<TSource, int, IObservable<TResult>> selector) - { -#if !NO_PERF - return new SelectMany<TSource, TResult>(source, selector); -#else - return source.Select(selector).Merge(); -#endif - } - private static IObservable<TResult> SelectMany_<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector) { #if !NO_PERF diff --git a/Rx/NET/Source/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs b/Rx/NET/Source/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs index d9151d1..4a73c80 100644 --- a/Rx/NET/Source/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs +++ b/Rx/NET/Source/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs @@ -11933,43 +11933,6 @@ namespace System.Reactive.Linq } /// <summary> - /// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. - /// </summary> - /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> - /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam> - /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam> - /// <param name="source">An observable sequence of elements to project.</param> - /// <param name="collectionSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param> - /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param> - /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns> - /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception> - /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks> - public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, int, TCollection, int, TResult>> resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (collectionSelector == null) - throw new ArgumentNullException("collectionSelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return source.Provider.CreateQuery<TResult>( - Expression.Call( - null, -#if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IEnumerable<TCollection>>>), default(Expression<Func<TSource, int, TCollection, int, TResult>>))), -#else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), -#endif - source.Expression, - collectionSelector, - resultSelector - ) - ); - } - - /// <summary> /// Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. /// </summary> /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> @@ -12306,37 +12269,6 @@ namespace System.Reactive.Linq } #endif - /// <summary> - /// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. - /// </summary> - /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> - /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam> - /// <param name="source">An observable sequence of elements to project.</param> - /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param> - /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns> - /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception> - public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IObservable<TResult>>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery<TResult>( - Expression.Call( - null, -#if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IObservable<TResult>>>))), -#else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), -#endif - source.Expression, - selector - ) - ); - } - #if !NO_TPL /// <summary> /// Projects each element of an observable sequence to a task by incorporating the element's index with cancellation support and merges all of the task results into one observable sequence. @@ -12449,39 +12381,6 @@ namespace System.Reactive.Linq } #endif - /// <summary> - /// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence. - /// The index of each source element is used in the projected form of that element. - /// </summary> - /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> - /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam> - /// <param name="source">An observable sequence of elements to project.</param> - /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param> - /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns> - /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception> - /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks> - public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IEnumerable<TResult>>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery<TResult>( - Expression.Call( - null, -#if CRIPPLED_REFLECTION - InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IEnumerable<TResult>>>))), -#else - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), -#endif - source.Expression, - selector - ) - ); - } - #if !NO_TPL /// <summary> /// Projects each element of an observable sequence to a task, invokes the result selector for the source element and the task result, and merges the results into one observable sequence. @@ -14005,10 +13904,7 @@ namespace System.Reactive.Linq } /// <summary> - /// Computes the sum of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence. -======= /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence. ->>>>>>> master /// </summary> /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam> /// <param name="source">A sequence of values that are used to calculate a sum.</param> diff --git a/Rx/NET/Source/Tests.System.Reactive/App.cs b/Rx/NET/Source/Tests.System.Reactive/App.cs index 7744eed..4ed3c16 100644 --- a/Rx/NET/Source/Tests.System.Reactive/App.cs +++ b/Rx/NET/Source/Tests.System.Reactive/App.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. #if SILVERLIGHT && !SILVERLIGHTM7 using System; |