@@ -183,6 +183,7 @@ type TypeCheckInfo
183183 let amap = tcImports.GetImportMap()
184184 let infoReader = new InfoReader( g, amap)
185185 let ncenv = new NameResolver( g, amap, infoReader, NameResolution.FakeInstantiationGenerator)
186+ let cenv = SymbolEnv( g, thisCcu, Some ccuSigForFile, tcImports, amap, infoReader)
186187
187188 /// Find the most precise naming environment for the given line and column
188189 let GetBestEnvForPos cursorPos =
@@ -938,7 +939,6 @@ type TypeCheckInfo
938939 match GetDeclItemsForNamesAtPosition( ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1 , ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with
939940 | None -> FSharpDeclarationListInfo.Empty
940941 | Some ( items, denv, ctx, m) ->
941- let cenv = SymbolEnv( g, thisCcu, Some ccuSigForFile, tcImports)
942942 let items = if isInterfaceFile then items |> List.filter ( fun x -> IsValidSignatureFileItem x.Item) else items
943943 let getAccessibility item = FSharpSymbol.GetAccessibility ( FSharpSymbol.Create( cenv, item))
944944 let currentNamespaceOrModule =
@@ -1011,16 +1011,15 @@ type TypeCheckInfo
10111011
10121012 items |> List.filter ( fun ( nm , items ) -> not ( isOpItem( nm, items)) && not ( isFSharpList nm))
10131013
1014- let cenv = SymbolEnv( g, thisCcu, Some ccuSigForFile, tcImports)
10151014 let items =
10161015 // Filter out duplicate names
10171016 items |> List.map ( fun ( _nm , itemsWithSameName ) ->
10181017 match itemsWithSameName with
10191018 | [] -> failwith " Unexpected empty bag"
10201019 | items ->
1021- items |> List.map ( fun item ->
1022- let symbol = FSharpSymbol.Create( cenv, item.Item)
1023- FSharpSymbolUse( g, denv, symbol, ItemOccurence.Use, m)))
1020+ items
1021+ |> List.map ( fun item -> let symbol = FSharpSymbol.Create( cenv, item.Item)
1022+ FSharpSymbolUse( g, denv, symbol, ItemOccurence.Use, m)))
10241023
10251024 //end filtering
10261025 items)
@@ -1134,7 +1133,6 @@ type TypeCheckInfo
11341133 match GetDeclItemsForNamesAtPosition ( ctok, None, Some( names), None, None, line, lineStr, colAtEndOfNames, ResolveTypeNamesToCtors, ResolveOverloads.No,( fun () -> []), fun _ -> false ) with
11351134 | None | Some ([],_,_,_) -> None
11361135 | Some ( items, denv, _, m) ->
1137- let cenv = SymbolEnv( g, thisCcu, Some ccuSigForFile, tcImports)
11381136 let allItems = items |> List.collect ( fun item -> SymbolHelpers.FlattenItems g m item.Item)
11391137 let symbols = allItems |> List.map ( fun item -> FSharpSymbol.Create( cenv, item))
11401138 Some ( symbols, denv, m)
@@ -1250,7 +1248,7 @@ type TypeCheckInfo
12501248 match GetDeclItemsForNamesAtPosition ( ctok, None, Some( names), None, None, line, lineStr, colAtEndOfNames, ResolveTypeNamesToCtors, ResolveOverloads.Yes,( fun () -> []), fun _ -> false ) with
12511249 | None | Some ([], _, _, _) -> None
12521250 | Some ( item :: _, denv, _, m) ->
1253- let symbol = FSharpSymbol.Create( g , thisCcu , ccuSigForFile , tcImports , item.Item)
1251+ let symbol = FSharpSymbol.Create( cenv , item.Item)
12541252 Some ( symbol, denv, m)
12551253 )
12561254 ( fun msg ->
@@ -1402,6 +1400,8 @@ type TypeCheckInfo
14021400 /// All open declarations in the file, including auto open modules
14031401 member __.OpenDeclarations = openDeclarations
14041402
1403+ member __.SymbolEnv = cenv
1404+
14051405 override __.ToString () = " TypeCheckInfo(" + mainInputFileName + " )"
14061406
14071407type FSharpParsingOptions =
@@ -2084,7 +2084,7 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
20842084 threadSafeOp
20852085 ( fun () -> [| |])
20862086 ( fun scope ->
2087- let cenv = SymbolEnv ( scope.TcGlobals , scope.ThisCcu , Some scope.CcuSigForFile , scope.TcImports )
2087+ let cenv = scope.SymbolEnv
20882088 [| for symbolUse in scope.ScopeSymbolUses.AllUsesOfSymbols do
20892089 if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then
20902090 let symbol = FSharpSymbol.Create( cenv, symbolUse.Item)
@@ -2129,7 +2129,7 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
21292129 member info.OpenDeclarations =
21302130 scopeOptX
21312131 |> Option.map ( fun scope ->
2132- let cenv = SymbolEnv ( scope.TcGlobals , scope.ThisCcu , Some scope.CcuSigForFile , scope.TcImports )
2132+ let cenv = scope.SymbolEnv
21332133 scope.OpenDeclarations |> Array.map ( fun x -> FSharpOpenDeclaration( x.LongId, x.Range, ( x.Modules |> List.map ( fun x -> FSharpEntity( cenv, x))), x.AppliedScope, x.IsOwnNamespace)))
21342134 |> Option.defaultValue [| |]
21352135
0 commit comments