| Summary: | Confusing error message when closing curly brace is missing in a template literal string | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | BJ Burg <bburg> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | ggaren, gskachkov, joepeck, saam, ysuzuki |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
BJ Burg
2015-09-14 14:59:54 PDT
> >>> var foo = 123; var bar = `aaa bbb '${typeof foo'.`; 42;
There are a couple interesting things here.
(1) The error comes from attempting to start parsing the nested template string:
This is valid: ` ... ${ ... `nested` }`
In the above, the nested template is `; 42;<EOF>`.
(2) We could have errored out sooner, in cases like:
foo.' (tokenizes a string)
foo.` (tokenizes a template string)
|