~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Ast/TypeMembers/ExternalMethodDeclaration.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Runtime.InteropServices;
 
6
 
 
7
namespace ICSharpCode.NRefactory.VB.Ast
 
8
{
 
9
        public class ExternalMethodDeclaration : MemberDeclaration
 
10
        {
 
11
                public ExternalMethodDeclaration()
 
12
                {
 
13
                }
 
14
                
 
15
                public CharsetModifier CharsetModifier { get; set; }
 
16
                
 
17
                public bool IsSub { get; set; }
 
18
                
 
19
                public Identifier Name {
 
20
                        get { return GetChildByRole(Roles.Identifier); }
 
21
                        set { SetChildByRole(Roles.Identifier, value); }
 
22
                }
 
23
                
 
24
                public string Library { get; set; }
 
25
                
 
26
                public string Alias { get; set; }
 
27
                
 
28
                public AstNodeCollection<ParameterDeclaration> Parameters {
 
29
                        get { return GetChildrenByRole(Roles.Parameter); }
 
30
                }
 
31
                
 
32
                public AstNodeCollection<AttributeBlock> ReturnTypeAttributes {
 
33
                        get { return GetChildrenByRole(AttributeBlock.ReturnTypeAttributeBlockRole); }
 
34
                }
 
35
                
 
36
                public AstType ReturnType {
 
37
                        get { return GetChildByRole(Roles.Type); }
 
38
                        set { SetChildByRole(Roles.Type, value); }
 
39
                }
 
40
                                
 
41
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
42
                {
 
43
                        // TODO : finish
 
44
                        var method = other as ExternalMethodDeclaration;
 
45
                        return method != null &&
 
46
                                MatchAttributesAndModifiers(method, match) &&
 
47
                                IsSub == method.IsSub &&
 
48
                                Name.DoMatch(method.Name, match) &&
 
49
                                Parameters.DoMatch(method.Parameters, match) &&
 
50
                                ReturnTypeAttributes.DoMatch(method.ReturnTypeAttributes, match) &&
 
51
                                ReturnType.DoMatch(method.ReturnType, match);
 
52
                }
 
53
                
 
54
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
55
                {
 
56
                        return visitor.VisitExternalMethodDeclaration(this, data);
 
57
                }
 
58
        }
 
59
        
 
60
        ///<summary>
 
61
        /// Charset types, used in external methods
 
62
        /// declarations (VB only).
 
63
        ///</summary>
 
64
        public enum CharsetModifier
 
65
        {
 
66
                None,
 
67
                Auto,
 
68
                Unicode,
 
69
                Ansi
 
70
        }
 
71
}