summaryrefslogtreecommitdiff
path: root/cli/ast.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-09-15 07:59:49 +1000
committerGitHub <noreply@github.com>2020-09-14 23:59:49 +0200
commit5248a711fff3b48d89c2a5c579c6e774c47510ad (patch)
tree15c25adf46fade9e999d5382184437923239dfa3 /cli/ast.rs
parenta65bcadcf25fa8d1d5eefe2a9d78812e39df902a (diff)
chore: add some traits to ast.rs (#7479)
Diffstat (limited to 'cli/ast.rs')
-rw-r--r--cli/ast.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/ast.rs b/cli/ast.rs
index 21dd51c5e..8814bf297 100644
--- a/cli/ast.rs
+++ b/cli/ast.rs
@@ -47,7 +47,7 @@ type Result<V> = result::Result<V, ErrBox>;
static TARGET: JscTarget = JscTarget::Es2020;
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Location {
pub filename: String,
pub line: usize,
@@ -204,6 +204,7 @@ impl Default for TranspileOptions {
/// A logical structure to hold the value of a parsed module for further
/// processing.
+#[derive(Clone)]
pub struct ParsedModule {
comments: SingleThreadedComments,
leading_comments: Vec<Comment>,
@@ -211,6 +212,16 @@ pub struct ParsedModule {
source_map: Rc<SourceMap>,
}
+impl fmt::Debug for ParsedModule {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_struct("ParsedModule")
+ .field("comments", &self.comments)
+ .field("leading_comments", &self.leading_comments)
+ .field("module", &self.module)
+ .finish()
+ }
+}
+
impl ParsedModule {
/// Return a vector of dependencies for the module.
pub fn analyze_dependencies(&self) -> Vec<DependencyDescriptor> {