Bug 219575

Summary: [JSC] Accept escaped keywords for class and object property names
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: ashvayka, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, wwigham
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch ashvayka: review+

Description Yusuke Suzuki 2020-12-05 22:14:09 PST
[JSC] Accept escaped keywords for class and object property names
Comment 1 Yusuke Suzuki 2020-12-05 22:16:34 PST
Created attachment 415510 [details]
Patch
Comment 2 Yusuke Suzuki 2020-12-05 22:17:44 PST
Created attachment 415511 [details]
Patch
Comment 3 Alexey Shvayka 2020-12-05 22:33:03 PST
Comment on attachment 415511 [details]
Patch

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

Great job on this very neat change! r=me with a question.

> Source/JavaScriptCore/parser/ParserTokens.h:197
> +    INVALID_TEMPLATE_LITERAL_ERRORTOK = 15 | CanBeErrorTokenFlag,

While introducing CanBeErrorTokenFlag for ESCAPED_KEYWORD makes perfect sense, perhaps we should leave more strict ErrorTokenFlag for other types that are definitely syntax errors?
Comment 4 Yusuke Suzuki 2020-12-05 23:11:12 PST
Comment on attachment 415511 [details]
Patch

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

Thanks!!

>> Source/JavaScriptCore/parser/ParserTokens.h:197
>> +    INVALID_TEMPLATE_LITERAL_ERRORTOK = 15 | CanBeErrorTokenFlag,
> 
> While introducing CanBeErrorTokenFlag for ESCAPED_KEYWORD makes perfect sense, perhaps we should leave more strict ErrorTokenFlag for other types that are definitely syntax errors?

I think that every token can cause an error. For example, if keyword appears in `var keyword` place, it is an error.
So, the thing we would like to know is that, whether the produced token can have a special message for parser errors, and this is CanBeErrorTokenFlag which indicates that this token can be an special error token.
I think current form is OK because of two reasons. One is that, this makes CanBeErrorTokenFlag meaning more general, and another reason is that adding another flag (e.g. DefinitelyErrorTokenFlag) consumes token bit, which we would like to keep :)
Comment 5 Yusuke Suzuki 2020-12-05 23:55:02 PST
Will update stress/reserved-word-with-escape.js
Comment 6 Yusuke Suzuki 2020-12-06 00:41:37 PST
Committed r270481: <https://trac.webkit.org/changeset/270481>
Comment 7 Radar WebKit Bug Importer 2020-12-06 00:42:15 PST
<rdar://problem/72017752>
Comment 8 Alexey Shvayka 2020-12-06 07:38:22 PST
*** Bug 200638 has been marked as a duplicate of this bug. ***