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)
5
using System.Collections.Generic;
8
using ICSharpCode.NRefactory.TypeSystem;
10
namespace ICSharpCode.NRefactory.VB.Ast
13
/// [In|Out] Name [As Contraints]
15
/// Represents a type parameter.
17
public class TypeParameterDeclaration : AstNode
19
public static readonly Role<AstType> TypeConstraintRole = TypeDeclaration.InheritsTypeRole;
20
public static readonly Role<VBTokenNode> VarianceRole = new Role<VBTokenNode>("Variance");
22
public VarianceModifier Variance { get; set; }
25
get { return GetChildByRole (Roles.Identifier).Name; }
26
set { SetChildByRole(Roles.Identifier, new Identifier (value, TextLocation.Empty)); }
29
public AstNodeCollection<AstType> Constraints {
30
get { return GetChildrenByRole(TypeConstraintRole); }
33
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
35
return visitor.VisitTypeParameterDeclaration(this, data);
38
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
40
TypeParameterDeclaration o = other as TypeParameterDeclaration;
41
return o != null && this.Variance == o.Variance
42
&& MatchString(this.Name, o.Name)
43
&& this.Constraints.DoMatch(o.Constraints, match);