Skip to content

Commit e75e3fe

Browse files
committed
Changed the PatternBinding StmtConditionElement start/end loc to call getSourceRange instead
1 parent 3c7a17e commit e75e3fe

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

lib/AST/Stmt.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,7 @@ SourceLoc StmtConditionElement::getStartLoc() const {
326326
case StmtConditionElement::CK_Availability:
327327
return getAvailability()->getStartLoc();
328328
case StmtConditionElement::CK_PatternBinding:
329-
SourceLoc Start;
330-
if (IntroducerLoc.isValid())
331-
Start = IntroducerLoc;
332-
else
333-
Start = getPattern()->getStartLoc();
334-
335-
SourceLoc End = getInitializer()->getEndLoc();
336-
if (Start.isValid() && End.isValid()) {
337-
return Start;
338-
} else {
339-
return SourceLoc();
340-
}
329+
return getSourceRange().Start;
341330
}
342331
}
343332

@@ -348,18 +337,7 @@ SourceLoc StmtConditionElement::getEndLoc() const {
348337
case StmtConditionElement::CK_Availability:
349338
return getAvailability()->getEndLoc();
350339
case StmtConditionElement::CK_PatternBinding:
351-
SourceLoc Start;
352-
if (IntroducerLoc.isValid())
353-
Start = IntroducerLoc;
354-
else
355-
Start = getPattern()->getStartLoc();
356-
357-
SourceLoc End = getInitializer()->getEndLoc();
358-
if (Start.isValid() && End.isValid()) {
359-
return End;
360-
} else {
361-
return SourceLoc();
362-
}
340+
return getSourceRange().End;
363341
}
364342
}
365343

0 commit comments

Comments
 (0)