| 1922 | } |
| 1923 | |
| 1924 | bool BfAutoComplete::CheckMemberReference(BfAstNode* target, BfAstNode* dotToken, BfAstNode* memberName, bool onlyShowTypes, BfType* expectingType, bool isUsingDirective, bool onlyAttribute) |
| 1925 | { |
| 1926 | if (!WantsEntries()) |
| 1927 | return false; |
| 1928 | |
| 1929 | BfAttributedIdentifierNode* attrIdentifier = NULL; |
| 1930 | bool isAutocompletingName = false; |
| 1931 | if ((attrIdentifier = BfNodeDynCast<BfAttributedIdentifierNode>(memberName))) |
| 1932 | { |
| 1933 | memberName = attrIdentifier->mIdentifier; |
| 1934 | if (IsAutocompleteNode(attrIdentifier->mAttributes)) |
| 1935 | { |
| 1936 | auto bfParser = attrIdentifier->mAttributes->GetSourceData()->ToParser(); |
| 1937 | int cursorIdx = bfParser->mCursorIdx; |
| 1938 | if (cursorIdx == attrIdentifier->mAttributes->GetSrcEnd()) |
| 1939 | isAutocompletingName = true; |
| 1940 | else |
| 1941 | return false; |
| 1942 | } |
| 1943 | } |
| 1944 | |
| 1945 | if (memberName != NULL) |
| 1946 | isAutocompletingName = IsAutocompleteNode(dotToken, memberName, 0, 1); |
| 1947 | |
| 1948 | if ((IsAutocompleteNode(dotToken, 0, 1)) || (isAutocompletingName)) |
| 1949 | { |
| 1950 | BfLogSys(mModule->mSystem, "Triggered autocomplete\n"); |
| 1951 | |
| 1952 | bool isFriend = false; |
| 1953 | |
| 1954 | mInsertStartIdx = dotToken->GetSrcEnd(); |
| 1955 | if (attrIdentifier != NULL) |
| 1956 | { |
| 1957 | BfAttributeState attributeState; |
| 1958 | attributeState.mTarget = (BfAttributeTargets)(BfAttributeTargets_MemberAccess | BfAttributeTargets_Invocation); |
| 1959 | attributeState.mCustomAttributes = mModule->GetCustomAttributes(attrIdentifier->mAttributes, attributeState.mTarget); |
| 1960 | if ((attributeState.mCustomAttributes != NULL) && (attributeState.mCustomAttributes->Contains(mModule->mCompiler->mFriendAttributeTypeDef))) |
| 1961 | { |
| 1962 | isFriend = true; |
| 1963 | attributeState.mUsed = true; |
| 1964 | } |
| 1965 | |
| 1966 | mInsertStartIdx = attrIdentifier->mAttributes->GetSrcEnd(); |
| 1967 | } |
| 1968 | |
| 1969 | if (memberName != NULL) |
| 1970 | { |
| 1971 | //Member name MAY be incorrectly identified in cases like: |
| 1972 | // val._ |
| 1973 | // OtherCall(); |
| 1974 | int cursorIdx = GetCursorIdx(memberName); |
| 1975 | if ((cursorIdx != -1) && (cursorIdx >= memberName->GetSrcStart())) |
| 1976 | mInsertStartIdx = memberName->GetSrcStart(); |
| 1977 | } |
| 1978 | |
| 1979 | SetAndRestoreValue<bool> prevFriendSet(mHasFriendSet, mHasFriendSet || isFriend); |
| 1980 | |
| 1981 | String filter; |
no test coverage detected