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

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Projects/MonoDevelop.Projects.Parser/ReflectionParameter.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//  ReflectionParameter.cs
2
 
//
3
 
//  This file was derived from a file from #Develop. 
4
 
//
5
 
//  Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
6
 
// 
7
 
//  This program is free software; you can redistribute it and/or modify
8
 
//  it under the terms of the GNU General Public License as published by
9
 
//  the Free Software Foundation; either version 2 of the License, or
10
 
//  (at your option) any later version.
11
 
// 
12
 
//  This program is distributed in the hope that it will be useful,
13
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 
//  GNU General Public License for more details.
16
 
//  
17
 
//  You should have received a copy of the GNU General Public License
18
 
//  along with this program; if not, write to the Free Software
19
 
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
 
using System;
21
 
using System.Xml;
22
 
using Mono.Cecil;
23
 
 
24
 
namespace MonoDevelop.Projects.Parser
25
 
{
26
 
        [Serializable]
27
 
        internal class ReflectionParameter : DefaultParameter
28
 
        {
29
 
                public ReflectionParameter (ParameterDefinition parameterInfo, XmlNode methodNode)
30
 
                {
31
 
                        name       = parameterInfo.Name;
32
 
                        returnType = new ReflectionReturnType(parameterInfo.ParameterType);
33
 
                        
34
 
                        TypeReference type = parameterInfo.ParameterType;
35
 
                        if (type is ArrayType && type.FullName != "System.Array") {
36
 
                                foreach (CustomAttribute att in parameterInfo.CustomAttributes)
37
 
                                        if (att.Constructor.DeclaringType.FullName == "System.ParamArrayAttribute") {
38
 
                                                modifier |= ParameterModifier.Params;
39
 
                                                break;
40
 
                                        }
41
 
                        }
42
 
                        
43
 
                        if ((parameterInfo.Attributes & ParameterAttributes.Out) != 0) {
44
 
                                modifier |= ParameterModifier.Out;
45
 
                        } else if (returnType.ByRef) {
46
 
                                // FIX: We should look at the return type of this parameter to
47
 
                                // determine whether a parameter is 'ref'
48
 
                                modifier |= ParameterModifier.Ref;
49
 
                        }
50
 
                        
51
 
                        if (methodNode != null) {
52
 
                                XmlNode paramDocu = methodNode.SelectSingleNode("Docs/param[@name='" + parameterInfo.Name + "']");
53
 
                                if (paramDocu != null) {
54
 
                                        documentation = paramDocu.InnerXml;
55
 
                                }
56
 
                        }
57
 
                }
58
 
        }
59
 
}