mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Static eval for arrow functions
This commit is contained in:
5
inputs/passing/exportDefaultArrow.ts
Normal file
5
inputs/passing/exportDefaultArrow.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
//! test_output("Hi")
|
||||
|
||||
export default () => {
|
||||
return "Hi";
|
||||
};
|
||||
@@ -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(_)
|
||||
|
||||
Reference in New Issue
Block a user