Example #1
0
        public override object VisitMethod(MethodContext context)
        {
            if (Ignore || _currentClass == null)
            {
                return(null);
            }

            var method = new Method(context.methodName().GetText())
            {
                IsConst        = context.FoundChild <IsConstContext>(),
                IsFinal        = context.FoundChild <IsFinalContext>(),
                IsStatic       = context.FoundChild <IsStaticContext>(),
                IsFriend       = context.FoundChild <IsFriendContext>(),
                IsVirtual      = context.FoundChild <IsVirtualContext>(),
                IsOverride     = context.FoundChild <IsOverrideContext>(),
                IsTemplate     = context.FoundChild <TemplateDefineContext>(),
                UMeta          = _currentUMeta ?? new Dictionary <string, string>(),
                AccessModifier = _accessModifier,
                Description    = _currentComment,
                OwnerClass     = _currentClass,
                Operator       = context.methodName().methodOperator()?.GetText(),

                ReturnType = ParceType(context.type()),
                InputTypes = context.FindAll <MethodParametrContext>().Reverse()
                             .Select(ParceParam).ToList()
            };

            if (!_currentClass.Methods.Any(m => m.Equals(method)))
            {
                _currentClass.Methods.Add(method);
            }

            _currentUMeta   = null;
            _currentComment = "";
            return(null);
        }