Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Remove Decl from AST Facade
Browse files Browse the repository at this point in the history
This PR removes the `Decl` union type because it might be misleading. It could be understood to contain any possible declaration whereas it only contains declarations that are allowed in `export` statements. However, it doesn't include other identifier declarations like: named `function expressions`, `class expressions`, parameters, etc....

We may want to re-introduce a form of `Decl` in the future if we see usage for it.
  • Loading branch information
MichaReiser committed Nov 16, 2021
1 parent cc8f424 commit 77c6cc8
Show file tree
Hide file tree
Showing 6 changed files with 470 additions and 446 deletions.
17 changes: 0 additions & 17 deletions crates/rome_formatter/src/ts/declarators/decl.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/rome_formatter/src/ts/declarators/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
mod decl;
mod fn_decl;
mod variable_declaration_statement;
11 changes: 10 additions & 1 deletion crates/rome_formatter/src/ts/statements/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ impl ToFormatElement for JsAnyStatement {
}

JsAnyStatement::ForOfStmt(_) => todo!(),
JsAnyStatement::Decl(decl) => decl.to_format_element(formatter),
JsAnyStatement::FnDecl(decl) => decl.to_format_element(formatter),
JsAnyStatement::ClassDecl(decl) => decl.to_format_element(formatter),
JsAnyStatement::JsVariableDeclarationStatement(decl) => {
decl.to_format_element(formatter)
}
JsAnyStatement::JsUnknownStatement(_) => todo!(),
JsAnyStatement::ImportDecl(_) => todo!(),
JsAnyStatement::ExportNamed(_) => todo!(),
Expand All @@ -63,6 +67,11 @@ impl ToFormatElement for JsAnyStatement {
JsAnyStatement::JsTryFinallyStatement(try_finally) => {
try_finally.to_format_element(formatter)
}
JsAnyStatement::TsEnum(_) => todo!(),
JsAnyStatement::TsTypeAliasDecl(_) => todo!(),
JsAnyStatement::TsNamespaceDecl(_) => todo!(),
JsAnyStatement::TsModuleDecl(_) => todo!(),
JsAnyStatement::TsInterfaceDecl(_) => todo!(),
}
}
}
Loading

0 comments on commit 77c6cc8

Please sign in to comment.