Skip to content

Commit ed097f8

Browse files
author
David Ungar
committed
Compute instead of store trailing angle bracket location.
1 parent 6164f5b commit ed097f8

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

include/swift/AST/Expr.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,19 +4666,16 @@ class UnresolvedPatternExpr : public Expr {
46664666
class EditorPlaceholderExpr : public Expr {
46674667
Identifier Placeholder;
46684668
SourceLoc Loc;
4669-
SourceLoc TrailingAngleBracketLoc;
46704669
TypeLoc PlaceholderTy;
46714670
TypeRepr *ExpansionTyR;
46724671
Expr *SemanticExpr;
46734672

46744673
public:
46754674
EditorPlaceholderExpr(Identifier Placeholder, SourceLoc Loc,
4676-
SourceLoc TrailingAngleBracketLoc,
46774675
TypeLoc PlaceholderTy,
46784676
TypeRepr *ExpansionTyR)
46794677
: Expr(ExprKind::EditorPlaceholder, /*Implicit=*/false),
46804678
Placeholder(Placeholder), Loc(Loc),
4681-
TrailingAngleBracketLoc(TrailingAngleBracketLoc),
46824679
PlaceholderTy(PlaceholderTy),
46834680
ExpansionTyR(ExpansionTyR),
46844681
SemanticExpr(nullptr) {
@@ -4689,7 +4686,7 @@ class EditorPlaceholderExpr : public Expr {
46894686
TypeLoc &getTypeLoc() { return PlaceholderTy; }
46904687
TypeLoc getTypeLoc() const { return PlaceholderTy; }
46914688
SourceLoc getTrailingAngleBracketLoc() const {
4692-
return TrailingAngleBracketLoc;
4689+
return Loc.getAdvancedLoc(Placeholder.getLength() - 1);
46934690
}
46944691

46954692
/// The TypeRepr to be considered for placeholder expansion.

lib/Parse/ParseExpr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,6 @@ Expr *Parser::parseExprEditorPlaceholder(Token PlaceholderTok,
23852385
parseTypeForPlaceholder(TyLoc, ExpansionTyR);
23862386
return new (Context) EditorPlaceholderExpr(PlaceholderId,
23872387
PlaceholderTok.getLoc(),
2388-
PlaceholderTok.getRange().getEnd(),
23892388
TyLoc, ExpansionTyR);
23902389
}
23912390

test/Parse/source_locs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ func string_interpolation() {
77

88
// RUN: not %target-swift-frontend -dump-ast %s | %FileCheck %s
99
// CHECK: (interpolated_string_literal_expr {{.*}} trailing_quote_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:4:12 {{.*}}
10-
// CHECK: (editor_placeholder_expr type='()' {{.*}} trailing_angle_bracket_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:5:10
10+
// CHECK: (editor_placeholder_expr type='()' {{.*}} trailing_angle_bracket_loc=SOURCE_DIR{{/|\\}}test{{/|\\}}Parse{{/|\\}}source_locs.swift:5:9
1111

0 commit comments

Comments
 (0)