Esempio n. 1
0
    ///<summary>Determines if the effects of executing the statement with/without the given previous statement are equivalent.</summary>
    public static bool? EffectsOverwriteEffectsOf(this StatementSyntax syntax, StatementSyntax prev, ISemanticModel model, Assumptions assume)
    {
        if (prev.IsGuaranteedToJumpOut()) return false;
        if (prev.HasSideEffects(model, assume) == false) return null;

        if (prev.IsAssignmentOrSingleInitialization()) {
            var rhs = prev.TryGetRHSOfAssignmentOrInit();
            if (rhs.HasSideEffects(model, assume) == false && syntax.HasMatchingLHSOrRet(prev, model, assume))
                return true;
            return null;
        }
        return null;
    }