~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to contrib/Mono.Cecil/Mono.Cecil/Mono.Cecil/IMethodSignature.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:
5
5
//   Jb Evain (jbevain@gmail.com)
6
6
//
7
 
// (C) 2005 - 2007 Jb Evain
 
7
// Copyright (c) 2008 - 2010 Jb Evain
8
8
//
9
9
// Permission is hereby granted, free of charge, to any person obtaining
10
10
// a copy of this software and associated documentation files (the
26
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
27
//
28
28
 
 
29
using System.Text;
 
30
 
 
31
using Mono.Collections.Generic;
 
32
 
29
33
namespace Mono.Cecil {
30
34
 
31
 
        public interface IMethodSignature {
 
35
        public interface IMethodSignature : IMetadataTokenProvider {
32
36
 
33
 
                bool HasParameters { get; }
34
37
                bool HasThis { get; set; }
35
38
                bool ExplicitThis { get; set; }
36
39
                MethodCallingConvention CallingConvention { get; set; }
37
40
 
38
 
                ParameterDefinitionCollection Parameters { get; }
39
 
                MethodReturnType ReturnType { get; }
40
 
 
41
 
                int GetSentinel ();
 
41
                bool HasParameters { get; }
 
42
                Collection<ParameterDefinition> Parameters { get; }
 
43
                TypeReference ReturnType { get; set; }
 
44
                MethodReturnType MethodReturnType { get; }
 
45
        }
 
46
 
 
47
        static partial class Mixin {
 
48
 
 
49
                public static void MethodSignatureFullName (this IMethodSignature self, StringBuilder builder)
 
50
                {
 
51
                        builder.Append ("(");
 
52
 
 
53
                        if (self.HasParameters) {
 
54
                                var parameters = self.Parameters;
 
55
                                for (int i = 0; i < parameters.Count; i++) {
 
56
                                        var parameter = parameters [i];
 
57
                                        if (i > 0)
 
58
                                                builder.Append (",");
 
59
 
 
60
                                        if (parameter.ParameterType.IsSentinel)
 
61
                                                builder.Append ("...,");
 
62
 
 
63
                                        builder.Append (parameter.ParameterType.FullName);
 
64
                                }
 
65
                        }
 
66
 
 
67
                        builder.Append (")");
 
68
                }
42
69
        }
43
70
}