Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/fsharp/FSharp.Core/event.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@ namespace Microsoft.FSharp.Control
// CreateDelegate creates a delegate that is fast to invoke.
invoker.Invoke(multicast, sender, args) |> ignore

member x.Publish =
// Note, we implement each interface explicitly: this works around a bug in the CLR
// implementation on CompactFramework 3.7, used on Windows Phone 7
member x.Publish =
{ new obj() with
member x.ToString() = "<published event>"
interface IEvent<'Delegate,'Args>
interface IDelegateEvent<'Delegate> with
interface IEvent<'Delegate,'Args> with
member e.AddHandler(d) =
multicast <- System.Delegate.Combine(multicast, d) :?> 'Delegate
member e.RemoveHandler(d) =
Expand All @@ -126,13 +123,10 @@ namespace Microsoft.FSharp.Control
match x.multicast with
| null -> ()
| d -> d.Invoke(null,arg) |> ignore
member x.Publish =
// Note, we implement each interface explicitly: this works around a bug in the CLR
// implementation on CompactFramework 3.7, used on Windows Phone 7
member x.Publish =
{ new obj() with
member x.ToString() = "<published event>"
interface IEvent<'T>
interface IDelegateEvent<Handler<'T>> with
interface IEvent<'T> with
member e.AddHandler(d) =
x.multicast <- (System.Delegate.Combine(x.multicast, d) :?> Handler<'T>)
member e.RemoveHandler(d) =
Expand Down
5 changes: 1 addition & 4 deletions src/fsharp/FSharp.Core/seqcore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,9 @@ namespace Microsoft.FSharp.Core.CompilerServices
(FinallyEnumerable(compensation, (fun () -> source)) :> seq<_>)

let CreateEvent (addHandler : 'Delegate -> unit) (removeHandler : 'Delegate -> unit) (createHandler : (obj -> 'Args -> unit) -> 'Delegate ) :IEvent<'Delegate,'Args> =
// Note, we implement each interface explicitly: this works around a bug in the CLR
// implementation on CompactFramework 3.7, used on Windows Phone 7
{ new obj() with
member x.ToString() = "<published event>"
interface IEvent<'Delegate,'Args>
interface IDelegateEvent<'Delegate> with
interface IEvent<'Delegate,'Args> with
member x.AddHandler(h) = addHandler h
member x.RemoveHandler(h) = removeHandler h
interface System.IObservable<'Args> with
Expand Down
19 changes: 8 additions & 11 deletions src/fsharp/TypedTreeBasics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,14 @@ let primUnionCaseRefEq compilingFslib fslibCcu (UnionCaseRef(tcr1, c1) as uc1) (
///
/// Note this routine doesn't take type forwarding into account
let primValRefEq compilingFslib fslibCcu (x: ValRef) (y: ValRef) =
x === y ||
if (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) ||
(x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) then
true
else
(// Use TryDeref to guard against the platforms/times when certain F# language features aren't available,
// e.g. CompactFramework doesn't have support for quotations.
match x.TryDeref with
| ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | _ -> false
| _ -> match y.TryDeref with ValueNone -> true | _ -> false)
|| (if compilingFslib then fslibValRefEq fslibCcu x y else false)
x === y
|| (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget)
|| (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget)
|| // Use TryDeref to guard against the platforms/times when certain F# language features aren't available
match x.TryDeref with
| ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | ValueNone -> false
| ValueNone -> match y.TryDeref with ValueNone -> true | ValueSome _ -> false
|| (compilingFslib && fslibValRefEq fslibCcu x y)

//---------------------------------------------------------------------------
// pubpath/cpath mess
Expand Down