Skip to content

RangeInfo: Rework the criterion for valid selection of multiple statements, i.e. they should have a common brace statement as parent. #8129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 16, 2017

Conversation

nkcsgexi
Copy link
Contributor

Suggested by @jrose-apple .

…rt or the end of multi-statement selections. (#8092)"

This reverts commit ed56e49.
…ments, i.e. they should have a common brace statement as parent.
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@@ -320,6 +320,11 @@ static bool hasUnhandledError(ArrayRef<ASTNode> Nodes) {
});
}

static bool
hasNodeThat(ArrayRef<ASTNode> Nodes, llvm::function_ref<bool(ASTNode)> Pred) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is any_of in STLExtras.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean llvm::any_of is just your hasNodeThat with generics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, I still prefer it extracted to avoid typing begin() and end().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm::any_of(StartMatches, IsCase). It's the same thing you have now.


// Multi-statement should have a common parent of brace statement, this
// can be implicit brace statement, e.g. in case statement.
if (Parent.isStmt(StmtKind::Brace))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the part that checks if they're all the same parent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is implied in ContextInfo; they won't end up here if they are not siblings.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi nkcsgexi merged commit 1ef97c0 into swiftlang:master Mar 16, 2017
@nkcsgexi nkcsgexi deleted the rework-multi-statement branch March 16, 2017 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants