• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Ast.Event类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: LeaveEvent

 public override void LeaveEvent(Event node)
 {
     if (IsInterfaceMember(node))
         node.Modifiers = TypeMemberModifiers.Public | TypeMemberModifiers.Abstract;
     else if (!node.IsVisibilitySet)
         node.Modifiers |= Context.Parameters.DefaultEventVisibility;
     LeaveMember(node);
 }
开发者ID:elfrostie,项目名称:boo,代码行数:8,代码来源:NormalizeTypeAndMemberDefinitions.cs


示例2: LeaveEvent

 public override void LeaveEvent(Event node)
 {
     if (!node.IsVisibilitySet)
     {
         node.Modifiers |= TypeMemberModifiers.Public;
     }
     if (IsInterface(node.DeclaringType))
     {
         node.Modifiers |= TypeMemberModifiers.Abstract;
     }
     LeaveMember(node);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:12,代码来源:NormalizeTypeAndMemberDefinitions.cs


示例3: BindEvent

        void BindEvent(Event node)
        {
            EnsureEntityFor(node);

            IType type = GetType(node.Type);
            IType declaringType = GetType(node.DeclaringType);
            bool typeIsCallable = type is ICallableType;
            if (!typeIsCallable)
            {
                Errors.Add(
                    CompilerErrorFactory.EventTypeIsNotCallable(node.Type,
                    type.ToString()));
            }

            if (declaringType.IsInterface)
            {
                BindInterfaceEvent(node);
            }
            else
            {
                BindClassEvent(node, type, typeIsCallable);
            }
        }
开发者ID:turugina,项目名称:boo,代码行数:23,代码来源:BindTypeMembers.cs


示例4: LeaveEvent

 public override void LeaveEvent(Event node)
 {
     CheckName(node,node.Name);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:CheckIdentifiers.cs


示例5: event_declaration

	protected void event_declaration(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  t = null;
		IToken  id = null;
		
				Event e = null;
				TypeReference tr = null;
			
		
		try {      // for error handling
			t = LT(1);
			match(EVENT);
			id = LT(1);
			match(ID);
			match(AS);
			tr=type_reference();
			eos();
			if (0==inputState.guessing)
			{
				
						e = new Event(ToLexicalInfo(id), id.getText(), tr);
						e.Modifiers = _modifiers;
						AddAttributes(e.Attributes);
						container.Add(e);
					
			}
			docstring(e);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "event_declaration");
				recover(ex,tokenSet_55_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:44,代码来源:BooParserBase.cs


示例6: OnEvent

 public override void OnEvent(Event node)
 {
     _emitter.EmitEventAttributes(node);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:4,代码来源:EmitAssembly.cs


示例7: DefineEvent

        void DefineEvent(TypeBuilder typeBuilder, Event node)
        {
            EventBuilder builder = typeBuilder.DefineEvent(node.Name,
                                                           EventAttributes.None,
                                                           GetSystemType(node.Type));
            //MethodAttributes attribs = GetPropertyMethodAttributes(node);
            MethodAttributes baseAttributes = MethodAttributes.SpecialName;
            builder.SetAddOnMethod(DefineMethod(typeBuilder, node.Add, baseAttributes|GetMethodAttributes(node.Add)));
            builder.SetRemoveOnMethod(DefineMethod(typeBuilder, node.Remove, baseAttributes|GetMethodAttributes(node.Remove)));

            if (null != node.Raise)
            {
                builder.SetRaiseMethod(DefineMethod(typeBuilder, node.Raise, baseAttributes|GetMethodAttributes(node.Raise)));
            }

            SetBuilder(node, builder);
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:17,代码来源:EmitAssembly.cs


示例8: LeaveEvent

 public override void LeaveEvent(Event node)
 {
     LeaveMember(node);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:4,代码来源:CheckMemberTypes.cs


示例9: CreateInterfaceEventRemoveMethod

 Method CreateInterfaceEventRemoveMethod(Event node)
 {
     return CreateInterfaceEventMethod(node, "remove_");
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:BindTypeMembers.cs


示例10: DefineEvent

		void DefineEvent(TypeBuilder typeBuilder, Event node)
		{
			var builder = typeBuilder.DefineEvent(node.Name, EventAttributes.None, GetSystemType(node.Type));
			builder.SetAddOnMethod(DefineEventMethod(typeBuilder, node.Add));
			builder.SetRemoveOnMethod(DefineEventMethod(typeBuilder, node.Remove));
			if (node.Raise != null)
				builder.SetRaiseMethod(DefineEventMethod(typeBuilder, node.Raise));
			SetBuilder(node, builder);
		}
开发者ID:hlizard,项目名称:boo,代码行数:9,代码来源:EmitAssembly.cs


示例11: EmitEventAttributes

		void EmitEventAttributes(Event node, TypeCreator knownTypes)
		{
			EventBuilder builder = (EventBuilder)GetBuilder(node);
			EmitAttributes(node, builder.SetCustomAttribute, knownTypes);
		}
开发者ID:hlizard,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs


示例12: OnEvent

			public override void OnEvent(Event node)
			{
				_emitter.EmitEventAttributes(node, this._knownTypes);
			}
开发者ID:hlizard,项目名称:boo,代码行数:4,代码来源:EmitAssembly.cs


示例13: InternalEvent

 public InternalEvent(TypeSystemServices tagManager, Event event_)
 {
     _event = event_;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:InternalEvent.cs


示例14: VisitEventDeclaration

		public object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
		{
			B.Event m = new B.Event(GetLexicalInfo(eventDeclaration));
			m.Name = eventDeclaration.Name;
			m.Modifiers = ConvertModifier(eventDeclaration, B.TypeMemberModifiers.Private);
			ConvertAttributes(eventDeclaration.Attributes, m.Attributes);
			if (currentType != null) currentType.Members.Add(m);
			m.EndSourceLocation = GetLocation(eventDeclaration.EndLocation);
			m.Type = ConvertTypeReference(eventDeclaration.TypeReference);
			if (eventDeclaration.InterfaceImplementations.Count > 0) {
				AddError(eventDeclaration, "Explicit interface implementation is not supported for events.");
			}
			if (eventDeclaration.Parameters.Count > 0) {
				AddError(eventDeclaration, "Events with parameters are not supported.");
			}
			if (eventDeclaration.HasAddRegion) {
				m.Add = new B.Method(GetLexicalInfo(eventDeclaration.AddRegion));
				ConvertAttributes(eventDeclaration.AddRegion.Attributes, m.Add.Attributes);
				m.Modifiers = ConvertModifier(eventDeclaration.AddRegion, m.Visibility);
				m.Add.Body = ConvertMethodBlock(eventDeclaration.AddRegion.Block);
			}
			if (eventDeclaration.HasRemoveRegion) {
				m.Remove = new B.Method(GetLexicalInfo(eventDeclaration.RemoveRegion));
				ConvertAttributes(eventDeclaration.RemoveRegion.Attributes, m.Remove.Attributes);
				m.Modifiers = ConvertModifier(eventDeclaration.RemoveRegion, m.Visibility);
				m.Remove.Body = ConvertMethodBlock(eventDeclaration.RemoveRegion.Block);
			}
			if (eventDeclaration.HasRaiseRegion) {
				m.Raise = new B.Method(GetLexicalInfo(eventDeclaration.RaiseRegion));
				ConvertAttributes(eventDeclaration.RaiseRegion.Attributes, m.Raise.Attributes);
				m.Modifiers = ConvertModifier(eventDeclaration.RaiseRegion, m.Visibility);
				m.Raise.Body = ConvertMethodBlock(eventDeclaration.RaiseRegion.Block);
			}
			return m;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:35,代码来源:ConvertVisitorTypeMembers.cs


示例15: BindInterfaceEvent

 private void BindInterfaceEvent(Event node)
 {
     if (null == node.Add)
         node.Add = CreateInterfaceEventAddMethod(node);
     if (null == node.Remove)
         node.Remove = CreateInterfaceEventRemoveMethod(node);
 }
开发者ID:turugina,项目名称:boo,代码行数:7,代码来源:BindTypeMembers.cs


示例16: CreateInterfaceEventAddMethod

 Method CreateInterfaceEventAddMethod(Event node)
 {
     return CreateInterfaceEventMethod(node, "add_");
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:BindTypeMembers.cs


示例17: CreateInterfaceEventMethod

 Method CreateInterfaceEventMethod(Event node, string prefix)
 {
     Method method = CodeBuilder.CreateMethod(prefix + node.Name,
         TypeSystemServices.VoidType,
         TypeMemberModifiers.Public | TypeMemberModifiers.Virtual | TypeMemberModifiers.Abstract);
     method.Parameters.Add(
         CodeBuilder.CreateParameterDeclaration(
         CodeBuilder.GetFirstParameterIndex(node),
         "handler",
         GetType(node.Type)));
     return method;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:12,代码来源:BindTypeMembers.cs


示例18: OnEvent

 public override void OnEvent(Event node)
 {
     _events.Add(node);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:BindTypeMembers.cs


示例19: BindClassEvent

        private void BindClassEvent(Event node, IType type, bool typeIsCallable)
        {
            Field backingField = CodeBuilder.CreateField("___" + node.Name, type);
            if (node.IsTransient)
            {
                backingField.Modifiers |= TypeMemberModifiers.Transient;
            }
            if (node.IsStatic)
            {
                backingField.Modifiers |= TypeMemberModifiers.Static;
            }
            node.DeclaringType.Members.Add(backingField);

            ((InternalEvent)node.Entity).BackingField = (InternalField)backingField.Entity;

            if (null == node.Add)
            {
                node.Add = CreateEventAddMethod(node, backingField);
            }
            else
            {
                Visit(node.Add);
            }

            if (null == node.Remove)
            {
                node.Remove = CreateEventRemoveMethod(node, backingField);
            }
            else
            {
                Visit(node.Remove);
            }

            if (null == node.Raise)
            {
                if (typeIsCallable)
                {
                    node.Raise = CreateEventRaiseMethod(node, backingField);
                }
            }
            else
            {
                Visit(node.Raise);
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:45,代码来源:BindTypeMembers.cs


示例20: BindEvent

        void BindEvent(Event node)
        {
            if (null == node.Entity)
            {
                node.Entity = new InternalEvent(TypeSystemServices, node);
            }

            IType type = GetType(node.Type);
            IType declaringType = GetType(node.DeclaringType);
            bool typeIsCallable = type is ICallableType;
            if (!typeIsCallable)
            {
                Errors.Add(
                    CompilerErrorFactory.EventTypeIsNotCallable(node.Type,
                    type.ToString()));
            }

            if (declaringType.IsInterface)
            {
                BindInterfaceEvent(node);
            }
            else
            {
                BindClassEvent(node, type, typeIsCallable);
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:26,代码来源:BindTypeMembers.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.Expression类代码示例发布时间:2022-05-24
下一篇:
C# Ast.EnumDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap