Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInitNew.cpp

    r4a8f150 r7d651a66  
    413413        void SelfAssignChecker::previsit( const ast::ApplicationExpr * appExpr ) {
    414414                auto function = getFunction( appExpr );
    415                 // Doesn't use isAssignment, because ?+=?, etc. should not count as self-assignment.
    416                 if ( function->name == "?=?" && appExpr->args.size() == 2
    417                                 // Check for structural similarity (same variable use, ignore casts, etc.
    418                                 // (but does not look too deeply, anything looking like a function is off limits).
    419                                 && structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) {
    420                         SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) );
     415                if ( function->name == "?=?" ) { // doesn't use isAssignment, because ?+=?, etc. should not count as self-assignment
     416                        if ( appExpr->args.size() == 2 ) {
     417                                // check for structural similarity (same variable use, ignore casts, etc. - but does not look too deeply, anything looking like a function is off limits)
     418                                if ( structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) {
     419                                        SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) );
     420                                }
     421                        }
    421422                }
    422423        }
Note: See TracChangeset for help on using the changeset viewer.