File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/openapi-generator/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,19 @@ export async function parseSource(
1919 src : string ,
2020) : Promise < SourceFile | undefined > {
2121 try {
22+ // Parse an empty string to get the last span
2223 const lastSpan = swc . parseSync ( '' ) ;
23- lastSpanEnd = lastSpan . span . end ;
2424
2525 const module = swc . parseSync ( src , {
2626 syntax : 'typescript' ,
2727 target : 'esnext' ,
2828 comments : true ,
2929 } ) ;
3030
31+ // Set the start of the module to the end of the last span, so that we don't have any
32+ // issues when parsing files that start with comments
3133 module . span . start = lastSpan . span . start ;
34+ lastSpanEnd = lastSpan . span . end ;
3235
3336 const symbols = parseTopLevelSymbols ( src , lastSpanEnd , module . body ) ;
3437 return {
You can’t perform that action at this time.
0 commit comments