Bug 149134

Summary: Confusing error message when closing curly brace is missing in a template literal string
Product: WebKit Reporter: Blaze Burg <bburg>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ggaren, gskachkov, joepeck, saam, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Blaze Burg
Reported 2015-09-14 14:59:54 PDT
STEPS TO REPRODUCE: Here's a test case that runs in the JSC shell: >>> var foo = 123; var bar = `aaa bbb '${typeof foo'.`; 42; Unexpected EOF:1 NOTES: A useful error message occurs in this use case: >>> var foo = 123; var bar = `aaa bbb '${typeof foo ccc'.`; 42; Unexpected identifier 'ccc'. Expected a closing '}' following an expression in template literal.:1
Attachments
Joseph Pecoraro
Comment 1 2015-09-14 15:18:09 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)
Note You need to log in before you can comment on or make changes to this bug.