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

Commit9922147

Browse files
auduchinokKevinRansom
authored andcommitted
Remove subsequent list filtering in name resolution (dotnet#5678)
1 parent36f6957 commit9922147

File tree

1 file changed

+44
-38
lines changed

1 file changed

+44
-38
lines changed

‎src/fsharp/NameResolution.fs‎

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3691,9 +3691,10 @@ let InfosForTyconConstructors (ncenv:NameResolver) m ad (tcref:TyconRef) =
36913691
| Item.CtorGroup(nm,ctorInfos)->
36923692
letctors=
36933693
ctorInfos
3694-
|> List.filter(IsMethInfoAccessible amap m ad)
3695-
|> List.filter(MethInfoIsUnseen g m ty>>not)
3696-
match ctorswith
3694+
|> List.filter(fun minfo->
3695+
IsMethInfoAccessible amap m ad minfo&&
3696+
not(MethInfoIsUnseen g m ty minfo))
3697+
match ctorswith
36973698
|[]->[]
36983699
|_->[Item.MakeCtorGroup(nm,ctors)]
36993700
| item->
@@ -3761,9 +3762,9 @@ let rec ResolvePartialLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv is
37613762
match plidwith
37623763
|[]->
37633764
lettycons=
3764-
mty.TypeDefinitions
3765-
|> List.filter(fun tcref->not(tcref.LogicalName.Contains(",")))
3766-
|> List.filter(fun tycon->not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconReftycon)))
3765+
mty.TypeDefinitions|> List.filter(fun tcref->
3766+
not(tcref.LogicalName.Contains(","))&&
3767+
not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconReftcref)))
37673768

37683769
letaccessibleSubModules=
37693770
letmoduleOrNamespaces=
@@ -3779,16 +3780,16 @@ let rec ResolvePartialLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv is
37793780
letdemangledName= x.DemangledModuleOrNamespaceName
37803781
notFakeContainerModule ilTyconNames demangledName&& IsInterestingModuleName demangledName)
37813782
|> List.map modref.NestedTyconRef
3782-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
3783-
|> List.filter(EntityRefContainsSomethingAccessible ncenv m ad)
3783+
|> List.filter(fun tyref->
3784+
not(IsTyconUnseen ad g ncenv.amap m tyref)&&
3785+
EntityRefContainsSomethingAccessible ncenv m ad tyref)
37843786
|> List.map ItemForModuleOrNamespaceRef
37853787

37863788
// Collect up the accessible values in the module, excluding the members
37873789
(mty.AllValsAndMembers
37883790
|> Seq.toList
37893791
|> List.choose(TryMkValRefInModRef modref)// if the assembly load set is incomplete and we get a None value here, then ignore the value
3790-
|> List.filter(fun v->not v.IsMember)
3791-
|> List.filter(IsValUnseen ad g m>>not)
3792+
|> List.filter(fun vref->not vref.IsMember&&not(IsValUnseen ad g m vref))
37923793
|> List.map Item.Value)
37933794

37943795
// Collect up the accessible discriminated union cases in the module
@@ -3910,18 +3911,19 @@ let rec ResolvePartialLongIdentPrim (ncenv: NameResolver) (nenv: NameResolutionE
39103911
letilTyconNames= getFakeContainerModulesFromTyconRefs(nenv.TyconsByAccessNames(fullyQualified).Values)
39113912

39123913
moduleOrNamespaceRefs
3913-
|> List.filter(funx->
3914-
letdemangledName=x.DemangledModuleOrNamespaceName
3915-
IsInterestingModuleName demangledName&& notFakeContainerModule ilTyconNames demangledName)
3916-
|> List.filter(EntityRefContainsSomethingAccessible ncenv m ad)
3917-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
3914+
|> List.filter(funmodref->
3915+
letdemangledName=modref.DemangledModuleOrNamespaceName
3916+
IsInterestingModuleName demangledName&& notFakeContainerModule ilTyconNames demangledName&&
3917+
EntityRefContainsSomethingAccessible ncenv m ad modref&&
3918+
not(IsTyconUnseen ad g ncenv.amap mmodref))
39183919
|> List.map ItemForModuleOrNamespaceRef
39193920

39203921
lettycons=
39213922
nenv.TyconsByDemangledNameAndArity(fullyQualified).Values
3922-
|> List.filter(fun tcref->not(tcref.LogicalName.Contains(",")))
3923-
|> List.filter(fun tcref->not tcref.IsExceptionDecl)
3924-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
3923+
|> List.filter(fun tcref->
3924+
not(tcref.LogicalName.Contains(","))&&
3925+
not tcref.IsExceptionDecl&&
3926+
not(IsTyconUnseen ad g ncenv.amap m tcref))
39253927
|> List.map(ItemOfTyconRef ncenv m)
39263928

39273929
// Get all the constructors accessible from here
@@ -3979,9 +3981,10 @@ let rec ResolvePartialLongIdentInModuleOrNamespaceForRecordFields (ncenv: NameRe
39793981
// get record type constructors
39803982
lettycons=
39813983
mty.TypeDefinitions
3982-
|> List.filter(fun tcref->not(tcref.LogicalName.Contains(",")))
3983-
|> List.filter(fun tycon-> tycon.IsRecordTycon)
3984-
|> List.filter(fun tycon->not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconRef tycon)))
3984+
|> List.filter(fun tcref->
3985+
not(tcref.LogicalName.Contains(","))&&
3986+
tcref.IsRecordTycon&&
3987+
not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconRef tcref)))
39853988

39863989

39873990
letaccessibleSubModules=
@@ -3994,12 +3997,13 @@ let rec ResolvePartialLongIdentInModuleOrNamespaceForRecordFields (ncenv: NameRe
39943997
letilTyconNames= getFakeContainerModulesFromTycons mty.TypesByAccessNames.Values
39953998

39963999
moduleOrNamespaces
3997-
|> List.filter(fun x->
4000+
|> List.filter(fun x->
39984001
letdemangledName= x.DemangledModuleOrNamespaceName
39994002
notFakeContainerModule ilTyconNames demangledName&& IsInterestingModuleName demangledName)
40004003
|> List.map modref.NestedTyconRef
4001-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
4002-
|> List.filter(EntityRefContainsSomethingAccessible ncenv m ad)
4004+
|> List.filter(fun tcref->
4005+
not(IsTyconUnseen ad g ncenv.amap m tcref)&&
4006+
EntityRefContainsSomethingAccessible ncenv m ad tcref)
40034007
|> List.map ItemForModuleOrNamespaceRef
40044008

40054009
accessibleSubModules
@@ -4066,18 +4070,19 @@ and ResolvePartialLongIdentToClassOrRecdFieldsImpl (ncenv: NameResolver) (nenv:
40664070
letilTyconNames= getFakeContainerModulesFromTyconRefs(nenv.TyconsByAccessNames(fullyQualified).Values)
40674071

40684072
moduleOrNamespaceRefs
4069-
|> List.filter(funx->
4070-
letdemangledName=x.DemangledModuleOrNamespaceName
4071-
IsInterestingModuleName demangledName&& notFakeContainerModule ilTyconNames demangledName)
4072-
|> List.filter(EntityRefContainsSomethingAccessible ncenv m ad)
4073-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
4073+
|> List.filter(funmodref->
4074+
letdemangledName=modref.DemangledModuleOrNamespaceName
4075+
IsInterestingModuleName demangledName&& notFakeContainerModule ilTyconNames demangledName&&
4076+
EntityRefContainsSomethingAccessible ncenv m ad modref&&
4077+
not(IsTyconUnseen ad g ncenv.amap mmodref))
40744078
|> List.map ItemForModuleOrNamespaceRef
40754079

40764080
letrecdTyCons=
40774081
nenv.TyconsByDemangledNameAndArity(fullyQualified).Values
4078-
|> List.filter(fun tcref->not(tcref.LogicalName.Contains(",")))
4079-
|> List.filter(fun tcref-> tcref.IsRecordTycon)
4080-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
4082+
|> List.filter(fun tcref->
4083+
not(tcref.LogicalName.Contains(","))&&
4084+
tcref.IsRecordTycon&&
4085+
not(IsTyconUnseen ad g ncenv.amap m tcref))
40814086
|> List.map(ItemOfTyconRef ncenv m)
40824087

40834088
letrecdFields=
@@ -4343,8 +4348,7 @@ let rec ResolvePartialLongIdentInModuleOrNamespaceForItem (ncenv: NameResolver)
43434348
mty.AllValsAndMembers
43444349
|> Seq.toList
43454350
|> List.choose(TryMkValRefInModRef modref)// if the assembly load set is incomplete and we get a None value here, then ignore the value
4346-
|> List.filter(fun v->not v.IsMember)
4347-
|> List.filter(IsValUnseen ad g m>>not)
4351+
|> List.filter(fun vref->not vref.IsMember&&not(IsValUnseen ad g m vref))
43484352
|> List.map Item.Value
43494353
| Item.UnionCase_->
43504354
// Collect up the accessible discriminated union cases in the module
@@ -4384,14 +4388,16 @@ let rec ResolvePartialLongIdentInModuleOrNamespaceForItem (ncenv: NameResolver)
43844388
letdemangledName= x.DemangledModuleOrNamespaceName
43854389
notFakeContainerModule ilTyconNames demangledName&& IsInterestingModuleName demangledName)
43864390
|> List.map modref.NestedTyconRef
4387-
|> List.filter(IsTyconUnseen ad g ncenv.amap m>>not)
4388-
|> List.filter(EntityRefContainsSomethingAccessible ncenv m ad)
4391+
|> List.filter(fun tcref->
4392+
not(IsTyconUnseen ad g ncenv.amap m tcref)&&
4393+
EntityRefContainsSomethingAccessible ncenv m ad tcref)
43894394
|> List.map ItemForModuleOrNamespaceRef
43904395

43914396
lettycons=
43924397
mty.TypeDefinitions
4393-
|> List.filter(fun tcref->not(tcref.LogicalName.Contains(",")))
4394-
|> List.filter(fun tycon->not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconRef tycon)))
4398+
|> List.filter(fun tcref->
4399+
not(tcref.LogicalName.Contains(","))&&
4400+
not(IsTyconUnseen ad g ncenv.amap m(modref.NestedTyconRef tcref)))
43954401

43964402
// Get all the types and .NET constructor groups accessible from here
43974403
letnestedTycons= tycons|> List.map modref.NestedTyconRef

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp