void CompareParameters(ComparisonNode parent, ICompParameters reference, ICompParameters target) { var r = reference.GetParameters(); var t = target.GetParameters(); if (r.Count != t.Count) { throw new NotImplementedException(string.Format("Should never happen with valid data ({0} != {1})", r.Count, t.Count)); } for (int i = 0; i < r.Count; ++i) { var r_i = r [i]; var t_i = t [i]; if (r_i.TypeReference != t_i.TypeReference) { parent.AddError(string.Format("Parameter `{0}' type mismatch", t_i.Name)); } if (r_i.Name != t_i.Name) { parent.AddError(string.Format("Parameter name `{0}' should be `{1}'", t_i.Name, r_i.Name)); } if (r_i.IsOptional != t_i.IsOptional) { if (r_i.IsOptional) { parent.AddError(string.Format("Parameter `{0}' is missing a default value", t_i.Name)); } else { parent.AddError(string.Format("Parameter `{0}' should not have a default value", t_i.Name)); } } CompareAttributes(parent, r_i, t_i); } }
void CompareParameters (ComparisonNode parent, ICompParameters reference, ICompParameters target) { var r = reference.GetParameters (); var t = target.GetParameters (); if (r.Count != t.Count) { throw new NotImplementedException (string.Format ("Should never happen with valid data ({0} != {1})", r.Count, t.Count)); } for (int i = 0; i < r.Count; ++i) { var r_i = r [i]; var t_i = t [i]; if (r_i.TypeReference != t_i.TypeReference) { parent.AddError (string.Format ("Parameter `{0}' type mismatch", t_i.Name)); } if (r_i.Name != t_i.Name) { parent.AddError (string.Format ("Parameter name `{0}' should be `{1}'", t_i.Name, r_i.Name)); } if (r_i.IsOptional != t_i.IsOptional) { if (r_i.IsOptional) parent.AddError (string.Format ("Parameter `{0}' is missing a default value", t_i.Name)); else parent.AddError (string.Format ("Parameter `{0}' should not have a default value", t_i.Name)); } CompareAttributes (parent, r_i, t_i); } }