예제 #1
0
        public override void EnterConstructor([NotNull] XSharpParser.ConstructorContext context)
        {
            var ctor = new XCodeConstructor();

            writeTrivia(ctor, context);
            ctor.Attributes = MemberAttributes.Public;
            ctor.Parameters.AddRange(GetParametersList(context.ParamList));
            if (context.Modifiers != null)
            {
                ctor.Attributes = ContextToConstructorModifiers(context.Modifiers);
            }
            FillCodeDomDesignerData(ctor, context.Start.Line, context.Start.Column);
            SaveSourceCode(ctor, context);
            // write original source for the attributes
            AddMemberAttributes(ctor, ctor.Attributes, context.Modifiers);
            this.CurrentType.Members.Add(ctor);
        }
예제 #2
0
        public override void EnterConstructor([NotNull] XSharpParser.ConstructorContext context)
        {
            var ctor = new XCodeConstructor();

            writeTrivia(ctor, context);
            FillCodeDomDesignerData(ctor, context.Start.Line, context.Start.Column);
            ctor.Attributes = MemberAttributes.Public;
            ctor.Parameters.AddRange(GetParametersList(context.ParamList));
            //
            if (context.Modifiers != null)
            {
                // Get standard Visibilities
                ctor.Attributes = ContextToConstructorModifiers(context.Modifiers);
                if (context.Modifiers.STATIC().Length > 0)
                {
                    ctor.Attributes |= MemberAttributes.Static;
                }
            }
            FillCodeSource(ctor, context, _tokens);
            this.CurrentClass.Members.Add(ctor);
        }