Skip to content

Commit 4d63b89

Browse files
committed
fix
1 parent 7f18746 commit 4d63b89

3 files changed

Lines changed: 35 additions & 34 deletions

File tree

src/parser.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,13 @@ impl<'a> DocParser<'a> {
341341
definitions.first().unwrap().module.specifier(),
342342
reference_def,
343343
// -1 to include the root
344-
name_path[(if i > 1 { i - 1 } else { 0 })..].to_vec(),
344+
if i > 1 {
345+
name_path[i - 1..].to_vec()
346+
} else {
347+
let mut out = vec![root_name];
348+
out.extend_from_slice(&name_path);
349+
out
350+
},
345351
false,
346352
);
347353
};

tests/specs/namespace_reexport_member.txt

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -182,34 +182,7 @@ Defined in file:///mod.ts:1:1
182182
},
183183
"kind": "namespace",
184184
"namespaceDef": {
185-
"elements": [
186-
{
187-
"name": "Completions",
188-
"isDefault": false,
189-
"location": {
190-
"filename": "file:///chat_completions.ts",
191-
"line": 2,
192-
"col": 0,
193-
"byteIndex": 11
194-
},
195-
"declarationKind": "export",
196-
"jsDoc": {
197-
"doc": "Doc"
198-
},
199-
"kind": "class",
200-
"classDef": {
201-
"isAbstract": false,
202-
"constructors": [],
203-
"properties": [],
204-
"indexSignatures": [],
205-
"methods": [],
206-
"extends": null,
207-
"implements": [],
208-
"typeParams": [],
209-
"superTypeParams": []
210-
}
211-
}
212-
]
185+
"elements": []
213186
}
214187
}
215188
]

tests/specs/panic_subtract_with_overflow.txt

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ export { Audio } from './audio.ts';
44
# audio.ts
55
import { Speech } from './speech.ts';
66

7-
/** Some documentation. **/
7+
/** Some documentation. */
88
export namespace Audio {
99
export { Speech as Speech };
1010
}
1111

1212
# speech.ts
13+
/** Some documentation. */
1314
export namespace Speech {}
1415

1516
# output.txt
1617
Defined in file:///audio.ts:4:1
1718

1819
namespace Audio
19-
Some documentation. *
20+
Some documentation.
2021

22+
namespace Speech
23+
Some documentation.
2124

2225

2326
# output.json
@@ -29,15 +32,34 @@ namespace Audio
2932
"filename": "file:///audio.ts",
3033
"line": 4,
3134
"col": 0,
32-
"byteIndex": 67
35+
"byteIndex": 66
3336
},
3437
"declarationKind": "export",
3538
"jsDoc": {
36-
"doc": "Some documentation. *"
39+
"doc": "Some documentation."
3740
},
3841
"kind": "namespace",
3942
"namespaceDef": {
40-
"elements": []
43+
"elements": [
44+
{
45+
"name": "Speech",
46+
"isDefault": false,
47+
"location": {
48+
"filename": "file:///speech.ts",
49+
"line": 2,
50+
"col": 0,
51+
"byteIndex": 27
52+
},
53+
"declarationKind": "export",
54+
"jsDoc": {
55+
"doc": "Some documentation."
56+
},
57+
"kind": "namespace",
58+
"namespaceDef": {
59+
"elements": []
60+
}
61+
}
62+
]
4163
}
4264
}
4365
]

0 commit comments

Comments
 (0)