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 @@ -1686,16 +1686,25 @@ bool RefactoringActionCollapseNestedIfExpr::performChange() {
1686
1686
}
1687
1687
1688
1688
static std::unique_ptr<llvm::SetVector<Expr*>>
1689
- findConcatenatedExpressions (ResolvedRangeInfo Info, ASTContext &Ctx) {
1690
- if (Info.Kind != RangeKind::SingleExpression
1691
- && Info.Kind != RangeKind::PartOfExpression)
1692
- return nullptr ;
1689
+ findConcatenatedExpressions (ResolvedRangeInfo Info, ASTContext &Ctx) {
1690
+ Expr *E = nullptr ;
1693
1691
1694
- // FIXME: We should always have a valid node.
1695
- if (Info.ContainedNodes .empty ())
1692
+ switch (Info.Kind ) {
1693
+ case RangeKind::SingleExpression:
1694
+ // FIXME: the range info kind should imply non-empty list.
1695
+ if (!Info.ContainedNodes .empty ())
1696
+ E = Info.ContainedNodes [0 ].get <Expr*>();
1697
+ else
1698
+ return nullptr ;
1699
+ break ;
1700
+ case RangeKind::PartOfExpression:
1701
+ E = Info.CommonExprParent ;
1702
+ break ;
1703
+ default :
1696
1704
return nullptr ;
1705
+ }
1697
1706
1698
- Expr *E = Info. ContainedNodes [ 0 ]. get <Expr*>( );
1707
+ assert (E );
1699
1708
1700
1709
struct StringInterpolationExprFinder : public SourceEntityWalker {
1701
1710
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