Skip to content

Commit

Permalink
[js] don't generate constructor function for KAbstractImpl (see HaxeF…
Browse files Browse the repository at this point in the history
  • Loading branch information
nadako committed Oct 12, 2014
1 parent 64b3ff6 commit 324a415
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions genjs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 324a415

Please sign in to comment.