Debian Codegraph @

packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/no-assignment/exec.js

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