Bug 219575 - [JSC] Accept escaped keywords for class and object property names
Summary: [JSC] Accept escaped keywords for class and object property names
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
: 200638 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-12-05 22:14 PST by Yusuke Suzuki
Modified: 2020-12-06 07:38 PST (History)
9 users (show)

See Also:


Attachments
Patch (76.73 KB, patch)
2020-12-05 22:16 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (76.60 KB, patch)
2020-12-05 22:17 PST, Yusuke Suzuki
ashvayka: 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-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. ***