/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.Core.SourceGenerator/Utilities/UsingCollector.cs
25 строк
946 B
Yair
Code Quality: Updated license header
31 дек 2024, 05:03
31 дек 2024, 05:03
8436c6d
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. namespace Files.Core.SourceGenerator.Utilities { /// <summary> /// Syntax walker that collects namespaces from using directives within C# syntax trees. /// </summary> internal sealed class UsingCollector : CSharpSyntaxWalker { private readonly HashSet<string> _namespaces; /// <summary> /// Initializes a new instance of the <see cref="UsingCollector"/> class with the specified set of namespaces. /// </summary> /// <param name="namespaces">The set to store collected namespaces.</param> internal UsingCollector(HashSet<string> namespaces) => _namespaces = namespaces; /// <summary> /// Visits a using directive node and adds the namespace to the set. /// </summary> /// <param name="node">The using directive syntax node.</param> public override void VisitUsingDirective(UsingDirectiveSyntax node) => _namespaces.Add(node.Name!.ToString()); } }