@@ -1115,9 +1115,37 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
1115
1115
| P m ->
1116
1116
let minfo = m.GetterMethod
1117
1117
FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1118
- | E _
1119
- | M _
1120
- | V _ -> invalidOp " the value or member doesn't have an associated getter method"
1118
+ | E _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated getter method"
1119
+
1120
+ member __.EventAddMethod =
1121
+ checkIsResolved()
1122
+ match d with
1123
+ | E e ->
1124
+ let minfo = e.GetAddMethod()
1125
+ FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1126
+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated add method"
1127
+
1128
+ member __.EventRemoveMethod =
1129
+ checkIsResolved()
1130
+ match d with
1131
+ | E e ->
1132
+ let minfo = e.GetRemoveMethod()
1133
+ FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1134
+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated remove method"
1135
+
1136
+ member __.EventDelegateType =
1137
+ checkIsResolved()
1138
+ match d with
1139
+ | E e -> FSharpType( cenv, e.GetDelegateType( cenv.amap, range0))
1140
+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated event delegate type"
1141
+
1142
+ member __.EventIsStandard =
1143
+ checkIsResolved()
1144
+ match d with
1145
+ | E e ->
1146
+ let dty = e.GetDelegateType( cenv.amap, range0)
1147
+ TryDestStandardDelegateTyp cenv.infoReader range0 AccessibleFromSomewhere dty |> isSome
1148
+ | P _ | M _ | V _ -> invalidOp " the value or member is not an event"
1121
1149
1122
1150
member __.HasSetterMethod =
1123
1151
if isUnresolved() then false
@@ -1446,9 +1474,15 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
1446
1474
| E e ->
1447
1475
// INCOMPLETENESS: Attribs is empty here, so we can't look at return attributes for .NET or F# methods
1448
1476
let retInfo : ArgReprInfo = { Name= None; Attribs= [] }
1449
- let rty = PropTypOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e
1450
- let _ , rty , _cxs = PrettyTypes.PrettifyTypes1 cenv.g rty
1477
+ let rty =
1478
+ try PropTypOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e
1479
+ with _ ->
1480
+ // For non-standard events, just use the delegate type as the ReturnParameter type
1481
+ e.GetDelegateType( cenv.amap, range0)
1482
+
1483
+ let _ , rty , _cxs = PrettyTypes.PrettifyTypes1 cenv.g rty
1451
1484
FSharpParameter( cenv, rty, retInfo, x.DeclarationLocationOpt, isParamArrayArg= false , isOutArg= false , isOptionalArg= false )
1485
+
1452
1486
| P p ->
1453
1487
// INCOMPLETENESS: Attribs is empty here, so we can't look at return attributes for .NET or F# methods
1454
1488
let retInfo : ArgReprInfo = { Name= None; Attribs= [] }
@@ -1815,7 +1849,7 @@ and FSharpParameter(cenv, typ:TType, topArgInfo:ArgReprInfo, mOpt, isParamArrayA
1815
1849
1816
1850
and FSharpAssemblySignature internal ( cenv , topAttribs : TypeChecker.TopAttribs option , mtyp : ModuleOrNamespaceType ) =
1817
1851
1818
- new ( g , thisCcu , tcImports , topAttribs , mtyp ) = FSharpAssemblySignature( cenv( g, thisCcu, tcImports), topAttribs, mtyp)
1852
+ new ( g , thisCcu , tcImports , topAttribs , mtyp ) = FSharpAssemblySignature( cenv( g, thisCcu, tcImports), topAttribs, mtyp)
1819
1853
1820
1854
member __.Entities =
1821
1855
@@ -1824,7 +1858,11 @@ and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs o
1824
1858
if entity.IsNamespace then
1825
1859
yield ! loop entity.ModuleOrNamespaceType
1826
1860
else
1827
- yield FSharpEntity( cenv, mkLocalEntityRef entity) |]
1861
+ let entityRef =
1862
+ match tryRescopeEntity cenv.thisCcu entity with
1863
+ | None -> mkLocalEntityRef entity
1864
+ | Some eref -> eref
1865
+ yield FSharpEntity( cenv, entityRef) |]
1828
1866
1829
1867
loop mtyp |> makeReadOnlyCollection
1830
1868
@@ -1839,7 +1877,7 @@ and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs o
1839
1877
1840
1878
and FSharpAssembly internal ( cenv , ccu : CcuThunk ) =
1841
1879
1842
- new ( g , thisCcu , tcImports , ccu ) = FSharpAssembly( cenv( g, thisCcu , tcImports), ccu)
1880
+ new ( g , tcImports , ccu ) = FSharpAssembly( cenv( g, ccu , tcImports), ccu)
1843
1881
1844
1882
member __.RawCcuThunk = ccu
1845
1883
member __.QualifiedName = match ccu.QualifiedName with None -> " " | Some s -> s
0 commit comments