瀏覽代碼

[js] delay js context creation for custom js generator (fixes #9253)

Aleksandr Kuzmenko 5 年之前
父節點
當前提交
38789c6a9f
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/typing/macroContext.ml

+ 2 - 2
src/typing/macroContext.ml

@@ -248,9 +248,9 @@ let make_macro_api ctx p =
 			tp.tp_meta <- tp.tp_meta @ (List.map (fun (m,el,_) -> (m,el,p)) ml);
 		);
 		MacroApi.set_js_generator = (fun gen ->
-			Path.mkdir_from_path ctx.com.file;
-			let js_ctx = Genjs.alloc_ctx ctx.com (get_es_version ctx.com) in
 			ctx.com.js_gen <- Some (fun() ->
+				Path.mkdir_from_path ctx.com.file;
+				let js_ctx = Genjs.alloc_ctx ctx.com (get_es_version ctx.com) in
 				let t = macro_timer ctx ["jsGenerator"] in
 				gen js_ctx;
 				t()