Bug 121541
Summary: | Update identifier syntax to disallow U+2E2F in preparation for ES6 | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mathias Bynens <mathias> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | annevk, ap, claude.pache, fpizlo, ggaren, keith_miller, mathias, m.goleb+bugzilla, oliver, syoichi, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | http://mathias.html5.org/tests/javascript/identifiers/ |
Mathias Bynens
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
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/15022545>
Mathias Bynens
Some more info & examples of what it means to update to the ES6 grammar for identifiers: https://mathiasbynens.be/notes/javascript-identifiers-es6
Mathias Bynens
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/
Claude Pache
For reference, the relevant section in the spec is:
https://tc39.github.io/ecma262/#prod-IdentifierName
Alexey Proskuryakov
Is this still needed for ES6?yus
Mathias Bynens
(In reply to comment #5)
> Is this still needed for ES6?
Yes.
Mathias Bynens
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
```