mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text in the following ways: - I had to introduce a FunctionArrowPrecedence to capture the parsing of -> in expression contexts. - I found it convenient to continue to model the assignment property explicitly. - The comparison and casting operators have historically been non-associative; I have chosen to preserve that, since I don't think this proposal intended to change it. - This uses the precedence group names and higherThan/lowerThan as agreed in discussion.
This commit is contained in:
@@ -592,6 +592,8 @@ CodeCompletionResult::getCodeCompletionDeclKind(const Decl *D) {
|
||||
return CodeCompletionDeclKind::PrefixOperatorFunction;
|
||||
case DeclKind::PostfixOperator:
|
||||
return CodeCompletionDeclKind::PostfixOperatorFunction;
|
||||
case DeclKind::PrecedenceGroup:
|
||||
return CodeCompletionDeclKind::PrecedenceGroup;
|
||||
case DeclKind::EnumElement:
|
||||
return CodeCompletionDeclKind::EnumElement;
|
||||
case DeclKind::Subscript:
|
||||
@@ -672,6 +674,9 @@ void CodeCompletionResult::print(raw_ostream &OS) const {
|
||||
case CodeCompletionDeclKind::Module:
|
||||
Prefix.append("[Module]");
|
||||
break;
|
||||
case CodeCompletionDeclKind::PrecedenceGroup:
|
||||
Prefix.append("[PrecedenceGroup]");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ResultKind::Keyword:
|
||||
@@ -5398,6 +5403,7 @@ void swift::ide::copyCodeCompletionResults(CodeCompletionResultSink &targetSink,
|
||||
if (R->getKind() != CodeCompletionResult::Declaration)
|
||||
return false;
|
||||
switch(R->getAssociatedDeclKind()) {
|
||||
case CodeCompletionDeclKind::PrecedenceGroup:
|
||||
case CodeCompletionDeclKind::Module:
|
||||
case CodeCompletionDeclKind::Class:
|
||||
case CodeCompletionDeclKind::Struct:
|
||||
|
||||
Reference in New Issue
Block a user