Skip to content

Commit fce6e93

Browse files
committed
Node conservation in namespaces
1 parent 64bf4cb commit fce6e93

File tree

1 file changed

+6
-0
lines changed
  • packages/cli/src/languagePlugins/csharp/namespaceResolver

1 file changed

+6
-0
lines changed

packages/cli/src/languagePlugins/csharp/namespaceResolver/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface ExportedSymbol {
3030

3131
export interface Namespace {
3232
name: string;
33+
node: Parser.SyntaxNode;
34+
identifierNode?: Parser.SyntaxNode; // Optional because the root namespace doesn't have an identifier
3335
exports: ExportedSymbol[];
3436
childrenNamespaces: Namespace[];
3537
}
@@ -56,6 +58,8 @@ export class NamespaceResolver {
5658
const namespaces = [
5759
{
5860
name: "",
61+
node: file.rootNode,
62+
identifierNode: undefined,
5963
exports: this.#getExportsFromNode(file.rootNode),
6064
childrenNamespaces: this.#getNamespacesFromNode(file.rootNode),
6165
},
@@ -71,6 +75,8 @@ export class NamespaceResolver {
7175
.filter((child) => child.type === "namespace_declaration")
7276
.map((child) => ({
7377
name: this.#getIdentifierNode(child).text,
78+
node: child,
79+
identifierNode: this.#getIdentifierNode(child),
7480
exports: this.#getExportsFromNode(this.#getDeclarationList(child)),
7581
childrenNamespaces: this.#getNamespacesFromNode(
7682
this.#getDeclarationList(child),

0 commit comments

Comments
 (0)