Miscompilation of `makeFunc()()`

Đang mở
#71 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ó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
compilers

Hướng nghiên cứu

Start by locating the compiler code that emits PCode for function calls and constructor expressions; the issue gives examples for makeFunc()() and new (makeClass())(). Compile those examples and compare the output with the expected sequences in the issue. Done means both cases emit the shown Push undefined before CallMethod or NewMethod, followed by Pop.

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

Mô tả

This snippet:

makeFunc()();

is compiled as:

Push 0, 0, "makeFunc"
CallFunction
CallFunction // <-- wrong
Pop

which isn't correct; CallFunction expects the name of the function to call, not the function itself, so the PCode should instead be:

Push 0, 0, "makeFunc"
CallFunction
Push undefined // or equivalently, Push ""
CallMethod
Pop

EDIT: A similar issue exists for new (makeClass())()

// Rascal PCode
Push 0, 0, "makeClass"
CallFunction
NewMethod // <-- wrong
// also, missing Pop?

// Expected PCode
Push 0, 0, "makeClass"
CallFunction
Push undefined // or equivalently, Push ""
NewMethod
Pop
Ngôn ngữ chính
Rust
Star
22
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 Dinnerbone/Rascal

Tất cả issue của Dinnerbone/Rascal

Issue tương tự

Thêm issue về Rust

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.