@@ -600,20 +600,20 @@ class CodeCompletionResult {
600
600
};
601
601
602
602
enum NotRecommendedReason {
603
- Redundant,
603
+ None = 0 ,
604
+ RedundantImport,
604
605
Deprecated,
605
- InvalidContext ,
606
+ InvalidAsyncContext ,
606
607
CrossActorReference,
607
- NoReason ,
608
+ VariableUsedInOwnDefinition ,
608
609
};
609
610
610
611
private:
611
612
unsigned Kind : 3 ;
612
613
unsigned AssociatedKind : 8 ;
613
614
unsigned KnownOperatorKind : 6 ;
614
615
unsigned SemanticContext : 3 ;
615
- unsigned NotRecommended : 1 ;
616
- unsigned NotRecReason : 3 ;
616
+ unsigned NotRecommended : 4 ;
617
617
unsigned IsSystem : 1 ;
618
618
619
619
// / The number of bytes to the left of the code completion point that
@@ -644,11 +644,9 @@ class CodeCompletionResult {
644
644
CodeCompletionOperatorKind::None,
645
645
StringRef BriefDocComment = StringRef())
646
646
: Kind(Kind), KnownOperatorKind(unsigned (KnownOperatorKind)),
647
- SemanticContext (unsigned (SemanticContext)), NotRecommended(false ),
648
- NotRecReason(NotRecommendedReason::NoReason),
647
+ SemanticContext (unsigned (SemanticContext)), NotRecommended(None),
649
648
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
650
- BriefDocComment(BriefDocComment),
651
- TypeDistance(TypeDistance) {
649
+ BriefDocComment(BriefDocComment), TypeDistance(TypeDistance) {
652
650
assert (Kind != Declaration && " use the other constructor" );
653
651
assert (CompletionString);
654
652
if (isOperator () && KnownOperatorKind == CodeCompletionOperatorKind::None)
@@ -670,8 +668,7 @@ class CodeCompletionResult {
670
668
ExpectedTypeRelation TypeDistance,
671
669
StringRef BriefDocComment = StringRef())
672
670
: Kind(Keyword), KnownOperatorKind(0 ),
673
- SemanticContext(unsigned (SemanticContext)), NotRecommended(false ),
674
- NotRecReason(NotRecommendedReason::NoReason),
671
+ SemanticContext(unsigned (SemanticContext)), NotRecommended(None),
675
672
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
676
673
BriefDocComment(BriefDocComment), TypeDistance(TypeDistance) {
677
674
assert (CompletionString);
@@ -688,8 +685,7 @@ class CodeCompletionResult {
688
685
CodeCompletionString *CompletionString,
689
686
ExpectedTypeRelation TypeDistance)
690
687
: Kind(Literal), KnownOperatorKind(0 ),
691
- SemanticContext(unsigned (SemanticContext)), NotRecommended(false ),
692
- NotRecReason(NotRecommendedReason::NoReason),
688
+ SemanticContext(unsigned (SemanticContext)), NotRecommended(None),
693
689
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
694
690
TypeDistance(TypeDistance) {
695
691
AssociatedKind = static_cast <unsigned >(LiteralKind);
@@ -706,19 +702,17 @@ class CodeCompletionResult {
706
702
unsigned NumBytesToErase,
707
703
CodeCompletionString *CompletionString,
708
704
const Decl *AssociatedDecl, StringRef ModuleName,
709
- bool NotRecommended,
710
705
CodeCompletionResult::NotRecommendedReason NotRecReason,
711
706
StringRef BriefDocComment,
712
707
ArrayRef<StringRef> AssociatedUSRs,
713
708
ArrayRef<std::pair<StringRef, StringRef>> DocWords,
714
709
enum ExpectedTypeRelation TypeDistance)
715
710
: Kind(ResultKind::Declaration), KnownOperatorKind(0 ),
716
711
SemanticContext(unsigned (SemanticContext)),
717
- NotRecommended(NotRecommended), NotRecReason(NotRecReason),
718
- NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
719
- ModuleName(ModuleName), BriefDocComment(BriefDocComment),
720
- AssociatedUSRs(AssociatedUSRs), DocWords(DocWords),
721
- TypeDistance(TypeDistance) {
712
+ NotRecommended(NotRecReason), NumBytesToErase(NumBytesToErase),
713
+ CompletionString(CompletionString), ModuleName(ModuleName),
714
+ BriefDocComment(BriefDocComment), AssociatedUSRs(AssociatedUSRs),
715
+ DocWords(DocWords), TypeDistance(TypeDistance) {
722
716
assert (AssociatedDecl && " should have a decl" );
723
717
AssociatedKind = unsigned (getCodeCompletionDeclKind (AssociatedDecl));
724
718
IsSystem = getDeclIsSystem (AssociatedDecl);
@@ -735,7 +729,7 @@ class CodeCompletionResult {
735
729
unsigned NumBytesToErase,
736
730
CodeCompletionString *CompletionString,
737
731
CodeCompletionDeclKind DeclKind, bool IsSystem,
738
- StringRef ModuleName, bool NotRecommended,
732
+ StringRef ModuleName,
739
733
CodeCompletionResult::NotRecommendedReason NotRecReason,
740
734
StringRef BriefDocComment,
741
735
ArrayRef<StringRef> AssociatedUSRs,
@@ -745,11 +739,11 @@ class CodeCompletionResult {
745
739
: Kind(ResultKind::Declaration),
746
740
KnownOperatorKind(unsigned (KnownOperatorKind)),
747
741
SemanticContext(unsigned (SemanticContext)),
748
- NotRecommended(NotRecommended ), NotRecReason(NotRecReason ),
749
- IsSystem(IsSystem ), NumBytesToErase(NumBytesToErase ),
750
- CompletionString(CompletionString ), ModuleName(ModuleName ),
751
- BriefDocComment(BriefDocComment ), AssociatedUSRs(AssociatedUSRs ),
752
- DocWords(DocWords), TypeDistance(TypeDistance) {
742
+ NotRecommended(NotRecReason ), IsSystem(IsSystem ),
743
+ NumBytesToErase(NumBytesToErase ), CompletionString(CompletionString ),
744
+ ModuleName(ModuleName ), BriefDocComment(BriefDocComment ),
745
+ AssociatedUSRs(AssociatedUSRs ), DocWords(DocWords ),
746
+ TypeDistance(TypeDistance) {
753
747
AssociatedKind = static_cast <unsigned >(DeclKind);
754
748
assert (CompletionString);
755
749
assert (!isOperator () ||
@@ -800,16 +794,14 @@ class CodeCompletionResult {
800
794
}
801
795
802
796
NotRecommendedReason getNotRecommendedReason () const {
803
- return static_cast <NotRecommendedReason>(NotRecReason );
797
+ return static_cast <NotRecommendedReason>(NotRecommended );
804
798
}
805
799
806
800
SemanticContextKind getSemanticContext () const {
807
801
return static_cast <SemanticContextKind>(SemanticContext);
808
802
}
809
803
810
- bool isNotRecommended () const {
811
- return NotRecommended;
812
- }
804
+ bool isNotRecommended () const { return NotRecommended != None; }
813
805
814
806
unsigned getNumBytesToErase () const {
815
807
return NumBytesToErase;
0 commit comments