Babel.Compiler.MethodSignature.ConformTo C# (CSharp) Method

ConformTo() public method

public ConformTo ( MethodData method ) : bool
method MethodData
return bool
        public virtual bool ConformTo(MethodData method)
        {
            if (method.Name.ToLower() != Name.ToLower())
                return false;
            if (method.Parameters.Count != Arguments.Length)
                return false;
            if (method.ReturnType != ReturnType)
                return false;

            int i = 0;
            foreach (Argument arg in Arguments) {
                ParameterData param = (ParameterData) method.Parameters[i++];
                if (arg.Mode != param.Mode)
                    return false;
                if (arg.NodeType != param.ParameterType)
                    return false;
            }
            return true;
        }

Usage Example

Beispiel #1
0
 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;
 }