problem with in-place floordiv expression

Đang mở
#886 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, python
Lĩnh vực
compilers

Hướng nghiên cứu

Start by compiling the provided Python reproduction containing x //= y inside __pragma__('opov'), then inspect the generated JavaScript around __call__ (Never here, null, x, y). Confirm the compiler emits valid JavaScript and preserves in-place floor-division behavior under opov, while existing arithmetic operators remain unaffected.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

IS: bug?

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

Ngôn ngữ chính
Python
Star
2.9k
Fork
218
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TranscryptOrg/Transcrypt

Tất cả issue của TranscryptOrg/Transcrypt

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.