overlookmotel / livepack

Serialize live running code to Javascript
MIT License
42 stars 1 forks source link

Tests for "silent" const violations #531

Open overlookmotel opened 11 months ago

overlookmotel commented 11 months ago

A "silent" const is a function expression name which cannot be assigned to, but which doesn't throw an error when assigned to in sloppy mode code.

These are handled correctly in functions. e.g.:

// Sloppy mode
module.exports = function f() {
  f = console.log('hello!');
};

Output:

module.exports = function f() {
  console.log('hello!'); // `f =` assignment removed
};

However, while writing fix for #528, I realised there are no tests for this.