alongubkin / alongubkin/spider

Allow accessing global variable with `::` with a local with the same name in scope

Đang mở
#115 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
JavaScript
Star
1.3k
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I expected this to work:

```
::x = 5;
fn addToX(x) {
return ::x + x;
}
::console.log(addToX(2)); // 7
```

However it compiles to (with ES6 target):

``` js
"use strict";
(function () {
x = 5;
function addToX(x) {
return x + x;
}
console.log(addToX(2)); // 4
}());
```

The compiler should maybe rename the local `x` so that the `::x` accesses the global `x`:

``` js
x = 5;
function addToX(x_) {
return x + x_;
}
```

The same should hold for local variables, and for `use`.

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

Đánh giá

Issue này chưa được đánh giá.

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.