public override void EnterEvent_([NotNull] XSharpParser.Event_Context context)
        {
            var         tokens    = context.Modifiers?._Tokens;
            XTypeMember newMethod = new XTypeMember(context.ShortName,
                                                    Kind.Event,
                                                    decodeModifiers(tokens),
                                                    decodeVisibility(tokens),
                                                    new TextRange(context), new TextInterval(context),
                                                    context.ReturnType == null ? "Void" : context.ReturnType.GetText(), isStatic(tokens));

            //
            addParameters(context.Params, newMethod);
            addMember(newMethod);
        }
Пример #2
0
        public override void EnterEvent_([NotNull] XSharpParser.Event_Context context)
        {
            var evt = new XCodeMemberEvent();

            writeTrivia(evt, context);
            FillCodeDomDesignerData(evt, context.Start.Line, context.Start.Column);
            evt.Name       = context.Id.GetCleanText();
            evt.Attributes = MemberAttributes.Public;
            var typeName = context.Type.GetCleanText();

            evt.Type = BuildTypeReference(typeName);
            //
            if (context.Modifiers != null)
            {
                // Get standard Visibilities
                evt.Attributes = ContextToEventModifiers(context.Modifiers);
                if (context.Modifiers.NEW().Length > 0)
                {
                    evt.Attributes |= MemberAttributes.New;
                }
                if (context.Modifiers.STATIC().Length > 0)
                {
                    evt.Attributes |= MemberAttributes.Static;
                }
                if (context.Modifiers.VIRTUAL().Length > 0)
                {
                    // According to MSDN, The absence of the Final flag makes a member virtual in C#, same for us
                    evt.Attributes &= ~MemberAttributes.Final;
                }
                else
                {
                    // Other cases = FINAL
                    evt.Attributes |= MemberAttributes.Final;
                }
            }
            //
            this.CurrentType.Members.Add(evt);
            // write original source for the attributes
            AddMemberAttributes(evt, evt.Attributes, context.Modifiers);
            this.addClassMember(new XMemberType(evt.Name, MemberTypes.Event, false, null, "Void"));
            SaveSourceCode(evt, context);
        }
Пример #3
0
 public override void ExitEvent_([NotNull] XSharpParser.Event_Context context)
 {
     TagRegion(context, context.ChildCount - 2);
 }
 public override void ExitEvent_([NotNull] XSharpParser.Event_Context context)
 {
     endMember(context);
 }