Exemplo n.º 1
0
            public FunctionDefintion DeepCopy(ClassDefinition cd, Dictionary <string, string> replacementTypes)
            {
                var fd = new FunctionDefintion()
                {
                    Name          = Name,
                    Type          = Type.DeepCopy(replacementTypes),
                    IsStatic      = IsStatic,
                    IsConstructor = IsConstructor,
                    IsDestructor  = IsDestructor,
                    IsOperator    = IsOperator,
                    IsAbstract    = IsAbstract,
                    IsPublic      = IsPublic,
                    IsTemplate    = IsTemplate,
                    TemplateName  = TemplateName,
                    Class         = cd
                };

                if (replacementTypes.ContainsKey(Name))
                {
                    fd.Name       = replacementTypes[Name];
                    fd.IsTemplate = fd.Name.Contains("<");
                }

                foreach (var parameter in Parameters)
                {
                    fd.Parameters.Add(parameter.DeepCopy(replacementTypes));
                }

                return(fd);
            }
Exemplo n.º 2
0
            public bool IsEqual(FunctionDefintion other, int maxParameters = 255)
            {
                if (maxParameters == 255)
                {
                    maxParameters = other.Parameters.Count;
                }

                if (Name.Equals(other.Name) && (IsStatic == other.IsStatic) && (Parameters.Count == maxParameters))
                {
                    for (int h = 0; h < Parameters.Count; h++)
                    {
                        if (h >= maxParameters)
                        {
                            break;
                        }

                        if (!Parameters[h].IsEqual(other.Parameters[h], true))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                return(false);
            }