Browse Source

[js] add special case for Std to genjs (closes #3286)

Simon Krajewski 11 năm trước cách đây
mục cha
commit
5c7d0c0fbb
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      genjs.ml

+ 4 - 1
genjs.ml

@@ -1140,7 +1140,10 @@ let generate_type ctx = function
 		(* Special case, want to add Math.__name__ only when required, handle here since Math is extern *)
 		(* Special case, want to add Math.__name__ only when required, handle here since Math is extern *)
 		let p = s_path ctx c.cl_path in
 		let p = s_path ctx c.cl_path in
 		if p = "Math" then generate_class___name__ ctx c;
 		if p = "Math" then generate_class___name__ ctx c;
-		if not c.cl_extern then
+		(* Another special case for Std because we do not want to generate it if it's empty. *)
+		if p = "Std" && c.cl_ordered_statics = [] then
+			()
+		else if not c.cl_extern then
 			generate_class ctx c
 			generate_class ctx c
 		else if Meta.has Meta.JsRequire c.cl_meta then
 		else if Meta.has Meta.JsRequire c.cl_meta then
 			generate_require ctx c
 			generate_require ctx c