@@ -168,7 +168,7 @@ namespace {
168
168
GenericEnvironment *GenericEnv,
169
169
GenericParamList *GenericParams);
170
170
171
- void convertRequirements (SILFunction *F, ArrayRef<RequirementRepr> From,
171
+ void convertRequirements (ArrayRef<RequirementRepr> From,
172
172
SmallVectorImpl<Requirement> &To);
173
173
174
174
ProtocolConformanceRef parseProtocolConformanceHelper (
@@ -845,49 +845,19 @@ static bool parseSILOptional(bool &Result, SILParser &SP, StringRef Expected) {
845
845
return false ;
846
846
}
847
847
848
- namespace {
849
- // FIXME: Nuke this.
850
-
851
- // / A helper class to perform lookup of IdentTypes in the
852
- // / current parser scope.
853
- class IdentTypeReprLookup : public ASTWalker {
854
- Parser &P;
855
- public:
856
- IdentTypeReprLookup (Parser &P) : P(P) {}
857
-
858
- bool walkToTypeReprPre (TypeRepr *Ty) override {
859
- auto *T = dyn_cast_or_null<IdentTypeRepr>(Ty);
860
- auto Comp = T->getComponentRange ().front ();
861
- if (auto Entry = P.lookupInScope (Comp->getNameRef ()))
862
- if (auto *TD = dyn_cast<TypeDecl>(Entry)) {
863
- Comp->setValue (TD, nullptr );
864
- return false ;
865
- }
866
- return true ;
867
- }
868
- };
869
- } // end anonymous namespace
870
-
871
848
// / Remap RequirementReps to Requirements.
872
- void SILParser::convertRequirements (SILFunction *F,
873
- ArrayRef<RequirementRepr> From,
849
+ void SILParser::convertRequirements (ArrayRef<RequirementRepr> From,
874
850
SmallVectorImpl<Requirement> &To) {
875
851
if (From.empty ()) {
876
852
To.clear ();
877
853
return ;
878
854
}
879
855
880
- auto *GenericEnv = F->getGenericEnvironment ();
881
- assert (GenericEnv);
882
- (void )GenericEnv;
883
-
884
- IdentTypeReprLookup PerformLookup (P);
885
856
// Use parser lexical scopes to resolve references
886
857
// to the generic parameters.
887
858
auto ResolveToInterfaceType = [&](TypeRepr *TyR) -> Type {
888
- TyR->walk (PerformLookup);
889
859
return performTypeResolution (TyR, /* IsSILType=*/ false ,
890
- ContextGenericEnv, nullptr )
860
+ ContextGenericEnv, ContextGenericParams )
891
861
->mapTypeOutOfContext ();
892
862
};
893
863
@@ -5792,8 +5762,7 @@ bool SILParserState::parseDeclSIL(Parser &P) {
5792
5762
for (auto &Attr : SpecAttrs) {
5793
5763
SmallVector<Requirement, 2 > requirements;
5794
5764
// Resolve types and convert requirements.
5795
- FunctionState.convertRequirements (FunctionState.F ,
5796
- Attr.requirements , requirements);
5765
+ FunctionState.convertRequirements (Attr.requirements , requirements);
5797
5766
auto *fenv = FunctionState.F ->getGenericEnvironment ();
5798
5767
auto genericSig = evaluateOrDefault (
5799
5768
P.Context .evaluator ,
0 commit comments