diff --git a/inputs/passing/exportDefaultArrow.ts b/inputs/passing/exportDefaultArrow.ts new file mode 100644 index 0000000..8be915c --- /dev/null +++ b/inputs/passing/exportDefaultArrow.ts @@ -0,0 +1,5 @@ +//! test_output("Hi") + +export default () => { + return "Hi"; +}; diff --git a/valuescript_compiler/src/module_compiler.rs b/valuescript_compiler/src/module_compiler.rs index c94cf53..e5b2b79 100644 --- a/valuescript_compiler/src/module_compiler.rs +++ b/valuescript_compiler/src/module_compiler.rs @@ -1046,8 +1046,14 @@ impl ModuleCompiler { Value::String("(error)".to_string()) } }, + swc_ecma_ast::Expr::Arrow(arrow) => { + let p = self.allocate_defn_numbered("_anon"); + let mut fn_defns = self.compile_fn(p.clone(), None, Functionish::Arrow(arrow.clone())); + self.module.definitions.append(&mut fn_defns); + + Value::Pointer(p) + } swc_ecma_ast::Expr::TaggedTpl(_) - | swc_ecma_ast::Expr::Arrow(_) | swc_ecma_ast::Expr::Class(_) | swc_ecma_ast::Expr::Yield(_) | swc_ecma_ast::Expr::MetaProp(_)