Esempio n. 1
0
 private protected Declaration(Module module, NamedDeclarationNode node)
     : base(node.Attributes)
 {
     Module   = module;
     Name     = node.NameToken.Text;
     IsPublic = node.VisibilityKeywordToken?.Kind == SyntaxTokenKind.PubKeyword;
 }
Esempio n. 2
0
        public override IEnumerable <(SyntaxNode, SyntaxDiagnostic)> Run(NamedDeclarationNode node)
        {
            if (node.VisibilityKeywordToken?.Kind != SyntaxTokenKind.PubKeyword)
            {
                yield break;
            }

            var type = node switch
            {
                ConstantDeclarationNode _ => "constant",
                FunctionDeclarationNode _ => "function",
                ExternalDeclarationNode _ => "function",
                _ => throw DebugAssert.Unreachable(),
            };

            var ident = node.NameToken;

            if (ident.IsMissing)
            {
                yield break;
            }

            var diag = CheckDocAttribute(node.Attributes, ident.Location, $"Public {type} {ident} is undocumented");

            if (diag != null)
            {
                yield return(node, diag);
            }
        }
Esempio n. 3
0
 public virtual IEnumerable <(SyntaxNode, SyntaxDiagnostic)> Run(NamedDeclarationNode node)
 {
     return(Array.Empty <(SyntaxNode, SyntaxDiagnostic)>());
 }