@@ -920,7 +920,6 @@ namespace {
920
920
ConstraintSystem &CS;
921
921
DeclContext *CurDC;
922
922
ConstraintSystemPhase CurrPhase;
923
- SmallVector<DeclContext*, 4 > DCStack;
924
923
925
924
static const unsigned numEditorPlaceholderVariables = 2 ;
926
925
@@ -1131,25 +1130,10 @@ namespace {
1131
1130
1132
1131
virtual ~ConstraintGenerator () {
1133
1132
CS.setPhase (CurrPhase);
1134
- // We really ought to have this assertion:
1135
- // assert(DCStack.empty() && CurDC == CS.DC);
1136
- // Unfortunately, ASTWalker is really bad at letting us establish
1137
- // invariants like this because walkToExprPost isn't called if
1138
- // something early-aborts the walk.
1139
1133
}
1140
1134
1141
1135
ConstraintSystem &getConstraintSystem () const { return CS; }
1142
1136
1143
- void enterClosure (ClosureExpr *closure) {
1144
- DCStack.push_back (CurDC);
1145
- CurDC = closure;
1146
- }
1147
-
1148
- void exitClosure (ClosureExpr *closure) {
1149
- assert (CurDC == closure);
1150
- CurDC = DCStack.pop_back_val ();
1151
- }
1152
-
1153
1137
virtual Type visitErrorExpr (ErrorExpr *E) {
1154
1138
// FIXME: Can we do anything with error expressions at this point?
1155
1139
return nullptr ;
@@ -2141,40 +2125,6 @@ namespace {
2141
2125
return FunctionType::get (closureParams, resultTy, extInfo);
2142
2126
}
2143
2127
2144
- // / Give each parameter in a ClosureExpr a fresh type variable if parameter
2145
- // / types were not specified, and return the eventual function type.
2146
- void getClosureParams (ClosureExpr *closureExpr,
2147
- SmallVectorImpl<AnyFunctionType::Param> ¶ms) {
2148
- auto *paramList = closureExpr->getParameters ();
2149
- unsigned i = 0 ;
2150
-
2151
- for (auto *param : *paramList) {
2152
- auto *locator = CS.getConstraintLocator (
2153
- closureExpr, LocatorPathElt::TupleElement (i++));
2154
- Type paramType, internalType;
2155
-
2156
- // If a type was explicitly specified, use its opened type.
2157
- if (param->getTypeRepr ()) {
2158
- paramType = closureExpr->mapTypeIntoContext (param->getInterfaceType ());
2159
- // FIXME: Need a better locator for a pattern as a base.
2160
- paramType = CS.openUnboundGenericType (paramType, locator);
2161
- internalType = paramType;
2162
- } else {
2163
- // Otherwise, create fresh type variables.
2164
- paramType = CS.createTypeVariable (locator,
2165
- TVO_CanBindToInOut |
2166
- TVO_CanBindToNoEscape);
2167
- internalType = CS.createTypeVariable (locator,
2168
- TVO_CanBindToLValue |
2169
- TVO_CanBindToNoEscape);
2170
- CS.addConstraint (ConstraintKind::BindParam, paramType, internalType,
2171
- locator);
2172
- }
2173
- CS.setType (param, internalType);
2174
- params.push_back (param->toFunctionParam (paramType));
2175
- }
2176
- }
2177
-
2178
2128
// / Produces a type for the given pattern, filling in any missing
2179
2129
// / type information with fresh type variables.
2180
2130
// /
0 commit comments