public override String BlockVisitor(AST ast) { if (!PathConstraints.ContainsKey(ast)) { PathConstraints.Add(ast, new HashSet <String>()); } if (!ast.isRoot()) { PathConstraints[ast].UnionWith(PathConstraints[ast.Parent]); } var buff = new HashSet <AST>(); foreach (var c in ast.Children) { if (c.Node.Type == NodeType.If) { var constr = Visit(c.Children[0]); if (!PathConstraints.ContainsKey(c)) { PathConstraints.Add(c, new HashSet <String>()); } if (buff.Count() > 0) { foreach (var b in buff) { if (Config.Debug) { Console.WriteLine("NEgative const on {0} for ", constr); b.Show(); } PathConstraints[b].Add(Not(constr)); Visit(b); } ; } buff.Add(c); Visit(c); } else if (c.Node.Type == NodeType.Assigment) { var key = Convert.ToInt32(Visit(c)); if (!Data.ContainsKey(key)) { Data.Add(key, new HashSet <AST>()); } Data[key].Add(c); buff.Add(c); if (!PathConstraints.ContainsKey(c)) { PathConstraints.Add(c, new HashSet <String>()); } PathConstraints[c].UnionWith(PathConstraints[ast]); } } return(""); }
public override String IfVisitor(AST ast) { if (!PathConstraints.ContainsKey(ast)) { PathConstraints.Add(ast, new HashSet <String>()); } PathConstraints[ast].UnionWith(PathConstraints[ast.Parent]); PathConstraints[ast].Add( Visit(ast.Children[0]) ); Visit(ast.Children[1]); return(""); }