Skip to content

Commit

Permalink
Fix the jsdoc test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 21, 2023
1 parent 58919a3 commit 4d050ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use deno_graph::Module;
use deno_graph::ModuleGraph;
use deno_graph::ModuleSpecifier;

use std::borrow::Cow;
use std::collections::HashMap;
use std::collections::HashSet;
use std::error::Error;
Expand Down Expand Up @@ -532,7 +533,13 @@ impl<'a> DocParser<'a> {
class_decl: &ClassDecl,
full_range: &SourceRange,
) -> Option<DocNode> {
let js_doc = js_doc_for_range(parsed_source, full_range)?;
let jsdoc_range = match class_decl.class.decorators.first() {
Some(decorator) if decorator.start() < full_range.start => {
Cow::Owned(SourceRange::new(decorator.start(), full_range.end))
}
_ => Cow::Borrowed(full_range),
};
let js_doc = js_doc_for_range(parsed_source, &jsdoc_range)?;
// declared classes cannot have decorators, so we ignore that return
let (name, class_def, _) =
super::class::get_doc_for_class_decl(parsed_source, class_decl);
Expand Down

0 comments on commit 4d050ab

Please sign in to comment.