|
7 | 7 |
|
8 | 8 | // Google closure compiler cannot handle Clazz.new or Clazz.super |
9 | 9 |
|
| 10 | +// BH 2019.11.26 3.2.5.v1 errant if (args) in newInstance |
10 | 11 | // BH 2019.11.07 3.2.5.v0 full encapsulation |
11 | 12 | // BH 2019.11.07 3.2.5.v0 adds encapsulation for window |
12 | 13 | // BH 2019.11.07 3.2.5.v0 splitting off $static$ from $clinit$ (see Java2ScriptVisitor notes) |
@@ -464,13 +465,15 @@ Clazz.new_ = function(c, args, cl) { |
464 | 465 | // Integer will be passed as is here, without c.exClazz, or cl |
465 | 466 | var clInner = cl; |
466 | 467 | cl = cl || c.exClazz || c; |
467 | | - Clazz._initClass(cl,1,0,0); // critical here; next will call (0,1,0) |
| 468 | + Clazz._initClass(cl,1,0,0); |
| 469 | + // BH note: Critical here that the above is not 1,1,0; |
| 470 | + // static init is the responsibility of newInstance |
| 471 | + // or a static field or method call (which is handled |
| 472 | + // by the $I$(n) handler in the function initializer in |
| 473 | + // the newClass() call. |
468 | 474 | var obj = new (Function.prototype.bind.apply(cl, arguments)); |
469 | 475 | if (args[2] != inheritArgs) { |
470 | | - if (haveArgs) { |
471 | | -// Clazz._initClass(cl,0,1,0); |
472 | | - c.apply(obj, args); |
473 | | - } |
| 476 | + haveArgs && c.apply(obj, args); |
474 | 477 | clInner && clInner.$init$.apply(obj); |
475 | 478 | } |
476 | 479 |
|
@@ -563,7 +566,7 @@ Clazz.newInstance = function (objThis, args, isInner, clazz) { |
563 | 566 | objThis.__JSID__ = ++_jsid; |
564 | 567 |
|
565 | 568 | if (!isInner) { |
566 | | - if (args) |
| 569 | +// if (args) |
567 | 570 | clazz && Clazz._initClass(clazz,1,1,objThis); |
568 | 571 | if ((!args || args.length == 0) && objThis.c$) { |
569 | 572 | // allow for direct default call "new foo()" to run with its default constructor |
|
0 commit comments