From 324a415f8626c9574f0261cc133d6670b1e3ae43 Mon Sep 17 00:00:00 2001 From: Dan Korostelev Date: Mon, 13 Oct 2014 02:47:22 +0400 Subject: [PATCH] [js] don't generate constructor function for KAbstractImpl (see #2350) --- genjs.ml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/genjs.ml b/genjs.ml index c126a9ab3b3..9d7d191a0de 100644 --- a/genjs.ml +++ b/genjs.ml @@ -987,9 +987,15 @@ let generate_class ctx c = else print ctx "%s = $hxClasses[\"%s\"] = " p (dot_path c.cl_path); (match (get_exposed ctx (dot_path c.cl_path) c.cl_meta) with [s] -> print ctx "$hx_exports.%s = " s | _ -> ()); - (match c.cl_constructor with - | Some { cf_expr = Some e } -> gen_expr ctx e - | _ -> (print ctx "function() { }"); ctx.separator <- true); + (match c.cl_kind with + | KAbstractImpl _ -> + (* abstract implementations only contain static members and don't need to have constructor functions *) + print ctx "{}"; ctx.separator <- true + | _ -> + (match c.cl_constructor with + | Some { cf_expr = Some e } -> gen_expr ctx e + | _ -> (print ctx "function() { }"); ctx.separator <- true) + ); newline ctx; if ctx.js_modern && hxClasses then begin print ctx "$hxClasses[\"%s\"] = %s" (dot_path c.cl_path) p;