diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-05-11 07:54:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 01:54:39 +0200 |
commit | 36c5461129a1b769eb205765a79c5dc000b0b2f6 (patch) | |
tree | eec51ab5f8419acaa5adf7fe84319e9773dec26c /cli/ast.rs | |
parent | c44e53a5b6bd8d995ddc32a0ba13d20bf4e70818 (diff) |
feat(test): add support for type checking documentation (#10521)
This commit adds support for type checking codeblocks in the JS doc
comments.
Diffstat (limited to 'cli/ast.rs')
-rw-r--r-- | cli/ast.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/ast.rs b/cli/ast.rs index d282e0ee7..76a5f1362 100644 --- a/cli/ast.rs +++ b/cli/ast.rs @@ -304,6 +304,22 @@ impl ParsedModule { self.leading_comments.clone() } + /// Get the module's comments. + pub fn get_comments(&self) -> Vec<Comment> { + let mut comments = Vec::new(); + let (leading_comments, trailing_comments) = self.comments.borrow_all(); + + for value in leading_comments.values() { + comments.append(&mut value.clone()); + } + + for value in trailing_comments.values() { + comments.append(&mut value.clone()); + } + + comments + } + /// Get a location for a given span within the module. pub fn get_location(&self, span: &Span) -> Location { self.source_map.lookup_char_pos(span.lo).into() |