mooz / js2-mode

Improved JavaScript editing mode for GNU Emacs
GNU General Public License v3.0
1.33k stars 186 forks source link

Escaped expressions containing a real expression in a template literal inside a a lambda inside a class method break the parser #592

Closed ArneBab closed 2 years ago

ArneBab commented 2 years ago

When using a template literals to create a string that contains an expression (${something}) the parser reports an error:

class Bar {
  foo () {
    [1, 2, 3].forEach((a) => {
      const valid = `\${${a}}`;
      const variable = '123'; // this is highlighted in red as broken
      // in valid, the second '{' and 'a' and the second '}' and the second '`' are also highlighted in red as broken
    });
  }
}

I put the second comment after valid, because when adding that comment on the line of valid, the error does not spill into the line with variable anymore.

dgutov commented 2 years ago

Thanks for the report, should be fine now.

ArneBab commented 2 years ago

Awesome — thank you!