-
• #2
This does work, but I really would like to use class notation.
var A = function() {}; var B = function() { A.call(this); }; B.prototype = Object.create(A.prototype); B.prototype.constructor = B; var C = function() { B.call(this); }; C.prototype = Object.create(B.prototype); C.prototype.constructor = C; function onInit() { const c = new C(); }
-
• #3
This was actually fixed just last week! https://github.com/espruino/Espruino/commit/435b4dadecba23aa256e51ea5985623c1fd8b65f
If you install a 'cutting edge' build it will hopefully be fixed!
-
• #4
Works like a charm. Thanks Gordon. What a coincidence ;)
-
• #5
:) Yes! It's odd - someone else picked up on it last week which is why I fixed it, but otherwise the bug report itself is over 4 years old!
Hi, I have a problem, which could be boiled down to the code snippet given above.
If I run it on my Espruino WiFi (2v16), I get a recursion error, since if class B tries to call the constructor of A, it calls its own constructor.
Does anyone has a workaround for this problem? I already tried passing different argument lists into the constructors to make them distinguishable (in C++ mapping terms at least). Without any luck. I can easily instantiate B or A, but not C.
I would really appreaciate your help. Thank you very much.