Skip to content

Commit d21fad5

Browse files
author
Nathan Hawes
authored
Merge pull request #27338 from nathawes/r55045797-image-literal-syntax-map-5.1-08_28
[5.1 08-28][IDE] Fix ModelASTWalker passing syntax nodes before the corresponding AST nodes had been visited
2 parents 7cddeb8 + 569e464 commit d21fad5

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/IDE/SyntaxModel.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,7 @@ std::pair<bool, Expr *> ModelASTWalker::walkToExprPre(Expr *E) {
513513
SN.BodyRange = innerCharSourceRangeFromSourceRange(SM, E->getSourceRange());
514514
pushStructureNode(SN, E);
515515
} else if (auto *Tup = dyn_cast<TupleExpr>(E)) {
516-
if (isCurrentCallArgExpr(Tup)) {
517-
for (unsigned I = 0; I < Tup->getNumElements(); ++ I) {
518-
SourceLoc NameLoc = Tup->getElementNameLoc(I);
519-
if (NameLoc.isValid())
520-
passTokenNodesUntil(NameLoc, PassNodesBehavior::ExcludeNodeAtLocation);
521-
}
522-
} else {
516+
if (!isCurrentCallArgExpr(Tup)) {
523517
SyntaxStructureNode SN;
524518
SN.Kind = SyntaxStructureKind::TupleExpression;
525519
SN.Range = charSourceRangeFromSourceRange(SM, Tup->getSourceRange());

test/IDE/coloring.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ func bar(x: Int) -> (Int, Float) {
264264

265265
// CHECK: <object-literal>#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)</object-literal>
266266
#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
267+
// CHECK: test(<object-literal>#imageLiteral(resourceName: "test")</object-literal>, test: <int>0</int>)
268+
test(#imageLiteral(resourceName: "test"), test: 0)
267269

268270
class GenC<T1,T2> {}
269271

0 commit comments

Comments
 (0)