public override void VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration)
        {
            ForceSpacesBefore(delegateDeclaration.LParToken, policy.SpaceBeforeDelegateDeclarationParentheses);
            if (delegateDeclaration.Parameters.Any())
            {
                ForceSpacesAfter(delegateDeclaration.LParToken, policy.SpaceWithinDelegateDeclarationParentheses);
                ForceSpacesBefore(delegateDeclaration.RParToken, policy.SpaceWithinDelegateDeclarationParentheses);
            }
            else
            {
                ForceSpacesAfter(delegateDeclaration.LParToken, policy.SpaceBetweenEmptyDelegateDeclarationParentheses);
                ForceSpacesBefore(delegateDeclaration.RParToken, policy.SpaceBetweenEmptyDelegateDeclarationParentheses);
            }
            FormatCommas(delegateDeclaration, policy.SpaceBeforeDelegateDeclarationParameterComma, policy.SpaceAfterDelegateDeclarationParameterComma);

            base.VisitDelegateDeclaration(delegateDeclaration);
        }
Exemple #2
0
        public bool CheckDelegate(ICS.DelegateDeclaration node, InspectionData data)
        {
            if ((MatchKind != 0 && (MatchKind & DeclarationKinds.Delegate) == 0) || !CheckAttributedNode(node, ICS.Modifiers.Internal))
            {
                return(false);
            }

            string name = node.Name;

            if (IsValid(name))
            {
                return(true);
            }

            data.Add(GetFixableResult(node.NameToken.StartLocation, null, name));
            return(true);
        }
        public override IEntity VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
        {
            var td = currentTypeDefinition = CreateTypeDefinition(delegateDeclaration.Name);

            td.ClassType = ClassType.Delegate;
            td.Region    = MakeRegion(delegateDeclaration);
            td.BaseTypes.Add(multicastDelegateReference);

            ConvertAttributes(td.Attributes, delegateDeclaration.Attributes);
            ApplyModifiers(td, delegateDeclaration.Modifiers);
            td.IsSealed = true;             // delegates are implicitly sealed

            ConvertTypeParameters(td.TypeParameters, delegateDeclaration.TypeParameters, delegateDeclaration.Constraints);

            ITypeReference    returnType = ConvertType(delegateDeclaration.ReturnType);
            List <IParameter> parameters = new List <IParameter>();

            ConvertParameters(parameters, delegateDeclaration.Parameters);
            AddDefaultMethodsToDelegate(td, returnType, parameters);

            currentTypeDefinition = (DefaultTypeDefinition)currentTypeDefinition.DeclaringTypeDefinition;
            return(td);
        }
 void IAstVisitor.VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration)
 {
     Visit(EnterDelegateDeclaration, LeaveDelegateDeclaration, delegateDeclaration);
 }
 public virtual S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, T data)
 {
     return(VisitChildren(delegateDeclaration, data));
 }
 public virtual S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, T data)
 {
     throw new NotImplementedException();
 }