| 2879 | } |
| 2880 | |
| 2881 | static bool scopesMatch(const std::string &scope1, const std::string &scope2, const ScopeInfo3 *globalScope) |
| 2882 | { |
| 2883 | if (scope1.empty() || scope2.empty()) |
| 2884 | return false; |
| 2885 | |
| 2886 | // check if scopes match |
| 2887 | if (scope1 == scope2) |
| 2888 | return true; |
| 2889 | |
| 2890 | // check if scopes only differ by global qualification |
| 2891 | if (scope1 == (":: " + scope2)) { |
| 2892 | std::string::size_type end = scope2.find_first_of(' '); |
| 2893 | if (end == std::string::npos) |
| 2894 | end = scope2.size(); |
| 2895 | if (globalScope->hasChild(scope2.substr(0, end))) |
| 2896 | return true; |
| 2897 | } else if (scope2 == (":: " + scope1)) { |
| 2898 | std::string::size_type end = scope1.find_first_of(' '); |
| 2899 | if (end == std::string::npos) |
| 2900 | end = scope1.size(); |
| 2901 | if (globalScope->hasChild(scope1.substr(0, end))) |
| 2902 | return true; |
| 2903 | } |
| 2904 | |
| 2905 | return false; |
| 2906 | } |
| 2907 | |
| 2908 | static unsigned int tokDistance(const Token* tok1, const Token* tok2) { // use when index() is not available yet |
| 2909 | unsigned int dist = 0; |
no test coverage detected