@@ -1127,6 +1127,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
11271127 let nm = ( match v with VRefNonLocal n -> n.ItemKey.PartialKey.LogicalName | _ -> " <local>" )
11281128 invalidOp ( sprintf " The value or member '%s ' does not exist or is in an unresolved assembly." nm)
11291129
1130+ let mkMethSym minfo = FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1131+ let mkEventSym einfo = FSharpMemberOrFunctionOrValue( cenv, E einfo, Item.Event einfo)
1132+
11301133 new ( cenv , vref ) = FSharpMemberFunctionOrValue( cenv, V vref, Item.Value vref)
11311134 new ( cenv , minfo ) = FSharpMemberFunctionOrValue( cenv, M minfo, Item.MethodGroup( minfo.LogicalName, [ minfo]))
11321135
@@ -1209,25 +1212,19 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
12091212 member __.GetterMethod =
12101213 checkIsResolved()
12111214 match d with
1212- | P m ->
1213- let minfo = m.GetterMethod
1214- FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1215+ | P m -> mkMethSym m.GetterMethod
12151216 | E _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated getter method"
12161217
12171218 member __.EventAddMethod =
12181219 checkIsResolved()
12191220 match d with
1220- | E e ->
1221- let minfo = e.GetAddMethod()
1222- FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1221+ | E e -> mkMethSym ( e.GetAddMethod())
12231222 | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated add method"
12241223
12251224 member __.EventRemoveMethod =
12261225 checkIsResolved()
12271226 match d with
1228- | E e ->
1229- let minfo = e.GetRemoveMethod()
1230- FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1227+ | E e -> mkMethSym ( e.GetRemoveMethod())
12311228 | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated remove method"
12321229
12331230 member __.EventDelegateType =
@@ -1256,12 +1253,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
12561253 member __.SetterMethod =
12571254 checkIsResolved()
12581255 match d with
1259- | P m ->
1260- let minfo = m.SetterMethod
1261- FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1262- | E _
1263- | M _
1264- | V _ -> invalidOp " the value or member doesn't have an associated setter method"
1256+ | P m -> mkMethSym m.SetterMethod
1257+ | E _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated setter method"
12651258
12661259 member __.EnclosingEntity =
12671260 checkIsResolved()
@@ -1328,6 +1321,20 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
13281321 | E _ -> true
13291322 | _ -> false
13301323
1324+ member x.EventForFSharpProperty =
1325+ match d with
1326+ | P p when p.IsFSharpEventProperty && p.PropertyName.StartsWith " get_" ->
1327+ let nm = p.PropertyName.[ 4 ..]
1328+ let minfos1 = GetImmediateIntrinsicMethInfosOfType ( Some( " add_" + nm), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType
1329+ let minfos2 = GetImmediateIntrinsicMethInfosOfType ( Some( " remove_" + nm), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType
1330+ match minfos1, minfos2 with
1331+ | [ addMeth],[ removeMeth] ->
1332+ match addMeth.ArbitraryValRef, removeMeth.ArbitraryValRef with
1333+ | Some addVal, Some removeVal -> Some ( mkEventSym ( FSEvent( cenv.g, p, addVal, removeVal)))
1334+ | _ -> None
1335+ | _ -> None
1336+ | _ -> None
1337+
13311338 member __.IsEventAddMethod =
13321339 if isUnresolved() then false else
13331340 match d with
0 commit comments