| 2939 | } |
| 2940 | |
| 2941 | void BfAutoComplete::CheckMethod(BfMethodDeclaration* methodDeclaration, bool isLocalMethod) |
| 2942 | { |
| 2943 | if (/*(propertyDeclaration->mDefinitionBlock == NULL) &&*/ (methodDeclaration->mVirtualSpecifier != NULL) && |
| 2944 | (methodDeclaration->mVirtualSpecifier->GetToken() == BfToken_Override)) |
| 2945 | { |
| 2946 | auto bfParser = methodDeclaration->mVirtualSpecifier->GetSourceData()->ToParser(); |
| 2947 | if (bfParser == NULL) |
| 2948 | return; |
| 2949 | int cursorIdx = bfParser->mCursorIdx; |
| 2950 | |
| 2951 | bool isInTypeRef = IsAutocompleteNode(methodDeclaration->mReturnType); |
| 2952 | bool isInNameNode = IsAutocompleteNode(methodDeclaration->mNameNode); |
| 2953 | |
| 2954 | if (((IsAutocompleteNode(methodDeclaration, 1)) && (cursorIdx == methodDeclaration->mVirtualSpecifier->GetSrcEnd())) || |
| 2955 | (isInTypeRef) || (isInNameNode)) |
| 2956 | { |
| 2957 | if (mIsAutoComplete) |
| 2958 | { |
| 2959 | mInsertStartIdx = methodDeclaration->GetSrcStart(); |
| 2960 | mInsertEndIdx = methodDeclaration->GetSrcEnd(); |
| 2961 | if (methodDeclaration->mBody != NULL) |
| 2962 | { |
| 2963 | if (methodDeclaration->mBody->mTriviaStart != -1) |
| 2964 | mInsertEndIdx = methodDeclaration->mBody->mTriviaStart; |
| 2965 | else |
| 2966 | mInsertEndIdx = methodDeclaration->mBody->GetSrcStart(); |
| 2967 | } |
| 2968 | } |
| 2969 | |
| 2970 | String filter; |
| 2971 | if ((isInNameNode || isInTypeRef)) |
| 2972 | { |
| 2973 | if (methodDeclaration->mNameNode != NULL) |
| 2974 | filter = methodDeclaration->mNameNode->ToString(); |
| 2975 | else if (methodDeclaration->mReturnType != NULL) |
| 2976 | filter = methodDeclaration->mReturnType->ToString(); |
| 2977 | } |
| 2978 | else if (methodDeclaration->mBody != NULL) |
| 2979 | { |
| 2980 | // We're just inside 'override' - we may be inserting a new method |
| 2981 | mInsertEndIdx = methodDeclaration->mVirtualSpecifier->GetSrcEnd(); |
| 2982 | } |
| 2983 | |
| 2984 | AddOverrides(filter); |
| 2985 | } |
| 2986 | } |
| 2987 | |
| 2988 | if (auto ctorDeclaration = BfNodeDynCast<BfConstructorDeclaration>(methodDeclaration)) |
| 2989 | { |
| 2990 | if ((ctorDeclaration->mThisToken != NULL) && (ctorDeclaration->mOpenParen == NULL)) |
| 2991 | { |
| 2992 | auto bfParser = ctorDeclaration->mThisToken->GetSourceData()->ToParser(); |
| 2993 | if (bfParser == NULL) |
| 2994 | return; |
| 2995 | int cursorIdx = bfParser->mCursorIdx; |
| 2996 | |
| 2997 | if ((IsAutocompleteNode(methodDeclaration, 1)) && (cursorIdx == ctorDeclaration->mThisToken->GetSrcEnd())) |
| 2998 | { |
no test coverage detected