public override void Visit(Process p) { Set set = new Set(); set.AddRange((Set)p.Parent.Tag); foreach (Variable var in p.ReadVariables) { if (!set.Contains(var)) { _warnings.Add(new Warning(var.LexicalInfo, "Use of unassigned variable " + var.Name)); } } set.AddRange(p.AssignedVariables); p.Tag = set; }
public override void Visit(Process p) { Set set = new Set(); foreach (Process child in p.FlowsTo) { set.AddRange((Set)child.Tag); } set.AddRange(p.ReadVariables); foreach (Variable var in p.AssignedVariables) { if (!set.Contains(var) && var.Name != Variable.NotUsedName) { _warnings.Add(new Warning(var.LexicalInfo, "This assignment to variable " + var.Name + " has no effect, it is never read")); var.IsUsed = false; } set.Remove(var); } p.Tag = set; }
public Set Union(Set set) { Set result = new Set(); result.AddRange(this); result.AddRange(set); return result; }