Issue 9413 & 9414 - Detect incorrect modification inside contracts

[Issue 9413](http://d.puremagic.com/issues/show_bug.cgi?id=9413) - Incorrect modification inside contracts is not detected correctly
[Issue 9414](http://d.puremagic.com/issues/show_bug.cgi?id=9414) - Incorrect modification inside contracts is not detected on virtual function

To resolve duplicated error message issue (which described in bugzilla 9413), this pull request contains a refactoring commit.