private static bool ShallowEq(SeqSelectExpr expr1, SeqSelectExpr expr2) { return(expr1.SelectOne == expr2.SelectOne && TriggerUtils.SameNullity(expr1.Seq, expr2.Seq) && TriggerUtils.SameNullity(expr1.E0, expr2.E0) && TriggerUtils.SameNullity(expr1.E1, expr2.E1)); }
private static bool ShallowEq(ComprehensionExpr expr1, ComprehensionExpr expr2) { if (!TriggerUtils.SameLists(expr1.BoundVars, expr2.BoundVars, SameBoundVar) || !ShallowSameAttributes(expr1.Attributes, expr2.Attributes) || // Filled in during resolution: !SameLists(expr1.Bounds, expr2.Bounds, ReferenceCompare) || // !SameLists(expr1.MissingBounds, expr2.MissingBounds, SameBoundVar) || !TriggerUtils.SameNullity(expr1.Range, expr2.Range)) //TODO Check { return(false); } if (expr1 is LambdaExpr && expr2 is LambdaExpr) { return(ShallowEq((LambdaExpr)expr1, (LambdaExpr)expr2)); } else if (expr1 is MapComprehension && expr2 is MapComprehension) { return(ShallowEq((MapComprehension)expr1, (MapComprehension)expr2)); } else if (expr1 is SetComprehension && expr2 is SetComprehension) { return(ShallowEq((SetComprehension)expr1, (SetComprehension)expr2)); } else if (expr1 is QuantifierExpr && expr2 is QuantifierExpr) { return(ShallowEq((QuantifierExpr)expr1, (QuantifierExpr)expr2)); } else { return(false); // ComprehensionExpr is abstract } }
private static bool ShallowEq(QuantifierExpr expr1, QuantifierExpr expr2) { if (!TriggerUtils.SameNullity(expr1.SplitQuantifier, expr2.SplitQuantifier)) { return(false); } if (expr1.SplitQuantifier != null && expr2.SplitQuantifier != null) { return(ShallowEq_Top(expr1.SplitQuantifierExpression, expr2.SplitQuantifierExpression)); } if (expr1.TypeArgs.Count != expr2.TypeArgs.Count || !TriggerUtils.SameNullity(expr1.Range, expr2.Range)) { return(false); } if (expr1 is ExistsExpr && expr2 is ExistsExpr) { return(ShallowEq((ExistsExpr)expr1, (ExistsExpr)expr2)); } else if (expr1 is ForallExpr && expr2 is ForallExpr) { return(ShallowEq((ForallExpr)expr1, (ForallExpr)expr2)); } else { return(false); } }
private static bool ShallowEq(LiteralExpr expr1, LiteralExpr expr2) { if (!TriggerUtils.SameNullity(expr1.Value, expr2.Value) || (expr1.Value != null && !expr1.Value.Equals(expr2.Value))) { return(false); } if (expr1 is StringLiteralExpr && expr2 is StringLiteralExpr) { return(ShallowEq((StringLiteralExpr)expr1, (StringLiteralExpr)expr2)); } else if (expr1 is CharLiteralExpr && expr2 is CharLiteralExpr) { return(ShallowEq((CharLiteralExpr)expr1, (CharLiteralExpr)expr2)); } else if (expr1 is StaticReceiverExpr && expr2 is StaticReceiverExpr) { return(ShallowEq((StaticReceiverExpr)expr1, (StaticReceiverExpr)expr2)); } else { return(expr1.GetType() == expr2.GetType()); // LiteralExpr is not abstract } }
private static bool ShallowEq(NamedExpr expr1, NamedExpr expr2) { return(expr1.Name == expr2.Name && TriggerUtils.SameNullity(expr1.Contract, expr2.Contract)); }