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; }
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; }
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; }
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; }