protected virtual ArrayList CheckMethodConformance(TypeData type, string name, TypeData returnType, TypedNodeList arguments, ArrayList ancestorMethods) { MethodSignature sig = new MethodSignature(type, name, returnType, arguments); ArrayList conformableMethods = new ArrayList(); foreach (MethodData m in ancestorMethods) { if (sig.ConformTo(m)) conformableMethods.Add(m); } foreach (MethodData m in conformableMethods) { ancestorMethods.Remove(m); } return conformableMethods; }
public virtual bool ConflictWith(MethodSignature method) { if (Name.ToLower() != method.Name.ToLower()) { return false; } if (Parameters.Count != method.Arguments.Length) return false; if (ReturnType.IsVoid != method.ReturnType.IsVoid) return false; bool conflict = false; bool abs = false; bool sameArgs = true; int i = 0; foreach (Argument arg in method.Arguments) { ParameterData param = (ParameterData) Parameters[i++]; TypeData type1 = arg.NodeType; TypeData type2 = param.ParameterType; if (type1 != type2) sameArgs = false; if (type1 != type2 && !type1.IsAbstract && !type2.IsAbstract) { return false; } else { if (type1.IsAbstract && type2.IsAbstract) { abs = true; if (!(type1.IsSubtypeOf(type2) || type2.IsSubtypeOf(type1))) conflict = true; } else { if (type1 != type2) return false; } } } return (abs && conflict) || !abs || sameArgs; }
protected virtual void CheckMethodConfliction(TypeData type, string name, TypeData returnType, TypedNodeList arguments) { MethodSignature sig = new MethodSignature(type, name, returnType, arguments); foreach (MethodData m in type.Methods) { if (m.ConflictWith(sig)) { string msg = "The signature: " + sig + " conflicts with the earlier feature signature: " + m; throw new MethodConflictionException(msg); } } }