本文整理汇总了C#中DelegateDeclaration.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# DelegateDeclaration.AddChild方法的具体用法?C# DelegateDeclaration.AddChild怎么用?C# DelegateDeclaration.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DelegateDeclaration
的用法示例。
在下文中一共展示了DelegateDeclaration.AddChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override void Visit(Mono.CSharp.Delegate d)
{
var newDelegate = new DelegateDeclaration();
var location = LocationsBag.GetMemberLocation(d);
AddAttributeSection(newDelegate, d);
AddModifiers(newDelegate, location);
if (location != null && location.Count > 0) {
newDelegate.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.DelegateKeyword), Roles.DelegateKeyword);
}
if (d.ReturnType != null)
newDelegate.AddChild(ConvertToType(d.ReturnType), Roles.Type);
newDelegate.AddChild(Identifier.Create(d.MemberName.Name, Convert(d.MemberName.Location)), Roles.Identifier);
AddTypeParameters(newDelegate, d.MemberName);
if (location != null && location.Count > 1)
newDelegate.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.LPar), Roles.LPar);
AddParameter(newDelegate, d.Parameters);
if (location != null && location.Count > 2) {
newDelegate.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.RPar), Roles.RPar);
}
AddConstraints(newDelegate, d.CurrentTypeParameters);
if (location != null && location.Count > 3) {
newDelegate.AddChild(new CSharpTokenNode(Convert(location [3]), Roles.Semicolon), Roles.Semicolon);
}
AddType(newDelegate);
}
示例2: Visit
public override void Visit (Mono.CSharp.Delegate d)
{
DelegateDeclaration newDelegate = new DelegateDeclaration ();
var location = LocationsBag.GetMemberLocation (d);
AddModifiers (newDelegate, location);
if (location != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (location[0]), "delegate".Length), TypeDeclaration.TypeKeyword);
newDelegate.AddChild ((INode)d.ReturnType.Accept (this), AbstractNode.Roles.ReturnType);
newDelegate.AddChild (new Identifier (d.Name, Convert (d.MemberName.Location)), AbstractNode.Roles.Identifier);
if (d.MemberName.TypeArguments != null) {
var typeArgLocation = LocationsBag.GetLocations (d.MemberName);
if (typeArgLocation != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[0]), 1), MemberReferenceExpression.Roles.LChevron);
// AddTypeArguments (newDelegate, typeArgLocation, d.MemberName.TypeArguments);
if (typeArgLocation != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (typeArgLocation[1]), 1), MemberReferenceExpression.Roles.RChevron);
AddConstraints (newDelegate, d);
}
if (location != null) {
newDelegate.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DelegateDeclaration.Roles.LPar);
newDelegate.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DelegateDeclaration.Roles.RPar);
newDelegate.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DelegateDeclaration.Roles.Semicolon);
}
AddType (newDelegate);
}
示例3: Visit
public override void Visit (Mono.CSharp.Delegate d)
{
DelegateDeclaration newDelegate = new DelegateDeclaration ();
var location = LocationsBag.GetMemberLocation (d);
AddAttributeSection (newDelegate, d);
AddModifiers (newDelegate, location);
if (location != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (location[0]), "delegate".Length), TypeDeclaration.Roles.Keyword);
newDelegate.AddChild (ConvertToType (d.ReturnType), AstNode.Roles.Type);
newDelegate.AddChild (Identifier.Create (d.MemberName.Name, Convert (d.MemberName.Location)), AstNode.Roles.Identifier);
if (d.MemberName.TypeArguments != null) {
AddTypeParameters (newDelegate, d.MemberName.TypeArguments);
}
if (location != null)
newDelegate.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DelegateDeclaration.Roles.LPar);
AddParameter (newDelegate, d.Parameters);
if (location != null) {
newDelegate.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DelegateDeclaration.Roles.RPar);
}
AddConstraints (newDelegate, d);
if (location != null) {
newDelegate.AddChild (new CSharpTokenNode (Convert (location[3]), 1), DelegateDeclaration.Roles.Semicolon);
}
AddType (newDelegate);
}