mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
EventMemberSpecifier, InterfaceMemberSpecifier for Handles and Implements clausespull/254/head
10 changed files with 403 additions and 20 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.NRefactory.VB.Ast |
||||
{ |
||||
public class EventMemberSpecifier : AstNode |
||||
{ |
||||
public static readonly Role<EventMemberSpecifier> EventMemberSpecifierRole = new Role<EventMemberSpecifier>("EventMemberSpecifier"); |
||||
|
||||
public EventMemberSpecifier() |
||||
{ |
||||
} |
||||
|
||||
public Expression Target { |
||||
get { return GetChildByRole(Roles.Expression); } |
||||
set { SetChildByRole(Roles.Expression, value); } |
||||
} |
||||
|
||||
public Identifier Member { |
||||
get { return GetChildByRole(Roles.Identifier); } |
||||
set { SetChildByRole(Roles.Identifier, value); } |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) |
||||
{ |
||||
var expr = other as EventMemberSpecifier; |
||||
return expr != null && |
||||
Target.DoMatch(expr.Target, match) && |
||||
Member.DoMatch(expr.Member, match); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitEventMemberSpecifier(this, data); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.NRefactory.VB.Ast |
||||
{ |
||||
public class InterfaceMemberSpecifier : AstNode |
||||
{ |
||||
public static readonly Role<InterfaceMemberSpecifier> InterfaceMemberSpecifierRole = new Role<InterfaceMemberSpecifier>("InterfaceMemberSpecifier"); |
||||
|
||||
public InterfaceMemberSpecifier(Expression target, Identifier member) |
||||
{ |
||||
Target = target; |
||||
Member = member; |
||||
} |
||||
|
||||
public InterfaceMemberSpecifier(AstType target, string member) |
||||
{ |
||||
Target = new TypeReferenceExpression(target); |
||||
Member = new Identifier(member, AstLocation.Empty); |
||||
} |
||||
|
||||
public Expression Target { |
||||
get { return GetChildByRole(Roles.Expression); } |
||||
set { SetChildByRole(Roles.Expression, value); } |
||||
} |
||||
|
||||
public Identifier Member { |
||||
get { return GetChildByRole(Roles.Identifier); } |
||||
set { SetChildByRole(Roles.Identifier, value); } |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) |
||||
{ |
||||
var expr = other as InterfaceMemberSpecifier; |
||||
return expr != null && |
||||
Target.DoMatch(expr.Target, match) && |
||||
Member.DoMatch(expr.Member, match); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitInterfaceMemberSpecifier(this, data); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.NRefactory.VB.Ast |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ConstructorDeclaration.
|
||||
/// </summary>
|
||||
public class ConstructorDeclaration : AttributedNode |
||||
{ |
||||
public ConstructorDeclaration() |
||||
{ |
||||
} |
||||
|
||||
public AstNodeCollection<ParameterDeclaration> Parameters { |
||||
get { return GetChildrenByRole(Roles.Parameter); } |
||||
} |
||||
|
||||
public BlockStatement Body { |
||||
get { return GetChildByRole(Roles.Body); } |
||||
set { SetChildByRole(Roles.Body, value); } |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) |
||||
{ |
||||
var ctor = other as ConstructorDeclaration; |
||||
return ctor != null && |
||||
MatchAttributesAndModifiers(ctor, match) && |
||||
Parameters.DoMatch(ctor.Parameters, match) && |
||||
Body.DoMatch(ctor.Body, match); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitConstructorDeclaration(this, data); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.NRefactory.VB.Ast |
||||
{ |
||||
public class MethodDeclaration : AttributedNode |
||||
{ |
||||
public MethodDeclaration() |
||||
{ |
||||
} |
||||
|
||||
public bool IsSub { get; set; } |
||||
|
||||
public Identifier Name { |
||||
get { return GetChildByRole(Roles.Identifier); } |
||||
set { SetChildByRole(Roles.Identifier, value); } |
||||
} |
||||
|
||||
public AstNodeCollection<TypeParameterDeclaration> TypeParameters { |
||||
get { return GetChildrenByRole(Roles.TypeParameter); } |
||||
} |
||||
|
||||
public AstNodeCollection<ParameterDeclaration> Parameters { |
||||
get { return GetChildrenByRole(Roles.Parameter); } |
||||
} |
||||
|
||||
public AstNodeCollection<AttributeBlock> ReturnTypeAttributes { |
||||
get { return GetChildrenByRole(AttributeBlock.ReturnTypeAttributeBlockRole); } |
||||
} |
||||
|
||||
public AstType ReturnType { |
||||
get { return GetChildByRole(Roles.Type); } |
||||
set { SetChildByRole(Roles.Type, value); } |
||||
} |
||||
|
||||
public AstNodeCollection<EventMemberSpecifier> HandlesClause { |
||||
get { return GetChildrenByRole(EventMemberSpecifier.EventMemberSpecifierRole); } |
||||
} |
||||
|
||||
public AstNodeCollection<InterfaceMemberSpecifier> ImplementsClause { |
||||
get { return GetChildrenByRole(InterfaceMemberSpecifier.InterfaceMemberSpecifierRole); } |
||||
} |
||||
|
||||
public BlockStatement Body { |
||||
get { return GetChildByRole(Roles.Body); } |
||||
set { SetChildByRole(Roles.Body, value); } |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) |
||||
{ |
||||
var method = other as MethodDeclaration; |
||||
return method != null && |
||||
MatchAttributesAndModifiers(method, match) && |
||||
IsSub == method.IsSub && |
||||
Name.DoMatch(method.Name, match) && |
||||
TypeParameters.DoMatch(method.TypeParameters, match) && |
||||
Parameters.DoMatch(method.Parameters, match) && |
||||
ReturnTypeAttributes.DoMatch(method.ReturnTypeAttributes, match) && |
||||
ReturnType.DoMatch(method.ReturnType, match) && |
||||
HandlesClause.DoMatch(method.HandlesClause, match) && |
||||
ImplementsClause.DoMatch(method.ImplementsClause, match) && |
||||
Body.DoMatch(method.Body, match); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitMethodDeclaration(this, data); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue