* Figuring out where to place throw statement * Restored path argument destructuring * New approach using comma expressions for assignments * Moved throwNode into body of forXstatements * Refactored with helper function and ensureBlock, additional tests for update exprs * Added exec tests for all violations * Hoisted helper function for comma expression outside of visitor
15 lines
249 B
JavaScript
15 lines
249 B
JavaScript
assert.throws(function() {
|
|
const [a, b] = [1, 2];
|
|
a = 3;
|
|
}, '"a" is read-only')
|
|
|
|
assert.throws(function() {
|
|
const a = 1;
|
|
[a] = [2];
|
|
}, '"a" is read-only');
|
|
|
|
assert.throws(function() {
|
|
const b = 1;
|
|
({b} = {b: 2});
|
|
}, '"b" is read-only');
|