Skip to content

problem with in-place floordiv expression #886

@jggatc

Description

@jggatc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions