@@ -190,13 +190,6 @@ class SyntacticElementTarget {
190190 ConstraintLocator *convertTypeLocator,
191191 bool isDiscarded);
192192
193- SyntacticElementTarget (Expr *expr, DeclContext *dc, ExprPattern *pattern,
194- Type patternType)
195- : SyntacticElementTarget(expr, dc, CTP_ExprPattern, patternType,
196- /* isDiscarded=*/ false ) {
197- setPattern (pattern);
198- }
199-
200193 SyntacticElementTarget (ClosureExpr *closure, Type convertType) {
201194 kind = Kind::closure;
202195 this ->closure .closure = closure;
@@ -296,11 +289,8 @@ class SyntacticElementTarget {
296289 forPropertyWrapperInitializer (VarDecl *wrappedVar, DeclContext *dc,
297290 Expr *initializer);
298291
299- static SyntacticElementTarget forExprPattern (Expr *expr, DeclContext *dc,
300- ExprPattern *pattern,
301- Type patternTy) {
302- return {expr, dc, pattern, patternTy};
303- }
292+ // / Form a target for the match expression of an ExprPattern.
293+ static SyntacticElementTarget forExprPattern (ExprPattern *pattern);
304294
305295 // / This is useful for code completion.
306296 ASTNode getAsASTNode () const {
@@ -781,11 +771,13 @@ class SyntacticElementTarget {
781771
782772 // For an initialization, include the pattern in the range too.
783773 if (isForInitialization ()) {
784- if (auto patternRange = getInitializationPattern ()->getSourceRange ()) {
785- if (range.isInvalid ()) {
786- range = patternRange;
787- } else {
788- range.widen (patternRange);
774+ if (auto *pattern = getInitializationPattern ()) {
775+ if (auto patternRange = pattern->getSourceRange ()) {
776+ if (range.isInvalid ()) {
777+ range = patternRange;
778+ } else {
779+ range.widen (patternRange);
780+ }
789781 }
790782 }
791783 }
0 commit comments