Skip to content

Commit 3104e3f

Browse files
committed
[AST] Fix CaseStmt's getStartLoc
The body range may be valid; change `getStartLoc` to fall back to the body's start loc to match `getEndLoc`.
1 parent 2f27865 commit 3104e3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/swift/AST/Stmt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,9 @@ class CaseStmt final
13051305
SourceLoc getStartLoc() const {
13061306
if (UnknownAttrLoc.isValid())
13071307
return UnknownAttrLoc;
1308-
return getLoc();
1308+
if (ItemIntroducerLoc.isValid())
1309+
return ItemIntroducerLoc;
1310+
return getBody()->getStartLoc();
13091311
}
13101312
SourceLoc getEndLoc() const { return getBody()->getEndLoc(); }
13111313

0 commit comments

Comments
 (0)