private protected Declaration(Module module, NamedDeclarationNode node) : base(node.Attributes) { Module = module; Name = node.NameToken.Text; IsPublic = node.VisibilityKeywordToken?.Kind == SyntaxTokenKind.PubKeyword; }
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); } }
public virtual IEnumerable <(SyntaxNode, SyntaxDiagnostic)> Run(NamedDeclarationNode node) { return(Array.Empty <(SyntaxNode, SyntaxDiagnostic)>()); }