@@ -1071,15 +1071,39 @@ module Statement =
10711071 and typeFinder ( state : {| origin: AnonymousInterfaceOrigin ; namespace_: string list |}) ty =
10721072 let inline resultMany xs = Some [], state, xs
10731073 match ty with
1074- | App ( AAnonymousInterface i, _, _) ->
1075- None, {| state with origin = AnonymousInterfaceOrigin.Empty |}, Seq.singleton ( i, state)
1076- | AnonymousInterface i ->
1077- None, {| state with origin = AnonymousInterfaceOrigin.Empty |}, Seq.singleton ( i, state)
1074+ | App ( AAnonymousInterface i, _, _) | AnonymousInterface i ->
1075+ let inner =
1076+ let state = {| state with origin = AnonymousInterfaceOrigin.Empty |}
1077+ treatClassLike state ( i.MapName( ignore))
1078+ None, {| state with origin = AnonymousInterfaceOrigin.Empty |}, Seq.append [ i, state] inner
10781079 | Func ( ft, tps, _) | NewableFunc ( ft, tps, _) ->
10791080 treatFuncType state ft tps |> resultMany
10801081 | Union { types = types } | Intersection { types = types } ->
10811082 Some types, state, Seq.empty
10821083 | _ -> None, {| state with origin = AnonymousInterfaceOrigin.Empty |}, Seq.empty
1084+ and treatClassLike ( state : {| origin: AnonymousInterfaceOrigin ; namespace_: string list |}) ( c : Class < unit >) =
1085+ seq {
1086+ for _, m in c.members do
1087+ match m with
1088+ | Method ( name, ft, tps) ->
1089+ yield ! treatFuncType {| state with origin = { state.origin with valueName = Some name } |} ft tps
1090+ | Newable ( ft, tps) | Callable ( ft, tps) -> yield ! treatFuncType state ft tps
1091+ | Field ( fl, _) | Getter fl | Setter fl -> yield ! treatNamed state fl.name fl.value
1092+ | Indexer ( ft, _) -> yield ! treatFuncType state ft []
1093+ | SymbolIndexer ( name, ft, _) ->
1094+ yield ! treatFuncType {| state with origin = { state.origin with valueName = Some name } |} ft []
1095+ | Constructor ft ->
1096+ for arg in ft.args do
1097+ let ty , origin =
1098+ match arg with
1099+ | Choice1Of2 fl -> fl.value, { state.origin with argName = Some fl.name }
1100+ | Choice2Of2 t -> t, state.origin
1101+ yield ! findTypes typeFinder {| state with origin = origin |} ty
1102+ | UnknownMember _ -> ()
1103+ for t in c.implements do
1104+ yield ! findTypes typeFinder state t
1105+ yield ! treatTypeParameters state c.typeParams
1106+ }
10831107
10841108 findStatements ( fun currentNamespace state stmt ->
10851109 let inline result_ x = Some [], state, x
@@ -1099,28 +1123,7 @@ module Statement =
10991123 let typeName =
11001124 match c.name with Name n -> Some n | _ -> None
11011125 let state = {| state with namespace_ = currentNamespace; origin = { state.origin with typeName = typeName } |}
1102- seq {
1103- for _, m in c.members do
1104- match m with
1105- | Method ( name, ft, tps) ->
1106- yield ! treatFuncType {| state with origin = { state.origin with valueName = Some name } |} ft tps
1107- | Newable ( ft, tps) | Callable ( ft, tps) -> yield ! treatFuncType state ft tps
1108- | Field ( fl, _) | Getter fl | Setter fl -> yield ! treatNamed state fl.name fl.value
1109- | Indexer ( ft, _) -> yield ! treatFuncType state ft []
1110- | SymbolIndexer ( name, ft, _) ->
1111- yield ! treatFuncType {| state with origin = { state.origin with valueName = Some name } |} ft []
1112- | Constructor ft ->
1113- for arg in ft.args do
1114- let ty , origin =
1115- match arg with
1116- | Choice1Of2 fl -> fl.value, { state.origin with argName = Some fl.name }
1117- | Choice2Of2 t -> t, state.origin
1118- yield ! findTypes typeFinder {| state with origin = origin |} ty
1119- | UnknownMember _ -> ()
1120- for t in c.implements do
1121- yield ! findTypes typeFinder state t
1122- yield ! treatTypeParameters state c.typeParams
1123- } |> result_
1126+ treatClassLike state ( c.MapName( ignore)) |> result_
11241127 | _ -> None, state.origin, Seq.empty
11251128 ) AnonymousInterfaceOrigin.Empty stmts |> Set.ofSeq
11261129
0 commit comments