/// <summary> /// Traverse AST node that represents class declaration /// </summary> /// <param name="node">AST node.</param> public override void VisitClassDeclaration(ClassDeclarationSyntax node) { try { if (!node.Identifier.Span.IsEmpty) { var symbol = _sm.GetDeclaredSymbol(node); // Classes can be partial, however, currently, srclib only support one definition per symbol if (!_defined.Contains(symbol)) { _defined.Add(symbol); var def = Def.For(symbol: symbol, type: "class", name: symbol.Name).At(_path, node.Identifier.Span); if (symbol.IsExported()) { def.Exported = true; } AddDef(def, DocProcessor.ForClass(symbol)); } } base.VisitClassDeclaration(node); } catch (Exception e) { } }
/// <summary> /// Traverse AST node that represents struct declaration /// </summary> /// <param name="node">AST node.</param> public override void VisitStructDeclaration(StructDeclarationSyntax node) { try { if (!node.Identifier.Span.IsEmpty) { var symbol = _sm.GetDeclaredSymbol(node); // Structs can also be partial if (!_defined.Contains(symbol)) { _defined.Add(symbol); var def = Def.For(symbol: symbol, type: "struct", name: symbol.Name).At(_path, node.Identifier.Span); if (symbol.IsExported()) { def.Exported = true; } AddDef(def, DocProcessor.ForClass(symbol)); } } base.VisitStructDeclaration(node); } catch (Exception e) { } }
/// <summary> /// Traverse AST node that represents delegate declaration /// </summary> /// <param name="node">AST node.</param> public override void VisitDelegateDeclaration(DelegateDeclarationSyntax node) { try { if (!node.Identifier.Span.IsEmpty) { var symbol = _sm.GetDeclaredSymbol(node); _defined.Add(symbol); var def = Def.For(symbol: symbol, type: "delegate", name: symbol.Name).At(_path, node.Identifier.Span); if (symbol.IsExported()) { def.Exported = true; } AddDef(def, DocProcessor.ForClass(symbol)); } base.VisitDelegateDeclaration(node); } catch (Exception e) { } }