当前位置: 首页>>代码示例>>C#>>正文


C# CustomEventDeclaration类代码示例

本文整理汇总了C#中CustomEventDeclaration的典型用法代码示例。如果您正苦于以下问题:C# CustomEventDeclaration类的具体用法?C# CustomEventDeclaration怎么用?C# CustomEventDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CustomEventDeclaration类属于命名空间,在下文中一共展示了CustomEventDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitCustomEventDeclaration

			public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
			{
				var addAccessor = eventDeclaration.AddAccessor;
				FindIssuesInNode(addAccessor, addAccessor.Body, "add accessor");
				var removeAccessor = eventDeclaration.RemoveAccessor;
				FindIssuesInNode(removeAccessor, removeAccessor.Body, "remove accessor");
			}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:ValueParameterUnusedIssue.cs

示例2: VisitCustomEventDeclaration

 public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
 {
     if (eventDeclaration.Modifiers.HasFlag (Modifiers.Override))
         return;
     base.VisitCustomEventDeclaration(eventDeclaration);
     CheckName(eventDeclaration, AffectedEntity.Event, eventDeclaration.NameToken, GetAccessibiltiy(eventDeclaration, Modifiers.Private));
 }
开发者ID:artifexor,项目名称:NRefactory,代码行数:7,代码来源:InconsistentNamingIssue.cs

示例3: Create

        public static OverloadsCollection Create(IEmitter emitter, CustomEventDeclaration eventDeclaration, bool remove)
        {
            string key = eventDeclaration.GetHashCode().ToString() + remove.GetHashCode().ToString();
            if (emitter.OverloadsCache.ContainsKey(key))
            {
                return emitter.OverloadsCache[key];
            }

            return new OverloadsCollection(emitter, eventDeclaration, remove);
        }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:10,代码来源:OverloadsCollection.cs

示例4: VisitCustomEventDeclaration

 public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
 {
     var addAccessor = eventDeclaration.AddAccessor;
     var removeAccessor = eventDeclaration.RemoveAccessor;
     // don't warn on empty custom events
     if (addAccessor.Body.Statements.Count == 0 && removeAccessor.Body.Statements.Count == 0)
         return;
     FindIssuesInAccessor(addAccessor, "add accessor");
     FindIssuesInAccessor(removeAccessor, "remove accessor");
 }
开发者ID:artifexor,项目名称:NRefactory,代码行数:10,代码来源:ValueParameterUnusedIssue.cs

示例5: OverloadsCollection

 private OverloadsCollection(IEmitter emitter, CustomEventDeclaration eventDeclaration, bool remove)
 {
     this.Emitter = emitter;
     this.Name = eventDeclaration.Name;
     this.JsName = Helpers.GetEventRef(eventDeclaration, emitter, remove, true);
     this.AltJsName = Helpers.GetEventRef(eventDeclaration, emitter, !remove, true);
     this.Inherit = !eventDeclaration.HasModifier(Modifiers.Static);
     this.CancelChangeCase = true;
     this.IsSetter = remove;
     this.Static = eventDeclaration.HasModifier(Modifiers.Static);
     this.Member = this.FindMember(eventDeclaration);
     this.TypeDefinition = this.Member.DeclaringTypeDefinition;
     this.Type = this.Member.DeclaringType;
     this.InitMembers();
     this.Emitter.OverloadsCache[eventDeclaration.GetHashCode().ToString() + remove.GetHashCode().ToString()] = this;
 }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:16,代码来源:OverloadsCollection.cs

示例6: EmitPropertyMethod

        protected virtual void EmitPropertyMethod(CustomEventDeclaration customEventDeclaration, Accessor accessor, bool remover)
        {
            if (!accessor.IsNull && this.Emitter.GetInline(accessor) == null)
            {
                this.EnsureComma();

                this.ResetLocals();

                var prevMap = this.BuildLocalsMap();
                var prevNamesMap = this.BuildLocalsNamesMap();

                this.AddLocals(new ParameterDeclaration[] { new ParameterDeclaration { Name = "value" } }, accessor.Body);
                XmlToJsDoc.EmitComment(this, this.CustomEventDeclaration);
                var overloads = OverloadsCollection.Create(this.Emitter, customEventDeclaration, remover);

                this.Write((remover ? "remove" : "add") + overloads.GetOverloadName());
                this.WriteColon();
                this.WriteFunction();
                this.WriteOpenParentheses();
                this.Write("value");
                this.WriteCloseParentheses();
                this.WriteSpace();

                var script = this.Emitter.GetScript(accessor);

                if (script == null)
                {
                    accessor.Body.AcceptVisitor(this.Emitter);
                }
                else
                {
                    this.BeginBlock();

                    foreach (var line in script)
                    {
                        this.Write(line);
                        this.WriteNewLine();
                    }

                    this.EndBlock();
                }

                this.ClearLocalsMap(prevMap);
                this.ClearLocalsNamesMap(prevNamesMap);
                this.Emitter.Comma = true;
            }
        }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:47,代码来源:VisitorCustomEventBlock.cs

示例7: VisitCustomEventDeclaration

        public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
        {
            FixAttributesAndDocComment(eventDeclaration);

            FixOpenBrace(policy.EventBraceStyle, eventDeclaration.LBraceToken);
            if (policy.IndentEventBody)
                curIndent.Push(IndentType.Block);

            if (!eventDeclaration.AddAccessor.IsNull) {
                FixIndentation(eventDeclaration.AddAccessor);
                if (!eventDeclaration.AddAccessor.Body.IsNull) {
                    if (!policy.AllowEventAddBlockInline || eventDeclaration.AddAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.AddAccessor.Body.RBraceToken.StartLocation.Line) {
                        FixOpenBrace(policy.EventAddBraceStyle, eventDeclaration.AddAccessor.Body.LBraceToken);
                        VisitBlockWithoutFixingBraces(eventDeclaration.AddAccessor.Body, policy.IndentBlocks);
                        FixClosingBrace(policy.EventAddBraceStyle, eventDeclaration.AddAccessor.Body.RBraceToken);
                    } else {
                        nextStatementIndent = " ";
                        VisitBlockWithoutFixingBraces(eventDeclaration.AddAccessor.Body, policy.IndentBlocks);
                    }
                }
            }

            if (!eventDeclaration.RemoveAccessor.IsNull) {
                FixIndentation(eventDeclaration.RemoveAccessor);
                if (!eventDeclaration.RemoveAccessor.Body.IsNull) {
                    if (!policy.AllowEventRemoveBlockInline || eventDeclaration.RemoveAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.RemoveAccessor.Body.RBraceToken.StartLocation.Line) {
                        FixOpenBrace(policy.EventRemoveBraceStyle, eventDeclaration.RemoveAccessor.Body.LBraceToken);
                        VisitBlockWithoutFixingBraces(eventDeclaration.RemoveAccessor.Body, policy.IndentBlocks);
                        FixClosingBrace(policy.EventRemoveBraceStyle, eventDeclaration.RemoveAccessor.Body.RBraceToken);
                    } else {
                        nextStatementIndent = " ";
                        VisitBlockWithoutFixingBraces(eventDeclaration.RemoveAccessor.Body, policy.IndentBlocks);
                    }
                }
            }

            if (policy.IndentEventBody)
                curIndent.Pop();

            FixClosingBrace(policy.EventBraceStyle, eventDeclaration.RBraceToken);
        }
开发者ID:porcus,项目名称:NRefactory,代码行数:41,代码来源:FormattingVisitor_TypeMembers.cs

示例8: EmitPropertyMethod

        protected virtual void EmitPropertyMethod(CustomEventDeclaration customEventDeclaration, Accessor accessor, bool remover)
        {
            if (!accessor.IsNull && this.Emitter.GetInline(accessor) == null)
            {
                var overloads = OverloadsCollection.Create(this.Emitter, customEventDeclaration, remover);

                this.Write((remover ? "remove" : "add") + overloads.GetOverloadName());
                this.WriteOpenParentheses();
                this.Write("value");
                this.WriteColon();
                var retType = BridgeTypes.ToJsName(customEventDeclaration.ReturnType, this.Emitter);
                retType = EmitBlock.HandleType(retType);
                this.Write(retType);
                this.WriteCloseParentheses();
                this.WriteColon();
                this.Write("void");

                this.WriteSemiColon();
                this.WriteNewLine();
            }
        }
开发者ID:Oaz,项目名称:bridgedotnet_Builder,代码行数:21,代码来源:CustomEventBlock.cs

示例9: VisitCustomEventDeclaration

        public override void VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration)
        {
            if (customEventDeclaration.HasModifier(Modifiers.Abstract))
            {
                return;
            }

            bool isStatic = customEventDeclaration.HasModifier(Modifiers.Static);

            IDictionary<string, List<EntityDeclaration>> dict = isStatic
                ? CurrentType.StaticProperties
                : CurrentType.InstanceProperties;

            var key = customEventDeclaration.Name;

            if (dict.ContainsKey(key))
                {
                dict[key].Add(customEventDeclaration);
                }
                else
                {
                dict.Add(key, new List<EntityDeclaration>(new[] { customEventDeclaration }));
            }
        }
开发者ID:Oaz,项目名称:bridgedotnet_Builder,代码行数:24,代码来源:Inspector.Visitor.cs

示例10: ConvertEvent

 EntityDeclaration ConvertEvent(IEvent ev)
 {
     if (this.UseCustomEvents) {
         CustomEventDeclaration decl = new CustomEventDeclaration();
         decl.Modifiers = GetMemberModifiers(ev);
         decl.ReturnType = ConvertType(ev.ReturnType);
         decl.Name = ev.Name;
         decl.AddAccessor    = ConvertAccessor(ev.AddAccessor, ev.Accessibility);
         decl.RemoveAccessor = ConvertAccessor(ev.RemoveAccessor, ev.Accessibility);
         return decl;
     } else {
         EventDeclaration decl = new EventDeclaration();
         decl.Modifiers = GetMemberModifiers(ev);
         decl.ReturnType = ConvertType(ev.ReturnType);
         decl.Variables.Add(new VariableInitializer(ev.Name));
         return decl;
     }
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:18,代码来源:TypeSystemAstBuilder.cs

示例11: VisitCustomEventDeclaration

		public virtual void VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration)
		{
			StartNode(customEventDeclaration);
			WriteAttributes(customEventDeclaration.Attributes);
			WriteModifiers(customEventDeclaration.ModifierTokens);
			WriteKeyword(CustomEventDeclaration.EventKeywordRole);
			customEventDeclaration.ReturnType.AcceptVisitor(this);
			Space();
			WritePrivateImplementationType(customEventDeclaration.PrivateImplementationType);
			WriteIdentifier(customEventDeclaration.NameToken);
			var braceHelper = OpenBrace(policy.EventBraceStyle, CodeBracesRangeFlags.EventBraces);
			// output add/remove in their original order
			int count = 0;
			foreach (AstNode node in customEventDeclaration.Children) {
				if (count-- <= 0) {
					cancellationToken.ThrowIfCancellationRequested();
					count = CANCEL_CHECK_LOOP_COUNT;
				}
				if (node.Role == CustomEventDeclaration.AddAccessorRole || node.Role == CustomEventDeclaration.RemoveAccessorRole) {
					node.AcceptVisitor(this);
				}
			}
			CloseBrace(policy.EventBraceStyle, braceHelper, true);
			NewLine();
			EndNode(customEventDeclaration);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:26,代码来源:CSharpOutputVisitor.cs

示例12: VisitCustomEventDeclaration

        public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
        {
            var resolveResult = _resolver.Resolve(eventDeclaration);
            if (!(resolveResult is MemberResolveResult)) {
                _errorReporter.Region = eventDeclaration.GetRegion();
                _errorReporter.InternalError("Event declaration " + eventDeclaration.Name + " does not resolve to a member.");
                return;
            }

            var evt = ((MemberResolveResult)resolveResult).Member as IEvent;
            if (evt == null) {
                _errorReporter.Region = eventDeclaration.GetRegion();
                _errorReporter.InternalError("Event declaration " + eventDeclaration.Name + " does not resolve to an event (resolves to " + resolveResult.ToString() + ")");
                return;
            }

            var jsClass = GetJsClass(evt.DeclaringTypeDefinition);
            if (jsClass == null)
                return;

            var impl = _metadataImporter.GetEventSemantics(evt);

            switch (impl.Type) {
                case EventScriptSemantics.ImplType.AddAndRemoveMethods: {
                    if (!eventDeclaration.AddAccessor.IsNull) {
                        MaybeCompileAndAddMethodToType(jsClass, eventDeclaration.AddAccessor, eventDeclaration.AddAccessor.Body, evt.AddAccessor, impl.AddMethod);
                    }

                    if (!eventDeclaration.RemoveAccessor.IsNull) {
                        MaybeCompileAndAddMethodToType(jsClass, eventDeclaration.RemoveAccessor, eventDeclaration.RemoveAccessor.Body, evt.RemoveAccessor, impl.RemoveMethod);
                    }
                    break;
                }
                case EventScriptSemantics.ImplType.NotUsableFromScript: {
                    break;
                }
                default: {
                    throw new InvalidOperationException("Invalid event implementation type");
                }
            }
        }
开发者ID:jack128,项目名称:SaltarelleCompiler,代码行数:41,代码来源:Compiler.cs

示例13: VisitCustomEventDeclaration

 public virtual void VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(customEventDeclaration);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs

示例14: VisitCustomEventDeclaration

		public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
		{
			VisitNewDeclarationSpace(eventDeclaration);
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:4,代码来源:LocalDeclarationSpaceVisitor.cs

示例15: VisitCustomEventDeclaration

		public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
		{
			FormatAttributedNode(eventDeclaration);
			EnforceBraceStyle(policy.EventBraceStyle, eventDeclaration.LBraceToken, eventDeclaration.RBraceToken);
			if (policy.IndentEventBody) {
				curIndent.Push(IndentType.Block);
			}
			
			if (!eventDeclaration.AddAccessor.IsNull) {
				FixIndentation(eventDeclaration.AddAccessor.StartLocation);
				if (!eventDeclaration.AddAccessor.Body.IsNull) {
					if (!policy.AllowEventAddBlockInline || eventDeclaration.AddAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.AddAccessor.Body.RBraceToken.StartLocation.Line) {
						EnforceBraceStyle(policy.EventAddBraceStyle, eventDeclaration.AddAccessor.Body.LBraceToken, eventDeclaration.AddAccessor.Body.RBraceToken);
					} else {
						nextStatementIndent = " ";
					}
					
					VisitBlockWithoutFixingBraces(eventDeclaration.AddAccessor.Body, policy.IndentBlocks);
				}
			}
			
			if (!eventDeclaration.RemoveAccessor.IsNull) {
				FixIndentation(eventDeclaration.RemoveAccessor.StartLocation);
				if (!eventDeclaration.RemoveAccessor.Body.IsNull) {
					if (!policy.AllowEventRemoveBlockInline || eventDeclaration.RemoveAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.RemoveAccessor.Body.RBraceToken.StartLocation.Line) {
						EnforceBraceStyle(policy.EventRemoveBraceStyle, eventDeclaration.RemoveAccessor.Body.LBraceToken, eventDeclaration.RemoveAccessor.Body.RBraceToken);
					} else {
						nextStatementIndent = " ";
					}
					VisitBlockWithoutFixingBraces(eventDeclaration.RemoveAccessor.Body, policy.IndentBlocks);
				}
			}
			
			if (policy.IndentEventBody) {
				curIndent.Pop ();
			}
			
			if (eventDeclaration.NextSibling is EventDeclaration && IsSimpleEvent(eventDeclaration) && IsSimpleEvent(eventDeclaration.NextSibling)) {
				EnsureBlankLinesAfter(eventDeclaration, policy.BlankLinesBetweenEventFields);
			} else if (IsMember(eventDeclaration.NextSibling)) {
				EnsureBlankLinesAfter(eventDeclaration, policy.BlankLinesBetweenMembers);
			}
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:43,代码来源:AstFormattingVisitor.cs


注:本文中的CustomEventDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。