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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Ast/GlobalScope/TypeDeclaration.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.Collections.Generic;
 
6
using System.Linq;
 
7
using ICSharpCode.NRefactory.TypeSystem;
 
8
 
 
9
namespace ICSharpCode.NRefactory.VB.Ast
 
10
{
 
11
        public enum ClassType
 
12
        {
 
13
                Class,
 
14
                Struct,
 
15
                Interface,
 
16
                Module
 
17
        }
 
18
        
 
19
        public class TypeDeclaration : AttributedNode
 
20
        {
 
21
                public readonly static Role<AttributedNode> MemberRole = new Role<AttributedNode>("Member");
 
22
                public readonly static Role<AstType> InheritsTypeRole = new Role<AstType>("InheritsType", AstType.Null);
 
23
                public readonly static Role<AstType> ImplementsTypesRole = new Role<AstType>("ImplementsTypes", AstType.Null);
 
24
 
 
25
                public AstNodeCollection<AttributedNode> Members {
 
26
                        get { return base.GetChildrenByRole(MemberRole); }
 
27
                }
 
28
                
 
29
                public ClassType ClassType { get; set; }
 
30
                
 
31
                public Identifier Name {
 
32
                        get { return GetChildByRole(Roles.Identifier); }
 
33
                        set { SetChildByRole(Roles.Identifier, value); }
 
34
                }
 
35
                
 
36
                public AstNodeCollection<TypeParameterDeclaration> TypeParameters {
 
37
                        get { return GetChildrenByRole(Roles.TypeParameter); }
 
38
                }
 
39
                
 
40
                public AstType InheritsType {
 
41
                        get { return GetChildByRole(InheritsTypeRole); }
 
42
                        set { SetChildByRole(InheritsTypeRole, value); }
 
43
                }
 
44
                
 
45
                public AstNodeCollection<AstType> ImplementsTypes {
 
46
                        get { return GetChildrenByRole(ImplementsTypesRole); }
 
47
                }
 
48
                
 
49
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
50
                {
 
51
                        TypeDeclaration t = other as TypeDeclaration;
 
52
                        return t != null &&
 
53
                                MatchAttributesAndModifiers(t, match) &&
 
54
                                Members.DoMatch(t.Members, match) &&
 
55
                                ClassType == t.ClassType &&
 
56
                                Name.DoMatch(t.Name, match) &&
 
57
                                TypeParameters.DoMatch(t.TypeParameters, match) &&
 
58
                                InheritsType.DoMatch(t.InheritsType, match) &&
 
59
                                ImplementsTypes.DoMatch(t.ImplementsTypes, match);
 
60
                }
 
61
                
 
62
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
63
                {
 
64
                        return visitor.VisitTypeDeclaration(this, data);
 
65
                }
 
66
        }
 
67
}