Skip to content

Commit fdf1882

Browse files
committed
SILParser: Remove some dead code
1 parent 9d4062a commit fdf1882

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace {
168168
GenericEnvironment *GenericEnv,
169169
GenericParamList *GenericParams);
170170

171-
void convertRequirements(SILFunction *F, ArrayRef<RequirementRepr> From,
171+
void convertRequirements(ArrayRef<RequirementRepr> From,
172172
SmallVectorImpl<Requirement> &To);
173173

174174
ProtocolConformanceRef parseProtocolConformanceHelper(
@@ -845,49 +845,19 @@ static bool parseSILOptional(bool &Result, SILParser &SP, StringRef Expected) {
845845
return false;
846846
}
847847

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-
871848
/// Remap RequirementReps to Requirements.
872-
void SILParser::convertRequirements(SILFunction *F,
873-
ArrayRef<RequirementRepr> From,
849+
void SILParser::convertRequirements(ArrayRef<RequirementRepr> From,
874850
SmallVectorImpl<Requirement> &To) {
875851
if (From.empty()) {
876852
To.clear();
877853
return;
878854
}
879855

880-
auto *GenericEnv = F->getGenericEnvironment();
881-
assert(GenericEnv);
882-
(void)GenericEnv;
883-
884-
IdentTypeReprLookup PerformLookup(P);
885856
// Use parser lexical scopes to resolve references
886857
// to the generic parameters.
887858
auto ResolveToInterfaceType = [&](TypeRepr *TyR) -> Type {
888-
TyR->walk(PerformLookup);
889859
return performTypeResolution(TyR, /*IsSILType=*/false,
890-
ContextGenericEnv, nullptr)
860+
ContextGenericEnv, ContextGenericParams)
891861
->mapTypeOutOfContext();
892862
};
893863

@@ -5792,8 +5762,7 @@ bool SILParserState::parseDeclSIL(Parser &P) {
57925762
for (auto &Attr : SpecAttrs) {
57935763
SmallVector<Requirement, 2> requirements;
57945764
// Resolve types and convert requirements.
5795-
FunctionState.convertRequirements(FunctionState.F,
5796-
Attr.requirements, requirements);
5765+
FunctionState.convertRequirements(Attr.requirements, requirements);
57975766
auto *fenv = FunctionState.F->getGenericEnvironment();
57985767
auto genericSig = evaluateOrDefault(
57995768
P.Context.evaluator,

0 commit comments

Comments
 (0)