Debian Codegraph @

packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/update-expression-prefix/exec.js

raw symbols SCIP
1 const state1 = {};
2 expect(function() {
3 const a = "str";
4 state1.getA = () => a;
5
6 --a;
7 }).toThrow('"a" is read-only');
8 expect(state1.getA()).toBe("str"); // Assignment did not succeed
9
10 const state2 = {};
11 expect(function() {
12 const b = {
13 valueOf() {
14 state2.valueOfIsCalled = true;
15 }
16 };
17 state2.b = b;
18 state2.getB = () => b;
19
20 --b;
21 }).toThrow('"b" is read-only');
22 expect(state2.getB()).toBe(state2.b); // Assignment did not succeed
23 expect(state2.valueOfIsCalled).toBe(true); // `bar` was read before error thrown