Пример #1
0
        /// <summary>
        ///     Gets the <see cref="NRMethod" /> as a C# string.
        /// </summary>
        /// <param name="method">The method to get the code for.</param>
        /// <returns>A string representing the method.</returns>
        public static string Declaration(this NRMethod method)
        {
            string accessModifier = AddSpace(method.AccessModifier.Declaration( ));
            string modifier       = AddSpace(method.OperationModifier.Declaration( ));
            string genericDecl    = GetGenericDefinition(method);

            return(string.Format("{0}{1}{2} {3}{4}({5})", accessModifier, modifier, method.Type.Declaration( ), method.Name, genericDecl, method.Parameters.Declaration( )));
        }
Пример #2
0
 /// <summary>
 /// Returns <c>true</c> if the given method is an extension method.
 /// </summary>
 /// <param name="method">The method to check.</param>
 /// <returns><c>true</c> if the given method is an extension method.</returns>
 private bool IsExtensionMethod(NRMethod method)
 {
     if (method.IsExtensionMethod)
     {
         ExtensionMethodsPresent = true;
         return(true);
     }
     return(false);
 }
Пример #3
0
 /// <summary>
 ///     Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns><c>True</c> if the method should be reflected.</returns>
 public bool Reflect(NRMethod nrMethod)
 {
     if (Filter.Reflect(nrMethod))
     {
         ReflectedMethods++;
         return(true);
     }
     IgnoredMethods++;
     return(false);
 }
Пример #4
0
 /// <summary>
 /// Visit a <see cref="NRMethod"/>.
 /// </summary>
 /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param>
 public void Visit(NRMethod nrMethod)
 {
     VisitAttributes(nrMethod);
     VisitReturnValueAttributes(nrMethod);
     Output(ToString(nrMethod.AccessModifier) + ToString(nrMethod.OperationModifier) + ToString(nrMethod.Type) + " " + nrMethod.Name + GetGenericDefinition(nrMethod) + "(");
     PrintParameters(nrMethod.Parameters, nrMethod.IsExtensionMethod);
     Output(")", 0);
     VisitTypeParameters(nrMethod);
     OutputLine("", 0);
 }
Пример #5
0
 /// <summary>
 /// Visit a <see cref="NRMethod"/>.
 /// </summary>
 /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param>
 public void Visit(NRMethod nrMethod)
 {
     OutputLine("NRMethod");
     indent++;
     PrintMembers(nrMethod);
     nrMethod.GenericTypes.ForEach(nrTypeParameter => nrTypeParameter.Accept(this));
     OutputLine("IsExtensionMethod: " + nrMethod.IsExtensionMethod);
     OutputLine("IsGeneric: " + nrMethod.IsGeneric);
     indent--;
 }
Пример #6
0
        /// <summary>
        /// Visit a <see cref="NRMethod"/>.
        /// </summary>
        /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param>
        public void Visit(NRMethod nrMethod)
        {
            VisitAttributes(nrMethod);
            VisitReturnValueAttributes(nrMethod);

            Output(nrMethod.Declaration());
            if (nrMethod.GenericTypes.Count > 0)
            {
                foreach (NRTypeParameter nrTypeParameter in nrMethod.GenericTypes)
                {
                    nrTypeParameter.Accept(this);
                }
            }
            if (currentType is NRInterface || nrMethod.IsAbstract)
            {
                OutputLine(";", 0);
            }
            else
            {
                OutputLine("", 0);
                OutputLine("{}");
            }
            OutputEmptyLineAfterMember();
        }
Пример #7
0
 /// <summary>
 /// Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns>
 /// <c>True</c> if the method should be reflected.
 /// </returns>
 public bool Reflect(NRMethod nrMethod)
 {
     return(IsUnsafePointer(nrMethod.Type.Name) || HasUnsafeParameters(nrMethod.Parameters) ? false : filter.Reflect(nrMethod));
 }
Пример #8
0
 public NRMethodDeclaration(NRMethod method)
 {
     this.method = method;
 }
Пример #9
0
 /// <summary>
 /// Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns>
 /// <c>True</c> if the method should be reflected.
 /// </returns>
 public bool Reflect(NRMethod nrMethod)
 {
   return IsUnsafePointer(nrMethod.Type) || HasUnsafeParameters(nrMethod.Parameters) ? false : filter.Reflect(nrMethod);
 }
Пример #10
0
 /// <summary>
 ///     Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns><c>True</c> if the method should be reflected.</returns>
 public bool Reflect(NRMethod nrMethod)
 {
     return(Reflect(FilterElements.Method, nrMethod));
 }
Пример #11
0
 /// <summary>
 ///     Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns><c>True</c>, so the method will be reflected.</returns>
 public bool Reflect(NRMethod nrMethod)
 {
     return(true);
 }
Пример #12
0
 /// <summary>
 ///     Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns><c>True</c> if the method should be reflected.</returns>
 public bool Reflect(NRMethod nrMethod)
 {
     return(!Filter.Reflect(nrMethod));
 }
Пример #13
0
 /// <summary>
 /// Determines if a method will be reflected.
 /// </summary>
 /// <param name="nrMethod">The method to test.</param>
 /// <returns>
 /// <c>True</c> if the method should be reflected.
 /// </returns>
 public bool Reflect(NRMethod nrMethod)
 {
     return(filter.Reflect(nrMethod) && CanImportParameters(nrMethod.Parameters) && CanImportTypeUsage(nrMethod.Type) && !IsExtensionMethod(nrMethod));
 }