PageRenderTime 17ms CodeModel.GetById 1ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 1ms

/Mono.Cecil/MethodReturnType.cs

http://github.com/jbevain/cecil
C# | 98 lines | 68 code | 21 blank | 9 comment | 12 complexity | 1d9402a2a456c7b3b7e4f4976b472b75 MD5 | raw file
 1//
 2// Author:
 3//   Jb Evain (jbevain@gmail.com)
 4//
 5// Copyright (c) 2008 - 2015 Jb Evain
 6// Copyright (c) 2008 - 2011 Novell, Inc.
 7//
 8// Licensed under the MIT/X11 license.
 9//
10
11using System.Threading;
12
13using Mono.Collections.Generic;
14
15namespace Mono.Cecil {
16
17	public sealed class MethodReturnType : IConstantProvider, ICustomAttributeProvider, IMarshalInfoProvider {
18
19		internal IMethodSignature method;
20		internal ParameterDefinition parameter;
21		TypeReference return_type;
22
23		public IMethodSignature Method {
24			get { return method; }
25		}
26
27		public TypeReference ReturnType {
28			get { return return_type; }
29			set { return_type = value; }
30		}
31
32		internal ParameterDefinition Parameter {
33			get {
34				if (parameter == null)
35					Interlocked.CompareExchange (ref parameter, new ParameterDefinition (return_type, method), null);
36
37				return parameter;
38			}
39		}
40
41		public MetadataToken MetadataToken {
42			get { return Parameter.MetadataToken; }
43			set { Parameter.MetadataToken = value; }
44		}
45
46		public ParameterAttributes Attributes {
47			get { return Parameter.Attributes; }
48			set { Parameter.Attributes = value; }
49		}
50
51		public string Name {
52			get { return Parameter.Name; }
53			set { Parameter.Name = value; }
54		}
55
56		public bool HasCustomAttributes {
57			get { return parameter != null && parameter.HasCustomAttributes; }
58		}
59
60		public Collection<CustomAttribute> CustomAttributes {
61			get { return Parameter.CustomAttributes; }
62		}
63
64		public bool HasDefault {
65			get { return parameter != null && parameter.HasDefault; }
66			set { Parameter.HasDefault = value; }
67		}
68
69		public bool HasConstant {
70			get { return parameter != null && parameter.HasConstant; }
71			set { Parameter.HasConstant = value; }
72		}
73
74		public object Constant {
75			get { return Parameter.Constant; }
76			set { Parameter.Constant = value; }
77		}
78
79		public bool HasFieldMarshal {
80			get { return parameter != null && parameter.HasFieldMarshal; }
81			set { Parameter.HasFieldMarshal = value; }
82		}
83
84		public bool HasMarshalInfo {
85			get { return parameter != null && parameter.HasMarshalInfo; }
86		}
87
88		public MarshalInfo MarshalInfo {
89			get { return Parameter.MarshalInfo; }
90			set { Parameter.MarshalInfo = value; }
91		}
92
93		public MethodReturnType (IMethodSignature method)
94		{
95			this.method = method;
96		}
97	}
98}