mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* Add test for `const` with `tdz` * Rewrite block-scoping plugin * Update block-scoping fixtures * Update other fixtures * Fix `let` shadowing variable read in a sibling scope * Update fixtures * Update Babel 8 fixtures * Add minNodeVersion * Fix block scoped vars shadowing globals * Review by JLHwung * minNodeVersion to class fields test
34 lines
418 B
JavaScript
34 lines
418 B
JavaScript
function callNow(f) {
|
|
f();
|
|
}
|
|
|
|
function callLater(f) {
|
|
return () => f();
|
|
}
|
|
|
|
expect(() => {
|
|
const x = 0;
|
|
x = 1;
|
|
}).toThrow(TypeError);
|
|
|
|
expect(() => {
|
|
x = 1;
|
|
const x = 0;
|
|
}).toThrow(ReferenceError);
|
|
|
|
expect(() => {
|
|
callNow(() => {
|
|
x = 1;
|
|
});
|
|
const x = 0;
|
|
}).toThrow(ReferenceError);
|
|
|
|
|
|
expect(() => {
|
|
const call = callLater(() => {
|
|
x = 1;
|
|
});
|
|
const x = 0;
|
|
call();
|
|
}).toThrow(TypeError);
|