本文整理汇总了C#中MemberReferenceExpression.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# MemberReferenceExpression.AddChild方法的具体用法?C# MemberReferenceExpression.AddChild怎么用?C# MemberReferenceExpression.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberReferenceExpression
的用法示例。
在下文中一共展示了MemberReferenceExpression.AddChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit (MemberAccess memberAccess)
{
var result = new MemberReferenceExpression ();
result.AddChild ((INode)memberAccess.LeftExpression.Accept (this), MemberReferenceExpression.Roles.TargetExpression);
result.AddChild (new Identifier (memberAccess.Name, Convert (memberAccess.Location)), MemberReferenceExpression.Roles.Identifier);
if (memberAccess.TypeArguments != null) {
var location = LocationsBag.GetLocations (memberAccess);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), MemberReferenceExpression.Roles.LChevron);
// AddTypeArguments (result, location, memberAccess.TypeArguments);
if (location != null && location.Count > 1)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), MemberReferenceExpression.Roles.RChevron);
}
return result;
}
示例2: Visit
public override object Visit (MemberAccess memberAccess)
{
Expression result;
if (memberAccess.LeftExpression is Indirection) {
var ind = memberAccess.LeftExpression as Indirection;
result = new PointerReferenceExpression ();
result.AddChild ((Expression)ind.Expr.Accept (this), PointerReferenceExpression.Roles.TargetExpression);
result.AddChild (new CSharpTokenNode (Convert (ind.Location), "->".Length), PointerReferenceExpression.ArrowRole);
} else {
result = new MemberReferenceExpression ();
if (memberAccess.LeftExpression != null) {
var leftExpr = memberAccess.LeftExpression.Accept (this);
result.AddChild ((Expression)leftExpr, MemberReferenceExpression.Roles.TargetExpression);
}
if (!memberAccess.DotLocation.IsNull) {
result.AddChild (new CSharpTokenNode (Convert (memberAccess.DotLocation), 1), MemberReferenceExpression.Roles.Dot);
}
}
result.AddChild (Identifier.Create (memberAccess.Name, Convert (memberAccess.Location)), MemberReferenceExpression.Roles.Identifier);
if (memberAccess.TypeArguments != null) {
AddTypeArguments (result, memberAccess.TypeArguments);
}
return result;
}
示例3: Visit
public override object Visit(MemberAccess memberAccess)
{
Expression result;
var ind = memberAccess.LeftExpression as Indirection;
if (ind != null) {
result = new PointerReferenceExpression();
result.AddChild((Expression)ind.Expr.Accept(this), Roles.TargetExpression);
result.AddChild(new CSharpTokenNode(Convert(ind.Location), PointerReferenceExpression.ArrowRole), PointerReferenceExpression.ArrowRole);
} else {
result = new MemberReferenceExpression();
if (memberAccess.LeftExpression != null) {
var leftExpr = memberAccess.LeftExpression.Accept(this);
result.AddChild((Expression)leftExpr, Roles.TargetExpression);
}
var loc = LocationsBag.GetLocations(memberAccess);
if (loc != null) {
result.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Dot), Roles.Dot);
}
}
result.AddChild(Identifier.Create(memberAccess.Name, Convert(memberAccess.Location)), Roles.Identifier);
AddTypeArguments(result, memberAccess);
return result;
}
示例4: Visit
public override object Visit (MemberAccess memberAccess)
{
Expression result;
Console.WriteLine (memberAccess.LeftExpression + "/" + memberAccess.Name);
if (memberAccess.LeftExpression is Indirection) {
var ind = memberAccess.LeftExpression as Indirection;
result = new PointerReferenceExpression ();
result.AddChild ((Expression)ind.Expr.Accept (this), PointerReferenceExpression.Roles.TargetExpression);
result.AddChild (new CSharpTokenNode (Convert (ind.Location), "->".Length), PointerReferenceExpression.ArrowRole);
} else {
result = new MemberReferenceExpression ();
if (memberAccess.LeftExpression != null) {
var leftExpr = memberAccess.LeftExpression.Accept (this);
result.AddChild ((Expression)leftExpr, MemberReferenceExpression.Roles.TargetExpression);
}
}
result.AddChild (new Identifier (memberAccess.Name, Convert (memberAccess.Location)), MemberReferenceExpression.Roles.Identifier);
if (memberAccess.TypeArguments != null) {
var location = LocationsBag.GetLocations (memberAccess);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location [0]), 1), MemberReferenceExpression.Roles.LChevron);
AddTypeArguments (result, location, memberAccess.TypeArguments);
if (location != null && location.Count > 1)
result.AddChild (new CSharpTokenNode (Convert (location [1]), 1), MemberReferenceExpression.Roles.RChevron);
}
return result;
}