Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with in-place floordiv expression #886

Open
jggatc opened this issue Dec 23, 2024 · 0 comments
Open

problem with in-place floordiv expression #886

jggatc opened this issue Dec 23, 2024 · 0 comments
Labels

Comments

@jggatc
Copy link

jggatc commented Dec 23, 2024

Expression with in-place floordiv operator within __pragma__('opov') causes error.

Error occurs with x //= y within __pragma__('opov').
Browser error: Uncaught SyntaxError: missing ) after argument list.
Causes whole script to fail execution when code is present even if not called.
Compiler error occurs with ifloordiv (x //= y), no error with floordiv (x = x//y).
Appears to be a compilation error though compiles with no error notice.
No error with other in-place arithmetic ops (+=, /=, %= ...).

python code:

def idiv():
    x = 5
    y = 2
    x //= y
    print(x)

def idiv_opov():
    x = 5
    y = 2
    # __pragma__('opov')
    x //= y
    # __pragma__('noopov')
    print(x)

idiv()

compiled javascript code:

export var idiv = function () {
	var x = 5;
	var y = 2;
	var x = Math.floor (x / y);
	print (x);
};
export var idiv_opov = function () {
	var x = 5;
	var y = 2;
	var x = __call__ (Never here, null, x, y);
	print (x);
};
idiv ();

env: Python3.9 venv with pip install Transcrypt
testing: Firefox version 133 in Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants