public virtual void VisitParameterDeclarationCollection(IParameterDeclarationCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         VisitParameterDeclaration(value[i]);
     }
 }
        private bool AreParameterMatching(ParameterInfo[] parameters, IParameterDeclarationCollection iparameters)
        {
            bool result;

            if (parameters.Length != iparameters.Count)
            {
                result = false;
            }
            else
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    ParameterInfo         parameterInfo        = parameters[i];
                    IParameterDeclaration parameterDeclaration = iparameters[i].Resolve();
                    if (parameterInfo.Name != iparameters[i].Name)
                    {
                        return(false);
                    }
                    if (!AreMatching(parameterInfo.ParameterType, parameterDeclaration.ParameterType))
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
        public static string GetName(IPropertyReference value)
        {
            IParameterDeclarationCollection parameters = value.Parameters;

            if (parameters.Count > 0)
            {
                using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
                {
                    for (int i = 0; i < parameters.Count; i++)
                    {
                        if (i != 0)
                        {
                            stringWriter.Write(", ");
                        }
                        stringWriter.Write(parameters[i].ParameterType.ToString());
                    }
                    return(string.Concat(new string[]
                    {
                        value.Name,
                        "[",
                        stringWriter.ToString(),
                        "] : ",
                        value.PropertyType.ToString()
                    }));
                }
            }
            return(value.Name + " : " + value.PropertyType.ToString());
        }
示例#4
0
 public string GetNameWithParameterList(IMethodReference value)
 {
     using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture)) {
         writer.Write(this.GetName(value));
         writer.Write("(");
         IParameterDeclarationCollection parameters = value.Parameters;
         for (int i = 0; i < parameters.Count; i++)
         {
             if (i != 0)
             {
                 writer.Write(", ");
             }
             writer.Write(parameters[i].ParameterType.ToString());
         }
         if (value.CallingConvention == MethodCallingConvention.VariableArguments)
         {
             if (value.Parameters.Count > 0)
             {
                 writer.Write(", ");
             }
             writer.Write("...");
         }
         writer.Write(")");
         if ((value.Name != ".ctor") && (value.Name != ".cctor"))
         {
             writer.Write(" : ");
             writer.Write(value.ReturnType.Type.ToString());
         }
         return(writer.ToString());
     }
 }
示例#5
0
 static bool CheckParameters(CodeTypeInfo[] cti, IParameterDeclarationCollection pdc)
 {
     if (cti == null || cti.Length != pdc.Count)
     {
         return(false);
     }
     for (int i = 0; i < cti.Length; ++i)
     {
         if (cti[i] != null && !Is(pdc[i].ParameterType, cti[i]))
         {
             return(false);
         }
     }
     return(true);
 }
示例#6
0
 public override void VisitParameterDeclarationCollection(IParameterDeclarationCollection value)
 {
     if (value.Count > 0)
     {
         _formatter.WriteKeyword("param");
         _formatter.Write("(");
         foreach (object obj in value)
         {
             IParameterDeclaration value2 = (IParameterDeclaration)obj;
             if (value.IndexOf(value2) != 0)
             {
                 _formatter.Write(", ");
             }
             VisitParameterDeclaration(value2);
         }
         _formatter.Write(")");
         _formatter.WriteLine();
         _formatter.WriteLine();
     }
 }
        private string GetParameterDeclarationListText(IParameterDeclarationCollection value, MethodCallingConvention callingConvention)
        {
            using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture))
            {
                for (int i = 0; i < value.Count; i++)
                {
                    IType parameterType = value[i].ParameterType;
                    if ((parameterType != null) || ((i + 1) != value.Count))
                    {
                        if (i != 0)
                        {
                            writer.Write(",");
                        }

                        if (parameterType == null)
                        {
                            writer.Write("...");
                        }
                        else
                        {
                            writer.Write(this.GetTypeText(parameterType));
                        }
                    }
                }

                if (callingConvention == MethodCallingConvention.VariableArguments)
                {
                    if (value.Count > 0)
                    {
                        writer.Write(",");
                    }

                    writer.Write("...");
                }

                return(writer.ToString());
            }
        }
        private string GetParameterDeclarationListText(IParameterDeclarationCollection value, MethodCallingConvention callingConvention)
        {
            using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture))
            {
                for (int i = 0; i < value.Count; i++)
                {
                    IType parameterType = value[i].ParameterType;
                    if ((parameterType != null) || ((i + 1) != value.Count))
                    {
                        if (i != 0)
                        {
                            writer.Write(",");
                        }

                        if (parameterType == null)
                        {
                            writer.Write("...");
                        }
                        else
                        {
                            writer.Write(this.GetTypeText(parameterType));
                        }
                    }
                }

                if (callingConvention == MethodCallingConvention.VariableArguments)
                {
                    if (value.Count > 0)
                    {
                        writer.Write(",");
                    }

                    writer.Write("...");
                }

                return writer.ToString();
            }
        }
 private void InsituTransformParameterDeclarationCollection(IParameterDeclarationCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         value[i] = this.TransformParameterDeclaration(value[i]);
     }
 }
            private void WriteParameterDeclarationList(IParameterDeclarationCollection parameters, IFormatter formatter, ILanguageWriterConfiguration configuration)
            {
                for (int i = 0; i < parameters.Count; i++)
                {
                    IParameterDeclaration parameter = parameters[i];
                    IType parameterType = parameter.ParameterType;
                    if ((parameterType != null) || ((i + 1) != parameters.Count))
                    {
                        if (i != 0)
                        {
                            formatter.Write(", ");
                        }

                        this.WriteParameterDeclaration(parameter, formatter, configuration);
                    }
                }
            }
示例#11
0
 public virtual void VisitParameterDeclarationCollection(IParameterDeclarationCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         this.VisitParameterDeclaration(value[i]);
     }
 }
示例#12
0
            //===========================================================
            //		宣言
            //===========================================================
            public virtual void WritePropertyDeclaration(IPropertyDeclaration propDecl)
            {
                // アクセス修飾子情報
                IMethodDeclaration getter;
                IMethodDeclaration setter;
                MethodVisibility   vis = __GetPropertyVisibility(propDecl, out getter, out setter);

                this.__WriteVisibilitySpecifier(vis);

#warning generic property
                // 修飾子
                if (getter != null && getter.Static || setter != null && setter.Static)
                {
                    this.WriteKeyword("static");
                    this.Write(" ");
                }
                this.WriteKeyword("property");
                this.Write(" ");
                this.WriteType(propDecl.PropertyType, null, null, null, false);
                this.Write(" ");
                this.WriteDeclaration(propDecl.Name);
                IParameterDeclarationCollection parameters = propDecl.Parameters;
                if (parameters != null)
                {
                    this.WritePropertyIndices(parameters);
                }

                //
                // 内容の書込
                //
                //---------------------------------------------------
                // inline == true → 宣言だけを書く場合
                // inline == false → アクセサのロジックも書く場合
                bool inline = !(getter != null && getter.Body != null || setter != null && setter.Body != null);
                this.Write("{");
                if (inline)
                {
                    this.Write(" ");
                }
                else
                {
                    this.WriteIndent();
                    this.WriteLine();
                }
                //-----------------------------------------
                this.PushScope();
                //-----------------------------------------
                if (getter != null)
                {
                    if (getter.Visibility != vis)
                    {
                        this.__WriteVisibilitySpecifier(getter.Visibility, inline);
                    }
                    this.__WritePropertyAccessorSignature("get", getter, inline);
                    this.__WriteMethodBody(getter.Body as IBlockStatement);                     //,true
                    if (inline)
                    {
                        this.Write(" ");
                    }
                    else
                    {
                        this.WriteLine();
                    }
                }
                //-----------------------------------------
                this.PopScope();
                this.PushScope();
                //-----------------------------------------
                if (setter != null)
                {
                    if (getter != null && setter.Visibility != getter.Visibility)
                    {
                        this.__WriteVisibilitySpecifier(setter.Visibility, inline);
                    }
                    this.__WritePropertyAccessorSignature("set", setter, inline);
                    this.__WriteMethodBody(setter.Body as IBlockStatement);                     //,true
                    if (inline)
                    {
                        this.Write(" ");
                    }
                    else
                    {
                        this.WriteLine();
                    }
                }
                //-----------------------------------------
                this.PopScope();
                //-----------------------------------------
                if (!inline)
                {
                    this.WriteOutdent();
                }
                this.Write("}");
            }
示例#13
0
    /// <summary>
    /// Builds the parameter list.
    /// </summary>
    /// <param name="parameterDefinitionCollection">The parameter definition collection.</param>
    /// <returns>A string representation of the parameter definitions.</returns>
    private static string BuildParameterList(IParameterDeclarationCollection parameterDefinitionCollection)
    {
      if (parameterDefinitionCollection == null)
      {
        return string.Empty;
      }

      var sb = new StringBuilder();
      int paramCount = 1;
      foreach (IParameterDeclaration paramDefinition in parameterDefinitionCollection)
      {
        sb.Append(paramDefinition.ParameterType.ToString());

        if (paramCount < parameterDefinitionCollection.Count)
        {
          sb.Append(",");
          paramCount++;
        }
      }

      return sb.ToString();
    }
示例#14
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n, Func<IParameterDeclaration, IParameterDeclaration, bool> checkitem)
 {
     return Compare<IParameterDeclaration>(source,n,checkitem);
 }
示例#15
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n, Func<IParameterDeclaration, IParameterDeclaration, Action<string, string>, bool> checkitem, Action<string, string> errAct)
 {
     return Compare<IParameterDeclaration>(source,n,checkitem,errAct);
 }
示例#16
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n)
 {
     return Compare<IParameterDeclaration>(source,n);
 }
        public virtual IParameterDeclarationCollection TransformParameterDeclarationCollection(IParameterDeclarationCollection parameters)
        {
            IParameterDeclaration[] array = new IParameterDeclaration[parameters.Count];
            for (int i = 0; i < parameters.Count; i++)
            {
                array[i] = this.TransformParameterDeclaration(parameters[i]);
            }

            IParameterDeclarationCollection target = new ParameterDeclarationCollection();
            target.AddRange(array);
            return target;
        }
示例#18
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n, Func <IParameterDeclaration, IParameterDeclaration, Action <string, string>, bool> checkitem, Action <string, string> errAct)
 {
     return(Compare <IParameterDeclaration>(source, n, checkitem, errAct));
 }
示例#19
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n, Func <IParameterDeclaration, IParameterDeclaration, bool> checkitem)
 {
     return(Compare <IParameterDeclaration>(source, n, checkitem));
 }
示例#20
0
 public static bool Compare(this IParameterDeclarationCollection source, IParameterDeclarationCollection n)
 {
     return(Compare <IParameterDeclaration>(source, n));
 }