You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expression with invert operator of an class instance causes error.
Error occurs with iobj = ~(obj) expression.
Browser error: Uncaught TypeError: Function.prototype.toString called on incompatible object.
Worked properly with iobj = obj.__invert__() expression.
python code:
class Obj:
def __init__(self, x):
self.x = x
def __invert__(self):
return ~self.x
# __pragma__ ('opov')
def op_invert():
obj = Obj(42)
if False:
iobj = ~(obj)
# __pragma__ ('noopov')
op_invert()
compiled javascript code with ~(obj):
export var op_invert = function () {
var obj = __call__ (Obj, null, 10);
var iobj = ~(obj);
};
compiled javascript code with obj.__invert__():
export var op_invert = function () {
var obj = __call__ (Obj, null, 10);
var iobj = (function () {
var __accu0__ = obj;
return __call__ (__accu0__.__invert__, __accu0__);
}) ();
};
env: Python3.9 venv with pip install Transcrypt
testing: Firefox version 133 in Linux
The text was updated successfully, but these errors were encountered:
Expression with invert operator of an class instance causes error.
Error occurs with
iobj = ~(obj)
expression.Browser error: Uncaught TypeError: Function.prototype.toString called on incompatible object.
Worked properly with
iobj = obj.__invert__()
expression.python code:
compiled javascript code with
~(obj)
:compiled javascript code with
obj.__invert__()
:env: Python3.9 venv with pip install Transcrypt
testing: Firefox version 133 in Linux
The text was updated successfully, but these errors were encountered: