New issue
Advanced search Search tips

Issue 725361 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 724586
Owner: ----
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Template literal string is wrongly highlighted as comment in console

Reported by hakerh403@gmail.com, May 23 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
Type the following code to Chrome's console:
  `${async++}//`;
  `${await++}//`;
  `${let++}//`;

What is the expected behavior?
The expected behaviout is that template literal strings should be highlighted like srings.

What went wrong?
In all of the given examples template literal strings are highlighted like comments (after //). According to the ES7 specs and according to this answer https://stackoverflow.com/questions/44079464/javascript-is-yield-a-proper-identifier-name-in-es7
these examples are correct ES7 syntax. In non-strict mode identifiers like async, await, let (maybe I miss a few more) are allowed like identifier names. We are incrementing these identifiers and stringifying them in template literal string. However, Chrome didn't expect them to be used in this manner, so Chrome obviously expects identifier after increment operator (but token after that is closed brace which should be end of nested literal) and Chrome then thinks that "//" is an inline comment.

Did this work before? No 

Chrome version: 58.0.3029.110  Channel: stable
OS Version: 6.3
Flash Version: The flash is completelly disabled and blocked
 
Mergedinto: 724586
Status: Duplicate (was: Unconfirmed)
Seems similar to the  issue 724586 .Hence merging this into 724586.
Please feel free to undupe if not similar.

Thanks,

Sign in to add a comment