mooz/js2-mode

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

ArneBab opened this issue · 2 comments

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.

Thanks for the report, should be fine now.

Awesome — thank you!