Esempio n. 1
0
        public IntPtr GetFunctionPointer()
        {
            MethodClassification methodType = GetClassification();

            switch (methodType)
            {
            case MethodClassification.mcIL:
            {
                IntPtr funcPtr = _address + (int)MethodDesc.GetBaseSize(methodType);
                return(funcPtr.ReadPtr());
            }

            case MethodClassification.mcFCall:
                if (_methodInfo != null)
                {
                    return(_methodInfo.MethodHandle.GetFunctionPointer());
                }
                else
                {
                    IntPtr funcPtr = _address + (int)MethodDesc.GetBaseSize(methodType);
                    return(funcPtr.ReadPtr());
                }

            case MethodClassification.mcNDirect:
            case MethodClassification.mcEEImpl:
            case MethodClassification.mcArray:
            case MethodClassification.mcInstantiated:
            case MethodClassification.mcComInterop:
            case MethodClassification.mcDynamic:
                throw new NotSupportedException("IL method only");
            }

            return(IntPtr.Zero);
        }
Esempio n. 2
0
        public static uint GetBaseSize(MethodClassification classification)
        {
            switch (classification)
            {
            case MethodClassification.mcIL:
                return((uint)Marshal.SizeOf(typeof(MethodDescInternal)));

            case MethodClassification.mcFCall:
                return((uint)Marshal.SizeOf((IntPtr.Size == 8 ? typeof(FCallMethodDescInternalx64) : typeof(FCallMethodDescInternalx86))));
            }

            throw new NotSupportedException();
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ReturnsComment returns) : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition           = info.Definition;
     _methodClassification = info.Definition.GetMethodClassification();
     _identity             = info.Identity;
     _parameters           = new List <DocumentedParameter>(parameters);
     _returns = returns;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info, 
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary, 
     RemarksComment remarks, 
     ExampleComment example,
     ReturnsComment returns)
     : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition = info.Definition;
     _methodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     _identity = info.Identity;
     _parameters = new List<DocumentedParameter>(parameters);
     _returns = returns;
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 /// <param name="metadata">The method metadata.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     Definition           = info.Definition;
     MethodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     Identity             = info.Identity;
     Parameters           = new List <DocumentedParameter>(parameters);
     Returns = returns;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 /// <param name="metadata">The method metadata.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     MethodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     Identity = info.Identity;
     Parameters = new List<DocumentedParameter>(parameters);
     Returns = returns;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodSignature" /> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The type name.</param>
 /// <param name="url">The url.</param>
 /// <param name="classification">The method classification.</param>
 /// <param name="operatorClassification">The operator classification.</param>
 /// <param name="declaringType">The declaring type.</param>
 /// <param name="returnType">The return type.</param>
 /// <param name="genericParameters">The method's generic parameters.</param>
 /// <param name="parameters">The parameters.</param>
 public MethodSignature(
     string identity,
     string name,
     string url,
     MethodClassification classification,
     OperatorClassification operatorClassification,
     TypeSignature declaringType,
     TypeSignature returnType,
     IEnumerable <string> genericParameters,
     IEnumerable <ParameterSignature> parameters)
 {
     Identity               = identity;
     Name                   = name;
     Url                    = url;
     Classification         = classification;
     OperatorClassification = operatorClassification;
     ReturnType             = returnType;
     DeclaringType          = declaringType;
     GenericParameters      = new List <string>(genericParameters);
     Parameters             = new List <ParameterSignature>(parameters);
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodSignature" /> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The type name.</param>
 /// <param name="url">The url.</param>
 /// <param name="classification">The method classification.</param>
 /// <param name="operatorClassification">The operator classification.</param>
 /// <param name="declaringType">The declaring type.</param>
 /// <param name="returnType">The return type.</param>
 /// <param name="genericParameters">The method's generic parameters.</param>
 /// <param name="parameters">The parameters.</param>
 public MethodSignature(
     string identity,
     string name,
     string url,
     MethodClassification classification,
     OperatorClassification operatorClassification,
     TypeSignature declaringType,
     TypeSignature returnType,
     IEnumerable<string> genericParameters,
     IEnumerable<ParameterSignature> parameters)
 {
     Identity = identity;
     Name = name;
     Url = url;
     Classification = classification;
     OperatorClassification = operatorClassification;
     ReturnType = returnType;
     DeclaringType = declaringType;
     GenericParameters = new List<string>(genericParameters);
     Parameters = new List<ParameterSignature>(parameters);
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodSignature" /> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The type name.</param>
 /// <param name="url">The url.</param>
 /// <param name="classification">The method classification.</param>
 /// <param name="operatorClassification">The operator classification.</param>
 /// <param name="declaringType">The declaring type.</param>
 /// <param name="returnType">The return type.</param>
 /// <param name="genericParameters">The method's generic parameters.</param>
 /// <param name="parameters">The parameters.</param>
 public MethodSignature(
     string identity,
     string name,
     string url,
     MethodClassification classification,
     OperatorClassification operatorClassification,
     TypeSignature declaringType,
     TypeSignature returnType,
     IEnumerable<string> genericParameters,
     IEnumerable<ParameterSignature> parameters)
 {
     _identity = identity;
     _name = name;
     _url = url;
     _classification = classification;
     _operatorClassification = operatorClassification;
     _returnType = returnType;
     _declaringType = declaringType;
     _genericParameters = new List<string>(genericParameters);
     _parameters = new List<ParameterSignature>(parameters);
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodSignature" /> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The type name.</param>
 /// <param name="url">The url.</param>
 /// <param name="classification">The method classification.</param>
 /// <param name="operatorClassification">The operator classification.</param>
 /// <param name="declaringType">The declaring type.</param>
 /// <param name="returnType">The return type.</param>
 /// <param name="genericParameters">The method's generic parameters.</param>
 /// <param name="parameters">The parameters.</param>
 public MethodSignature(
     string identity,
     string name,
     string url,
     MethodClassification classification,
     OperatorClassification operatorClassification,
     TypeSignature declaringType,
     TypeSignature returnType,
     IEnumerable <string> genericParameters,
     IEnumerable <ParameterSignature> parameters)
 {
     _identity               = identity;
     _name                   = name;
     _url                    = url;
     _classification         = classification;
     _operatorClassification = operatorClassification;
     _returnType             = returnType;
     _declaringType          = declaringType;
     _genericParameters      = new List <string>(genericParameters);
     _parameters             = new List <ParameterSignature>(parameters);
 }
 public void Add(object method, AnalysisStatistics stat, MethodClassification methodKind)
 {
     totalStatistics[method] = stat;
 }
 public void Add(object method, AnalysisStatistics stat, MethodClassification methodKind)
 {
     totalStatistics[method] = stat;
 }