Open rad-pat opened 1 year ago
@rad-pat Could you support a PR?
Yes, perhaps. I'm not really sure where this would need fixing though.
I think a place where allowed words described maybe via array.
Super can not be run in playground. Super() is exchanged by the Compiler with some base call. Playground code is not compiled.
It'd be worth asking @johnspackman whether there is a simple RegEx that could do the translation, or if it's far more complicated than that.
as there is no way to have super working with non ES5 classes, it could be helpful to use the following code to partly emulate super:
function SUPER(instance) {
return new Proxy(instance, {
get(target, prop) {
return Object.getPrototypeOf(Object.getPrototypeOf(target))[prop].bind(target);
}
});
}
(taken from here: https://stackoverflow.com/a/53802461) Having SUPER in place in the playground a simple replacemant could be done. Instead of writing:
super().main()
we could write
SUPER(this).main()
Just something which I came across recently during javascript investigations.
As an example, take the TreeVritual demo from DemoBrowser https://qooxdoo.org/qxl.demobrowser/#treevirtual~TreeVirtual.html and click on the "To Playground" button. The playground will not run the code sample because of the
super().main();
. Replacing this withthis.base(arguments);
and the code sample runs ok again.