Add stubs for unimplemented declarations

This commit is contained in:
Andrew Morris
2022-05-11 09:38:49 +10:00
parent 51a76867c4
commit 5af8af20bd

View File

@@ -224,7 +224,9 @@ impl Compiler {
For(_) => std::panic!("Not implemented: For statement"),
ForIn(_) => std::panic!("Not implemented: ForIn statement"),
ForOf(_) => std::panic!("Not implemented: ForOf statement"),
Decl(_) => std::panic!("Not implemented: Decl statement"),
Decl(decl) => {
self.compile_declaration(decl, &mut definition);
},
Expr(_) => std::panic!("Not implemented: Expr statement"),
}
}
@@ -233,6 +235,24 @@ impl Compiler {
self.definitions.push(definition);
}
fn compile_declaration(
&mut self,
decl: &swc_ecma_ast::Decl,
definition: &mut Vec<String>,
) {
use swc_ecma_ast::Decl::*;
match decl {
Class(_) => std::panic!("Not implemented: Class declaration"),
Fn(_) => std::panic!("Not implemented: Fn declaration"),
Var(_) => std::panic!("Not implemented: Var declaration"),
TsInterface(_) => std::panic!("Not implemented: TsInterface declaration"),
TsTypeAlias(_) => std::panic!("Not implemented: TsTypeAlias declaration"),
TsEnum(_) => std::panic!("Not implemented: TsEnum declaration"),
TsModule(_) => std::panic!("Not implemented: TsModule declaration"),
};
}
}
#[derive(Default)]