private void ResolveVariables(int errorIndex) { bool resolveAgain = false; for (int i = LinkedVariables.Count - 1; i >= 0; ++i) { var tuple = LinkedVariables[i]; if (UsedVariables.ContainsKey(tuple.Item1)) { LinkVariable(errorIndex, tuple.Item2, UsedVariables[tuple.Item1]); LinkedVariables.RemoveAt(i); resolveAgain = true; } else if (UsedVariables.ContainsKey(tuple.Item2)) { LinkVariable(errorIndex, tuple.Item1, UsedVariables[tuple.Item2]); LinkedVariables.RemoveAt(i); resolveAgain = true; } } if (resolveAgain) { ResolveVariables(errorIndex); } }
public void LinkVariables(int errorIndex, string a, string b) { LinkedVariables.Add(new Tuple <string, string>(a, b)); ResolveVariables(errorIndex); }