Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite146709

Browse files
Vasily KirichenkoVasily Kirichenko
Vasily Kirichenko
authored and
Vasily Kirichenko
committed
remove unused code
1 parent6085f0b commite146709

File tree

6 files changed

+22
-327
lines changed

6 files changed

+22
-327
lines changed

‎src/fsharp/symbols/SymbolPatterns.fs‎

Lines changed: 1 addition & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -209,223 +209,4 @@ module Symbol =
209209
if func.IsExtensionMemberthen Some()else None
210210

211211
let(|Event|_|)(func:FSharpMemberOrFunctionOrValue)=
212-
if func.IsEventthen Some()else None
213-
214-
/// Active patterns over `FSharpSymbolUse`.
215-
[<RequireQualifiedAccess>]
216-
moduleSymbolUse=
217-
218-
let(|ActivePatternCase|_|)(symbol:FSharpSymbolUse)=
219-
match symbol.Symbolwith
220-
|:? FSharpActivePatternCaseas ap-> ActivePatternCase(ap)|> Some
221-
|_-> None
222-
223-
letprivateattributeSuffixLength="Attribute".Length
224-
225-
let(|Entity|_|)(symbol:FSharpSymbolUse):(FSharpEntity*(* cleanFullNames*) string list)option=
226-
match symbol.Symbolwith
227-
|:? FSharpEntityas ent->
228-
// strip generic parameters count suffix (List`1 => List)
229-
letcleanFullName=
230-
// `TryFullName` for type aliases is always `None`, so we have to make one by our own
231-
if ent.IsFSharpAbbreviationthen
232-
[ent.AccessPath+"."+ ent.DisplayName]
233-
else
234-
ent.TryFullName
235-
|> Option.toList
236-
|> List.map(fun fullName->
237-
if ent.GenericParameters.Count>0&& fullName.Length>2then
238-
fullName.[0..fullName.Length-3]
239-
else fullName)
240-
241-
letcleanFullNames=
242-
cleanFullName
243-
|> List.collect(fun cleanFullName->
244-
if ent.IsAttributeTypethen
245-
[cleanFullName; cleanFullName.[0..cleanFullName.Length- attributeSuffixLength-1]]
246-
else[cleanFullName]
247-
)
248-
Some(ent, cleanFullNames)
249-
|_-> None
250-
251-
let(|Field|_|)(symbol:FSharpSymbolUse)=
252-
match symbol.Symbolwith
253-
|:? FSharpFieldas field-> Some field
254-
|_-> None
255-
256-
let(|GenericParameter|_|)(symbol:FSharpSymbolUse)=
257-
match symbol.Symbolwith
258-
|:? FSharpGenericParameteras gp-> Some gp
259-
|_-> None
260-
261-
let(|MemberFunctionOrValue|_|)(symbol:FSharpSymbolUse)=
262-
match symbol.Symbolwith
263-
|:? FSharpMemberOrFunctionOrValueas func-> Some func
264-
|_-> None
265-
266-
let(|ActivePattern|_|)=function
267-
| MemberFunctionOrValue mwhen m.IsActivePattern-> Some m|_-> None
268-
269-
let(|Parameter|_|)(symbol:FSharpSymbolUse)=
270-
match symbol.Symbolwith
271-
|:? FSharpParameteras param-> Some param
272-
|_-> None
273-
274-
let(|StaticParameter|_|)(symbol:FSharpSymbolUse)=
275-
match symbol.Symbolwith
276-
|:? FSharpStaticParameteras sp-> Some sp
277-
|_-> None
278-
279-
let(|UnionCase|_|)(symbol:FSharpSymbolUse)=
280-
match symbol.Symbolwith
281-
|:? FSharpUnionCaseas uc-> Some uc
282-
|_-> None
283-
284-
let(|Constructor|_|)=function
285-
| MemberFunctionOrValue funcwhen func.IsConstructor|| func.IsImplicitConstructor-> Some func
286-
|_-> None
287-
288-
let(|TypeAbbreviation|_|)=function
289-
| Entity(entity,_)when entity.IsFSharpAbbreviation-> Some entity
290-
|_-> None
291-
292-
let(|Class|_|)=function
293-
| Entity(entity,_)when entity.IsClass-> Some entity
294-
| Entity(entity,_)when entity.IsFSharp&&
295-
entity.IsOpaque&&
296-
not entity.IsFSharpModule&&
297-
not entity.IsNamespace&&
298-
not entity.IsDelegate&&
299-
not entity.IsFSharpUnion&&
300-
not entity.IsFSharpRecord&&
301-
not entity.IsInterface&&
302-
not entity.IsValueType-> Some entity
303-
|_-> None
304-
305-
let(|Delegate|_|)=function
306-
| Entity(entity,_)when entity.IsDelegate-> Some entity
307-
|_-> None
308-
309-
let(|Event|_|)=function
310-
| MemberFunctionOrValue symbolwhen symbol.IsEvent-> Some symbol
311-
|_-> None
312-
313-
let(|Property|_|)=function
314-
| MemberFunctionOrValue symbolwhen symbol.IsProperty|| symbol.IsPropertyGetterMethod|| symbol.IsPropertySetterMethod-> Some symbol
315-
|_-> None
316-
317-
let inlineprivatenotCtorOrProp(symbol:FSharpMemberOrFunctionOrValue)=
318-
not symbol.IsConstructor&&not symbol.IsPropertyGetterMethod&&not symbol.IsPropertySetterMethod
319-
320-
typeFSharpSymbolwith
321-
memberx.IsOperatorOrActivePattern=
322-
letname= x.DisplayName
323-
if name.StartsWith"("&& name.EndsWith" )"&& name.Length>4
324-
then name.Substring(2, name.Length-4)|> String.forall(fun c-> c<>' ')
325-
elsefalse
326-
327-
typeFSharpMemberOrFunctionOrValuewith
328-
memberx.FullTypeSafe=try Some x.FullTypewith_-> None
329-
330-
let(|Method|_|)(symbolUse:FSharpSymbolUse)=
331-
match symbolUsewith
332-
| MemberFunctionOrValue symbolwhen
333-
symbol.IsModuleValueOrMember&&
334-
not symbolUse.IsFromPattern&&
335-
not symbol.IsOperatorOrActivePattern&&
336-
not symbol.IsPropertyGetterMethod&&
337-
not symbol.IsPropertySetterMethod-> Some symbol
338-
|_-> None
339-
340-
let(|Function|_|)(symbolUse:FSharpSymbolUse)=
341-
match symbolUsewith
342-
| MemberFunctionOrValue symbolwhen
343-
notCtorOrProp symbol&&
344-
symbol.IsModuleValueOrMember&&
345-
not symbol.IsOperatorOrActivePattern&&
346-
not symbolUse.IsFromPattern->
347-
348-
match symbol.FullTypeSafewith
349-
| Some fullTypewhen fullType.IsFunctionType-> Some symbol
350-
|_-> None
351-
|_-> None
352-
353-
let(|Operator|_|)(symbolUse:FSharpSymbolUse)=
354-
match symbolUsewith
355-
| MemberFunctionOrValue symbolwhen
356-
notCtorOrProp symbol&&
357-
not symbolUse.IsFromPattern&&
358-
not symbol.IsActivePattern&&
359-
symbol.IsOperatorOrActivePattern->
360-
361-
match symbol.FullTypeSafewith
362-
| Some fullTypewhen fullType.IsFunctionType-> Some symbol
363-
|_-> None
364-
|_-> None
365-
366-
let(|Pattern|_|)(symbolUse:FSharpSymbolUse)=
367-
match symbolUsewith
368-
| MemberFunctionOrValue symbolwhen
369-
notCtorOrProp symbol&&
370-
not symbol.IsOperatorOrActivePattern&&
371-
symbolUse.IsFromPattern->
372-
373-
match symbol.FullTypeSafewith
374-
| Some fullTypewhen fullType.IsFunctionType-> Some symbol
375-
|_-> None
376-
|_-> None
377-
378-
let(|ClosureOrNestedFunction|_|)=function
379-
| MemberFunctionOrValue symbolwhen
380-
notCtorOrProp symbol&&
381-
not symbol.IsOperatorOrActivePattern&&
382-
not symbol.IsModuleValueOrMember->
383-
384-
match symbol.FullTypeSafewith
385-
| Some fullTypewhen fullType.IsFunctionType-> Some symbol
386-
|_-> None
387-
|_-> None
388-
389-
let(|Val|_|)=function
390-
| MemberFunctionOrValue symbolwhen notCtorOrProp symbol&&
391-
not symbol.IsOperatorOrActivePattern->
392-
match symbol.FullTypeSafewith
393-
| Some_fullType-> Some symbol
394-
|_-> None
395-
|_-> None
396-
397-
let(|Enum|_|)=function
398-
| Entity(entity,_)when entity.IsEnum-> Some entity
399-
|_-> None
400-
401-
let(|Interface|_|)=function
402-
| Entity(entity,_)when entity.IsInterface-> Some entity
403-
|_-> None
404-
405-
let(|Module|_|)=function
406-
| Entity(entity,_)when entity.IsFSharpModule-> Some entity
407-
|_-> None
408-
409-
let(|Namespace|_|)=function
410-
| Entity(entity,_)when entity.IsNamespace-> Some entity
411-
|_-> None
412-
413-
let(|Record|_|)=function
414-
| Entity(entity,_)when entity.IsFSharpRecord-> Some entity
415-
|_-> None
416-
417-
let(|Union|_|)=function
418-
| Entity(entity,_)when entity.IsFSharpUnion-> Some entity
419-
|_-> None
420-
421-
let(|ValueType|_|)=function
422-
| Entity(entity,_)when entity.IsValueType&&not entity.IsEnum-> Some entity
423-
|_-> None
424-
425-
let(|ComputationExpression|_|)(symbol:FSharpSymbolUse)=
426-
if symbol.IsFromComputationExpressionthen Some symbol
427-
else None
428-
429-
let(|Attribute|_|)=function
430-
| Entity(entity,_)when entity.IsAttributeType-> Some entity
431-
|_-> None
212+
if func.IsEventthen Some()else None

‎src/fsharp/symbols/SymbolPatterns.fsi‎

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,41 +53,4 @@ module internal Symbol =
5353
val(|Constructor|_|): FSharpMemberOrFunctionOrValue-> FSharpEntity option
5454
val(|Function|_|): excluded: bool-> FSharpMemberOrFunctionOrValue-> unit option
5555
val(|ExtensionMember|_|): FSharpMemberOrFunctionOrValue-> unit option
56-
val(|Event|_|): FSharpMemberOrFunctionOrValue-> unit option
57-
58-
[<RequireQualifiedAccess>]
59-
#if COMPILER_PUBLIC_API
60-
module SymbolUse=
61-
#else
62-
moduleinternalSymbolUse=
63-
#endif
64-
val(|ActivePatternCase|_|):FSharpSymbolUse->FSharpActivePatternCase option
65-
val(|Entity|_|):FSharpSymbolUse->(FSharpEntity*(* cleanFullNames*)string list)option
66-
val(|Field|_|):FSharpSymbolUse->FSharpField option
67-
val(|GenericParameter|_|):FSharpSymbolUse->FSharpGenericParameter option
68-
val(|MemberFunctionOrValue|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
69-
val(|ActivePattern|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
70-
val(|Parameter|_|):FSharpSymbolUse->FSharpParameter option
71-
val(|StaticParameter|_|):FSharpSymbolUse->FSharpStaticParameter option
72-
val(|UnionCase|_|):FSharpSymbolUse->FSharpUnionCase option
73-
val(|Constructor|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
74-
val(|TypeAbbreviation|_|):FSharpSymbolUse->FSharpEntity option
75-
val(|Class|_|):FSharpSymbolUse->FSharpEntity option
76-
val(|Delegate|_|):FSharpSymbolUse->FSharpEntity option
77-
val(|Event|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
78-
val(|Property|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
79-
val(|Method|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
80-
val(|Function|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
81-
val(|Operator|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
82-
val(|Pattern|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
83-
val(|ClosureOrNestedFunction|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
84-
val(|Val|_|):FSharpSymbolUse->FSharpMemberOrFunctionOrValue option
85-
val(|Enum|_|):FSharpSymbolUse->FSharpEntity option
86-
val(|Interface|_|):FSharpSymbolUse->FSharpEntity option
87-
val(|Module|_|):FSharpSymbolUse->FSharpEntity option
88-
val(|Namespace|_|):FSharpSymbolUse->FSharpEntity option
89-
val(|Record|_|):FSharpSymbolUse->FSharpEntity option
90-
val(|Union|_|):FSharpSymbolUse->FSharpEntity option
91-
val(|ValueType|_|):FSharpSymbolUse->FSharpEntity option
92-
val(|ComputationExpression|_|):FSharpSymbolUse->FSharpSymbolUse option
93-
val(|Attribute|_|):FSharpSymbolUse->FSharpEntity option
56+
val(|Event|_|): FSharpMemberOrFunctionOrValue-> unit option

‎src/fsharp/vs/ServiceAnalysis.fs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ module UnusedOpens =
1111

1212
/// Represents single open statement.
1313
typeOpenStatement=
14-
{ Modules:FSharpEntity list
14+
{/// All modules which this open declaration effectively opens, including all auto open ones, recursively.
15+
Modules:FSharpEntity list
1516
/// Range of open statement itself.
1617
Range:range
1718
/// Scope on which this open declaration is applied.
@@ -28,7 +29,7 @@ module UnusedOpens =
2829
for rfin ent.FSharpFieldsdo
2930
yieldupcast rf
3031

31-
if ent.IsFSharpUnion&&not(hasAttribute<RequireQualifiedAccessAttribute> ent.Attributes)then
32+
if ent.IsFSharpUnion&&not(Symbol.hasAttribute<RequireQualifiedAccessAttribute> ent.Attributes)then
3233
for unionCasein ent.UnionCasesdo
3334
yieldupcast unionCase
3435

@@ -42,7 +43,7 @@ module UnusedOpens =
4243
let recgetModuleAndItsAutoOpens(modul:FSharpEntity)=
4344
[yield modul
4445
for entin modul.NestedEntitiesdo
45-
if ent.IsFSharpModule&& hasAttribute<AutoOpenAttribute> ent.Attributesthen
46+
if ent.IsFSharpModule&&Symbol.hasAttribute<AutoOpenAttribute> ent.Attributesthen
4647
yield! getModuleAndItsAutoOpens ent]
4748

4849
letgetOpenStatements(openDeclarations:FSharpOpenDeclaration list):OpenStatement list=
@@ -72,7 +73,7 @@ module UnusedOpens =
7273

7374
letgetUnusedOpens(checkFileResults:FSharpCheckFileResults,getSourceLineStr:int->string):Async<rangelist>=
7475

75-
letfilter(openStatements:OpenStatement list)(symbolUses:FSharpSymbolUse[]):OpenStatement list=
76+
letfilterOpenStatements(openStatements:OpenStatement list)(symbolUses:FSharpSymbolUse[]):OpenStatement list=
7677
let recfilterInner acc(openStatements:OpenStatement list)(seenOpenStatements:OpenStatement list)=
7778

7879
letisUsed(openStatement:OpenStatement)=
@@ -84,9 +85,8 @@ module UnusedOpens =
8485
letinScope= rangeContainsRange openStatement.AppliedScope symbolUse.RangeAlternate
8586
ifnot inScopethenfalse
8687
else
87-
letmoduleSymbols= openStatement.AllChildSymbols|> Seq.toList
88-
moduleSymbols
89-
|> List.exists(fun x-> x.IsEffectivelySameAs symbolUse.Symbol))
88+
openStatement.AllChildSymbols
89+
|> Seq.exists(fun x-> x.IsEffectivelySameAs symbolUse.Symbol))
9090

9191
ifnot usedSomewherethenfalse
9292
else
@@ -112,5 +112,5 @@ module UnusedOpens =
112112
let!symbolUses= checkFileResults.GetAllUsesOfAllSymbolsInFile()
113113
letsymbolUses= filterSymbolUses getSourceLineStr symbolUses
114114
letopenStatements= getOpenStatements checkFileResults.OpenDeclarations
115-
returnfilter openStatements symbolUses|> List.map(fun os-> os.Range)
115+
returnfilterOpenStatements openStatements symbolUses|> List.map(fun os-> os.Range)
116116
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp