public override void Visit(Interface i) { var newType = new TypeDeclaration(); newType.ClassType = ClassType.Interface; AddAttributeSection(newType, i); var location = LocationsBag.GetMemberLocation(i); AddModifiers(newType, location); int curLoc = 0; if (location != null && location.Count > 0) newType.AddChild(new CSharpTokenNode(Convert(location [curLoc++]), Roles.InterfaceKeyword), Roles.InterfaceKeyword); newType.AddChild(Identifier.Create(i.MemberName.Name, Convert(i.MemberName.Location)), Roles.Identifier); AddTypeParameters(newType, i.MemberName); if (i.TypeBaseExpressions != null) { if (location != null && curLoc < location.Count) newType.AddChild(new CSharpTokenNode(Convert(location [curLoc++]), Roles.Colon), Roles.Colon); var commaLocations = LocationsBag.GetLocations(i.TypeBaseExpressions); int j = 0; foreach (var baseTypes in i.TypeBaseExpressions) { newType.AddChild(ConvertToType(baseTypes), Roles.BaseType); if (commaLocations != null && j < commaLocations.Count) { newType.AddChild(new CSharpTokenNode(Convert(commaLocations [j]), Roles.Comma), Roles.Comma); j++; } } } AddConstraints(newType, i.CurrentTypeParameters); if (location != null && curLoc < location.Count) newType.AddChild(new CSharpTokenNode(Convert(location [curLoc++]), Roles.LBrace), Roles.LBrace); typeStack.Push(newType); base.Visit(i); if (location != null && location.Count > 2) { if (location != null && curLoc < location.Count) newType.AddChild(new CSharpTokenNode(Convert(location [curLoc++]), Roles.RBrace), Roles.RBrace); if (location != null && curLoc < location.Count) newType.AddChild(new CSharpTokenNode(Convert(location [curLoc++]), Roles.Semicolon), Roles.Semicolon); } else { // parser error, set end node to max value. newType.AddChild(new ErrorNode(), Roles.Error); } typeStack.Pop(); AddType(newType); }
public virtual void Visit (Interface i) { VisitTypeDefinition (i); }