@@ -1117,19 +1117,23 @@ bool exprDependsOnThis(const Token* expr, bool onVar, nonneg int depth)
11171117 ++depth;
11181118
11191119 // calling nonstatic method?
1120- if (Token::Match (expr, " %name% (" ) && expr->function () && expr->function ()->nestedIn && expr->function ()->nestedIn ->isClassOrStruct () && !expr->function ()->isStatic ()) {
1121- // is it a method of this?
1122- const Scope* fScope = expr->scope ();
1123- while (!fScope ->functionOf && fScope ->nestedIn )
1124- fScope = fScope ->nestedIn ;
1125-
1126- const Scope* classScope = fScope ->functionOf ;
1127- if (classScope && classScope->function )
1128- classScope = classScope->function ->token ->scope ();
1129-
1130- if (classScope && classScope->isClassOrStruct ())
1131- return contains (classScope->findAssociatedScopes (), expr->function ()->nestedIn );
1132- return false ;
1120+ if (Token::Match (expr, " %name% (" )) {
1121+ if (expr->function () && expr->function ()->nestedIn && expr->function ()->nestedIn ->isClassOrStruct () && !expr->function ()->isStatic ()) {
1122+ // is it a method of this?
1123+ const Scope* fScope = expr->scope ();
1124+ while (!fScope ->functionOf && fScope ->nestedIn )
1125+ fScope = fScope ->nestedIn ;
1126+
1127+ const Scope* classScope = fScope ->functionOf ;
1128+ if (classScope && classScope->function )
1129+ classScope = classScope->function ->token ->scope ();
1130+
1131+ if (classScope && classScope->isClassOrStruct ())
1132+ return contains (classScope->findAssociatedScopes (), expr->function ()->nestedIn );
1133+ return false ;
1134+ }
1135+ if (expr->isOperatorKeyword () && !Token::simpleMatch (expr->next ()->astParent (), " ." ))
1136+ return true ;
11331137 }
11341138 if (onVar && expr->variable ()) {
11351139 const Variable* var = expr->variable ();
@@ -3014,7 +3018,7 @@ bool isThisChanged(const Token* tok, int indirect, const Settings& settings)
30143018 if (tok->previous ()->function ()) {
30153019 return (!tok->previous ()->function ()->isConst () && !tok->previous ()->function ()->isStatic ());
30163020 }
3017- if (!tok->previous ()->isKeyword ()) {
3021+ if (!tok->previous ()->isKeyword () || tok-> previous ()-> isOperatorKeyword () ) {
30183022 return true ;
30193023 }
30203024 }
0 commit comments