Skip to content

Commit

Permalink
Simplify export default
Browse files Browse the repository at this point in the history
  • Loading branch information
voltrevo committed Jul 24, 2023
1 parent 839aff0 commit d3383ff
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions valuescript_compiler/src/module_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,7 @@ impl ModuleCompiler {
ExportDecl(ed) => self.compile_export_decl(ed),
ExportNamed(en) => self.compile_named_export(en),
ExportDefaultDecl(edd) => self.compile_export_default_decl(edd),
ExportDefaultExpr(ede) => {
let value = match &*ede.expr {
// TODO: Just do identifiers in compile_expr
swc_ecma_ast::Expr::Ident(ident) => self
.scope_analysis
.lookup(&Ident::from_swc_ident(ident))
.map(|name| name.value.clone()),
expr => Some(self.compile_expr(expr)),
};

match value {
Some(value) => {
self.module.export_default = value;
}
None => {
self.todo(
module_decl.span(),
"Failed to evaluate export default expression",
);
}
};
}
ExportDefaultExpr(ede) => self.module.export_default = self.compile_expr(&ede.expr),
ExportAll(_) => self.todo(module_decl.span(), "ExportAll declaration"),
TsImportEquals(_) => self.not_supported(module_decl.span(), "TsImportEquals declaration"),
TsExportAssignment(_) => {
Expand Down

0 comments on commit d3383ff

Please sign in to comment.