Esempio n. 1
0
 private void Fix(QualifiedMemberName memberName, VBAParser.AttributeStmtContext context)
 {
     if (context.AnnotationType() == AnnotationType.Description)
     {
         FixMemberDescriptionAnnotation(_state, memberName);
     }
     else
     {
         // only '@Description member annotation is parameterized, so AnnotationType.ToString() works:
         Debug.Assert(context.AnnotationType().HasValue);
         AddMemberAnnotation(_state, memberName, context.AnnotationType());
     }
 }
Esempio n. 2
0
        private void Fix(QualifiedModuleName moduleName, VBAParser.AttributeStmtContext context)
        {
            var annotationType = context.AnnotationType();

            Debug.Assert(annotationType.HasValue);

            var annotation = $"'@{annotationType}\r\n";

            var rewriter = _state.GetRewriter(moduleName);

            rewriter.InsertAfter(((VBAParser.ModuleAttributesContext)context.Parent).Stop.TokenIndex, annotation);
        }
Esempio n. 3
0
            public override void ExitAttributeStmt(VBAParser.AttributeStmtContext context)
            {
                var annotations = CurrentScopeDeclaration?.Annotations;

                var type = context.AnnotationType();

                if (type != null && (annotations?.All(a => a.AnnotationType != type) ?? false))
                {
                    if (type.Value.HasFlag(AnnotationType.ModuleAnnotation))
                    {
                        // attribute is mapped to an annotation, but current scope doesn't have that annotation:
                        AddContext(new QualifiedContext <ParserRuleContext>(CurrentModuleName, context));
                    }

                    if (type.Value.HasFlag(AnnotationType.MemberAnnotation))
                    {
                        AddContext(new QualifiedContext <ParserRuleContext>(CurrentScopeDeclaration.QualifiedName, context));
                    }
                }
            }