Skip to content

Commit

Permalink
添加文件范围命名空间支持
Browse files Browse the repository at this point in the history
在语法解析中,文件范围命名空间和命名空间是不同的节点
  • Loading branch information
SeWZC committed Jan 23, 2024
1 parent d1805dd commit 9c77b6d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/SourceFusion.Tool/Syntax/CompileTypeVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ public override SyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax
return base.VisitNamespaceDeclaration(node);
}

/// <summary>
/// 获取文件命名空间
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
public override SyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node)
{
var nameSyntax = Visit(node.Name);
// 命名空间
_namespace = nameSyntax.ToFullString().Trim();

return base.VisitFileScopedNamespaceDeclaration(node);
}

/// <summary>
/// 获取类
/// </summary>
Expand Down

0 comments on commit 9c77b6d

Please sign in to comment.