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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Ast/GlobalScope/ImportsClause.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
using System;
 
4
using System.Collections.Generic;
 
5
 
 
6
namespace ICSharpCode.NRefactory.VB.Ast
 
7
{
 
8
        public abstract class ImportsClause : AstNode
 
9
        {
 
10
                public new static readonly ImportsClause Null = new NullImportsClause();
 
11
                
 
12
                class NullImportsClause : ImportsClause
 
13
                {
 
14
                        public override bool IsNull {
 
15
                                get { return true; }
 
16
                        }
 
17
                        
 
18
                        protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
19
                        {
 
20
                                return other != null && other.IsNull;
 
21
                        }
 
22
                        
 
23
                        public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
24
                        {
 
25
                                return default(S);
 
26
                        }
 
27
                }
 
28
        }
 
29
        
 
30
        public class AliasImportsClause : ImportsClause
 
31
        {
 
32
                public Identifier Name {
 
33
                        get { return GetChildByRole(Roles.Identifier); }
 
34
                        set { SetChildByRole(Roles.Identifier, value); }
 
35
                }
 
36
                
 
37
                public AstType Alias {
 
38
                        get { return GetChildByRole(Roles.Type); }
 
39
                        set { SetChildByRole(Roles.Type, value); }
 
40
                }
 
41
                
 
42
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
43
                {
 
44
                        var clause = other as AliasImportsClause;
 
45
                        return clause != null
 
46
                                && Name.DoMatch(clause.Name, match)
 
47
                                && Alias.DoMatch(clause.Alias, match);
 
48
                }
 
49
                
 
50
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
51
                {
 
52
                        return visitor.VisitAliasImportsClause(this, data);
 
53
                }
 
54
                
 
55
                public override string ToString() {
 
56
                        return string.Format("[AliasImportsClause Name={0} Alias={1}]", Name, Alias);
 
57
                }
 
58
        }
 
59
        
 
60
        public class MemberImportsClause : ImportsClause
 
61
        {
 
62
                public AstType Member {
 
63
                        get { return GetChildByRole(Roles.Type); }
 
64
                        set { SetChildByRole(Roles.Type, value); }
 
65
                }
 
66
                
 
67
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
68
                {
 
69
                        var node = other as MemberImportsClause;
 
70
                        return node != null
 
71
                                && Member.DoMatch(node.Member, match);
 
72
                }
 
73
                
 
74
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
75
                {
 
76
                        return visitor.VisitMemberImportsClause(this, data);
 
77
                }
 
78
                
 
79
                public override string ToString()
 
80
                {
 
81
                        return string.Format("[MemberImportsClause Member={0}]", Member);
 
82
                }
 
83
        }
 
84
        
 
85
        public class XmlNamespaceImportsClause : ImportsClause
 
86
        {
 
87
                public XmlIdentifier Prefix {
 
88
                        get { return GetChildByRole(Roles.XmlIdentifier); }
 
89
                        set { SetChildByRole(Roles.XmlIdentifier, value); }
 
90
                }
 
91
                
 
92
                public XmlLiteralString Namespace {
 
93
                        get { return GetChildByRole(Roles.XmlLiteralString); }
 
94
                        set { SetChildByRole(Roles.XmlLiteralString, value); }
 
95
                }
 
96
                
 
97
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
98
                {
 
99
                        var clause = other as XmlNamespaceImportsClause;
 
100
                        return clause != null && Namespace.DoMatch(clause.Namespace, match) && Prefix.DoMatch(clause.Prefix, match);
 
101
                }
 
102
                
 
103
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
104
                {
 
105
                        return visitor.VisitXmlNamespaceImportsClause(this, data);
 
106
                }
 
107
                
 
108
                public override string ToString()
 
109
                {
 
110
                        return string.Format("[XmlNamespaceImportsClause Prefix={0}, Namespace={1}]", Prefix, Namespace);
 
111
                }
 
112
        }
 
113
}