Ejemplo n.º 1
0
        public bool Matches(MethodInfo mi)
        {
            if (mi.Name != name)
            {
                return(false);
            }
            int n = formals.Count;

            if (mi.GetParameters().Length != n)
            {
                return(false);
            }
            for (int i = 0; i < n; ++i)
            {
                FormalArg     arg1 = formals[i];
                ParameterInfo arg2 = mi.GetParameters()[i];

                // TODO: find a better way to compare types
                if (arg1.type.ToString() != arg2.ParameterType.Name)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public string GetSignature()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(name);
            sb.Append("(");
            for (int i = 0; i < formals.Count; ++i)
            {
                if (i > 0)
                {
                    sb.Append(", ");
                }
                FormalArg arg = formals[i];
                sb.Append(arg.name).Append(" : ").Append(arg.type.ToString());
            }
            sb.Append(")");
            if (rettype != null)
            {
                sb.Append(" : ").Append(rettype.ToString());
            }

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public bool Matches(FunctionDefn f)
        {
            if (f.name != name)
            {
                return(false);
            }
            int n = formals.Count;

            if (f.formals.Count != n)
            {
                return(false);
            }
            for (int i = 0; i < n; ++i)
            {
                FormalArg arg1 = formals[i];
                FormalArg arg2 = f.formals[i];
                if (arg1.type != arg2.type)
                {
                    return(false);
                }
            }
            return(true);
        }