Bug 215977 - [JSC] `let [` sequence cannot appear in ExpressionStatement context
Summary: [JSC] `let [` sequence cannot appear in ExpressionStatement context
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-29 02:27 PDT by Yusuke Suzuki
Modified: 2023-10-17 11:46 PDT (History)
8 users (show)

See Also:


Attachments
Patch (8.88 KB, patch)
2020-08-29 02:30 PDT, Yusuke Suzuki
ross.kirsling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2020-08-29 02:27:12 PDT
[JSC] `let [` sequence cannot appear in ExpressionStatement context
Comment 1 Yusuke Suzuki 2020-08-29 02:30:15 PDT
Created attachment 407538 [details]
Patch
Comment 2 Ross Kirsling 2020-08-29 02:53:34 PDT
Comment on attachment 407538 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407538&action=review

r=me. I'm shocked at how simple this patch is.

> Source/JavaScriptCore/parser/Parser.cpp:1964
> +        failIfTrue(match(OPENBRACKET), "\"let [\" cannot appear at the beginning of expression statement context");

This is fine as an explanation for a spec-aware individual, but I don't think it's clear enough as a user-facing error message.
How about something like "cannot appear in a single-line control flow body"?
Comment 3 Yusuke Suzuki 2020-08-29 13:43:30 PDT
Comment on attachment 407538 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407538&action=review

>> Source/JavaScriptCore/parser/Parser.cpp:1964
>> +        failIfTrue(match(OPENBRACKET), "\"let [\" cannot appear at the beginning of expression statement context");
> 
> This is fine as an explanation for a spec-aware individual, but I don't think it's clear enough as a user-facing error message.
> How about something like "cannot appear in a single-line control flow body"?

Yeah, I've changed this to `Cannot use lexical declaration in single-statement context.`
Comment 4 Yusuke Suzuki 2020-08-29 13:44:31 PDT
Committed r266327: <https://trac.webkit.org/changeset/266327>
Comment 5 Radar WebKit Bug Importer 2020-08-29 13:45:26 PDT
<rdar://problem/68004458>