Bug 121541 - Update identifier syntax to disallow U+2E2F in preparation for ES6
Summary: Update identifier syntax to disallow U+2E2F in preparation for ES6
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://mathias.html5.org/tests/javasc...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-09-18 00:11 PDT by Mathias Bynens
Modified: 2020-03-13 06:53 PDT (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Bynens 2013-09-18 00:11:24 PDT
TC39 discussed http://esdiscuss.org/topic/backwards-compatibility-and-u-2e2f-in-identifier-s and concluded that we should not deviate from Unicode because we don’t want separate lists from Unicode.

That means `\u2E2F` and `ⸯ` need to throw when used as identifier.

For reference, here’s the same bug ticket for SpiderMonkey: https://bugzilla.mozilla.org/show_bug.cgi?id=917436 And for V8: https://code.google.com/p/v8/issues/detail?id=2892
Comment 1 Radar WebKit Bug Importer 2013-09-18 11:42:47 PDT
<rdar://problem/15022545>
Comment 2 Mathias Bynens 2015-03-04 08:31:31 PST
Some more info & examples of what it means to update to the ES6 grammar for identifiers: https://mathiasbynens.be/notes/javascript-identifiers-es6
Comment 3 Mathias Bynens 2015-03-09 14:54:12 PDT
Tests based on ES6 and Unicode 5.1.0, i.e. the minimum required Unicode version as per the spec: https://mathias.html5.org/tests/javascript/identifiers/
Comment 4 Claude Pache 2017-02-07 09:18:22 PST
For reference, the relevant section in the spec is:

https://tc39.github.io/ecma262/#prod-IdentifierName
Comment 5 Alexey Proskuryakov 2017-02-08 17:22:17 PST
Is this still needed for ES6?yus
Comment 6 Mathias Bynens 2017-02-09 00:05:44 PST
(In reply to comment #5)
> Is this still needed for ES6?

Yes.
Comment 7 Mathias Bynens 2020-03-13 06:53:34 PDT
This seems to have been fixed:

```
$ eshost -sx 'var \u2E2F'
#### Chakra

SyntaxError: Invalid character

#### JavaScriptCore

SyntaxError: Invalid unicode escape in identifier: '\u2E2F'

#### SpiderMonkey

SyntaxError: invalid escape sequence:

#### V8, V8 --harmony

SyntaxError: Invalid or unexpected token

#### XS

SyntaxError: invalid character 10
```

…and…

```
$ eshost -sx 'var ⸯ'
#### Chakra

SyntaxError: Invalid character

#### JavaScriptCore

SyntaxError: Invalid character '\u2e2f'

#### SpiderMonkey

SyntaxError: illegal character:

#### V8, V8 --harmony

SyntaxError: Invalid or unexpected token

#### XS

SyntaxError: invalid character 11823
```