Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code #353

Closed
wants to merge 14 commits into from
47 changes: 0 additions & 47 deletions src/fsharp/lib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -383,53 +383,6 @@ type Graph<'Data, 'Id when 'Id : comparison and 'Id : equality>
else List.iter (trace (node.nodeData::path)) node.nodeNeighbours
List.iter (fun node -> trace [] node) nodes

#if OLDCODE

member g.DepthFirstSearch() =
let grey = ref Set.empty
let time = ref 0
let forest = ref []
let backEdges = ref []
let discoveryTimes = ref Map.empty
let finishingTimes = ref Map.empty
nodes |> List.iter (fun n ->
// build a dfsTree for each node in turn
let treeEdges = ref []
let rec visit n1 =
incr time;
grey := Set.add n1.nodeId !grey;
discoveryTimes := Map.add n1.nodeId !time !discoveryTimes;
for n2 in n1.nodeNeighbours do
if not ((!grey).Contains n2.nodeId) then
treeEdges := (n1.nodeId,n2.nodeId) :: !treeEdges;
visit(n2)
else
backEdges := (n1.nodeId,n2.nodeId) :: !backEdges
incr time;
finishingTimes := Map.add n1.nodeId !time !finishingTimes;
()
if not ((!grey).Contains n.nodeId) then
visit(n);
forest := (n.nodeId,!treeEdges) :: !forest);

!forest, !backEdges, (fun n -> (!discoveryTimes).[n]), (fun n -> (!finishingTimes).[n])


// Present strongly connected components, in dependency order
// Each node is assumed to have a self-edge
member g.GetTopologicalSortStronglyConnectedComponents() =
let forest, backEdges, discoveryTimes, finishingTimes = g.DepthFirstSearch()
let nodeIds = List.map (fun n -> n.nodeId) nodes
let nodesInDecreasingFinishingOrder =
List.sortWith (fun n1 n2 -> -(compare (finishingTimes n1) (finishingTimes n2))) nodeIds
let gT = Graph (nodeIdentity, List.map g.GetNodeData nodesInDecreasingFinishingOrder, List.map (fun (x,y) -> (g.GetNodeData y, g.GetNodeData x)) edges)
let forest, backEdges, discoveryTimes, finishingTimes = gT.DepthFirstSearch()
let scc (root,tree) = Set.add root (List.foldBack (fun (n1,n2) acc -> Set.add n1 (Set.add n2 acc)) tree Set.empty)
let sccs = List.rev (List.map scc forest)
List.map (Set.toList >> List.map g.GetNodeData) sccs
#endif


//---------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly

// In some cases we play games where we use 'null' as a more efficient representation
// in F#. The functions below are used to give initial values to mutable fields.
Expand Down
29 changes: 0 additions & 29 deletions src/fsharp/vs/ServiceDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,6 @@ module internal ItemDescriptionsImpl =

// Format the supertypes and other useful information about a type to a buffer
let OutputUsefulTypeInfo _isDeclInfo (_infoReader:InfoReader) _m _denv _os _ty = ()
#if DISABLED
if false then
ErrorScope.ProtectAndDiscard m (fun () ->
let g = infoReader.g
let amap = infoReader.amap
let supertypes =
let supertypes = AllSuperTypesOfType g amap m AllowMultiIntfInstantiations.Yes ty
let supertypes = supertypes |> List.filter (AccessibilityLogic.IsTypeAccessible g AccessibleFromSomewhere)
let supertypes = supertypes |> List.filter (typeEquiv g g.obj_ty >> not)
let selfs,supertypes = supertypes |> List.partition (typeEquiv g ty)
let supertypesC,supertypesI = supertypes |> List.partition (isInterfaceTy g)
let supertypes = selfs @ supertypesC @ supertypesI
supertypes
let supertypeLs,_ = NicePrint.layoutPrettifiedTypes denv supertypes
// Suppress printing supertypes for enums, delegates, exceptions and attributes
if supertypes.Length > 1 // more then self
&& not (isEnumTy g ty)
&& not (isUnionTy g ty)
&& not (isRecdTy g ty)
&& not (isDelegateTy g ty)
&& not (ExistsHeadTypeInEntireHierarchy g amap m ty g.exn_tcr)
&& not (ExistsHeadTypeInEntireHierarchy g amap m ty g.tcref_System_Attribute) then
bprintf os "\n\n";
List.zip supertypes supertypeLs |> List.iter (fun (superty,supertyL) ->
if typeEquiv g superty ty then bprintf os " %s: %a\n" (FSComp.SR.typeInfoType()) bufferL supertyL
elif isClassTy g superty || isInterfaceTy g ty then bprintf os " %s: %a\n" (FSComp.SR.typeInfoInherits()) bufferL supertyL
else bprintf os " %s: %a\n" (FSComp.SR.typeInfoImplements()) bufferL supertyL))
#endif


let rangeOfPropInfo (pinfo:PropInfo) =
match pinfo with
Expand Down
29 changes: 0 additions & 29 deletions src/utils/sformat.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,31 +1112,6 @@ namespace Microsoft.FSharp.Text.StructuredFormat
// pprinter: leafFormatter
// --------------------------------------------------------------------

#if Suggestion4299
// See bug 4299. Suppress FSI_dddd+<etc> from fsi printer.
let fixupForInteractiveFSharpClassesWithNoToString obj (text:string) =
// Given obj:T.
// If T is a nested type inside a parent type called FSI_dddd, then it looks like an F# Interactive type.
// Further, if the .ToString() text starts with "FSI_dddd+T" then it looks like it's the default ToString.
// A better test: it is default ToString if the MethodInfo.DeclaringType is System.Object.
// In this case, replace "FSI_dddd+T" by "T".
// assert(obj <> null)
let fullName = obj.GetType().FullName // e.g. "FSI_0123+Name"
let name = obj.GetType().Name // e.g. "Name"
let T = obj.GetType()
if text.StartsWith(fullName) then
// text could be a default .ToString() since it starts with the FullName of the type. More checks...
if T.IsNested &&
T.DeclaringType.Name.StartsWith("FSI_") && // Name has "FSI_" which is
T.DeclaringType.Name.Substring(4) |> Seq.forall System.Char.IsDigit // followed by digits?
then
name ^ text.Substring(fullName.Length) // replace fullName by name at start of text
else
text
else
text
#endif

let leafFormatter (opts:FormatOptions) (obj :obj) =
match obj with
| null -> "null"
Expand Down Expand Up @@ -1172,10 +1147,6 @@ namespace Microsoft.FSharp.Text.StructuredFormat
| :? bool as b -> (if b then "true" else "false")
| :? char as c -> "\'" + formatChar true c + "\'"
| _ -> try let text = obj.ToString()
//Suggestion4299. Not yet fixed.
//#if COMPILER
// let text = fixupForInteractiveFSharpClassesWithNoToString obj text
//#endif
text
with e ->
// If a .ToString() call throws an exception, catch it and use the message as the result.
Expand Down
36 changes: 0 additions & 36 deletions vsintegration/src/Salsa/VsMocks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,39 +1222,6 @@ module internal VsMocks =
member this.UnadviseFileChange(vscookie) = nothing()
}

#if NOT_YET_NEEDED
let vsExtensibility3 =
{ new IVsExtensibility3 with
member this.GetProperties(pParent, pdispPropObj, ppProperties) = err(__LINE__)
member this.RunWizardFile(bstrWizFilename, hwndOwner, vContextParams, pResult) = err(__LINE__)
member this.EnterAutomationFunction() = err(__LINE__)
member this.ExitAutomationFunction() = err(__LINE__)
member this.IsInAutomationFunction(pfInAutoFunc) = err(__LINE__)
member this.GetUserControl( fUserControl) = err(__LINE__)
member this.SetUserControl( fUserControl) = err(__LINE__)
member this.SetUserControlUnlatched( fUserControl) = err(__LINE__)
member this.LockServer( vb) = err(__LINE__)
member this.GetLockCount( pCount) = err(__LINE__)
member this.TestForShutdown( fShutdown) = err(__LINE__)
member this.GetGlobalsObject( extractFrom, ppGlobals) = err(__LINE__)
member this.GetConfigMgr( pIVsProject, itemid, ppCfgMgr) = err(__LINE__)
member this.FireMacroReset() = err(__LINE__)
member this.GetDocumentFromDocCookie( lDocCookie, ppDoc) = err(__LINE__)
member this.IsMethodDisabled( pGUID, dispid) = err(__LINE__)
member this. SetSuppressUI( In) = err(__LINE__)
member this.GetSuppressUI( pOut) = err(__LINE__)
member this.FireProjectsEvent_ItemAdded( project) = err(__LINE__)
member this.FireProjectsEvent_ItemRemoved( project) = err(__LINE__)
member this.FireProjectsEvent_ItemRenamed( project, oldName) = err(__LINE__)
member this.FireProjectItemsEvent_ItemAdded( projectItem) = err(__LINE__)
member this.FireProjectItemsEvent_ItemRemoved( projectItem) = err(__LINE__)
member this.FireProjectItemsEvent_ItemRenamed( projectItem, oldName) = err(__LINE__)
member this.IsFireCodeModelEventNeeded( vbNeeded) = err(__LINE__)
member this.RunWizardFileEx( bstrWizFilename, hwndOwner, vContextParams, vCustomParams, pResult) = err(__LINE__)
member this.FireCodeModelEvent3( dispid, pParent, pElement, changeKind) = err(__LINE__)
}
#endif

let vsSolution =
{ new IVsSolution with
member x.GetProjectEnum(grfEnumFlags, rguidEnumOnlyThisType, ppenum) = err(__LINE__)
Expand Down Expand Up @@ -1566,9 +1533,6 @@ module internal VsMocks =
sp.AddService(typeof<SVsTaskList>, box(vsTaskList()), false)
sp.AddService(typeof<SVsShellMonitorSelection>, box vsMonitorSelection, false)
sp.AddService(typeof<SVsFileChangeEx>, box vsFileChangeManager, false)
#if NOT_YET_NEEDED
sp.AddService(typeof<EnvDTE.IVsExtensibility>, box vsExtensibility3, false)
#endif
sp.AddService(typeof<SVsSolution>, box vsSolution, false)
sp.AddService(typeof<SVsSolutionBuildManager>, box vsSolutionBuildManager, false)
sp.AddService(typeof<SVsRunningDocumentTable>, box vsRunningDocumentTable, false)
Expand Down
Loading