File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed
test/refactoring/RefactoringKind Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -1684,16 +1684,25 @@ bool RefactoringActionCollapseNestedIfExpr::performChange() {
1684
1684
}
1685
1685
1686
1686
static std::unique_ptr<llvm::SetVector<Expr*>>
1687
- findConcatenatedExpressions (ResolvedRangeInfo Info, ASTContext &Ctx) {
1688
- if (Info.Kind != RangeKind::SingleExpression
1689
- && Info.Kind != RangeKind::PartOfExpression)
1690
- return nullptr ;
1687
+ findConcatenatedExpressions (ResolvedRangeInfo Info, ASTContext &Ctx) {
1688
+ Expr *E = nullptr ;
1691
1689
1692
- // FIXME: We should always have a valid node.
1693
- if (Info.ContainedNodes .empty ())
1690
+ switch (Info.Kind ) {
1691
+ case RangeKind::SingleExpression:
1692
+ // FIXME: the range info kind should imply non-empty list.
1693
+ if (!Info.ContainedNodes .empty ())
1694
+ E = Info.ContainedNodes [0 ].get <Expr*>();
1695
+ else
1696
+ return nullptr ;
1697
+ break ;
1698
+ case RangeKind::PartOfExpression:
1699
+ E = Info.CommonExprParent ;
1700
+ break ;
1701
+ default :
1694
1702
return nullptr ;
1703
+ }
1695
1704
1696
- Expr *E = Info. ContainedNodes [ 0 ]. get <Expr*>( );
1705
+ assert (E );
1697
1706
1698
1707
struct StringInterpolationExprFinder : public SourceEntityWalker {
1699
1708
std::unique_ptr<llvm::SetVector<Expr*>> Bucket = llvm::
Original file line number Diff line number Diff line change
1
+ // rdar://36755861
2
+ func doit( _: ( ) -> ( ) ) { }
3
+ struct S { }
4
+ func foo( ) {
5
+ doit {
6
+ let s = S ( )
7
+ }
8
+ }
9
+
10
+ // RUN: %refactor -source-filename %s -pos=6:5 -end-pos=6:13 | %FileCheck %s -check-prefix=CHECK1
11
+ // CHECK1: Action begins
You can’t perform that action at this time.
0 commit comments