Reviewers: Lasse Reichstein,

Message:
As an `IdentifierStart` character is the most common case for an
`IdentifierPart`, I figured it would be best to perform the U+200C and U+200D
checks right after, but before the more expensive Unicode category lookups.


https://chromiumcodereview.appspot.com/9433031/diff/1/src/char-predicates.h
File src/char-predicates.h (right):

https://chromiumcodereview.appspot.com/9433031/diff/1/src/char-predicates.h#newcode60
src/char-predicates.h:60: || c == 0x200D
As an `IdentifierStart` character is the most common case for an
`IdentifierPart`, I figured it would be best to perform the U+200C and
U+200D checks right after, but before the more expensive Unicode
category lookups.

Description:
Allow the ZWJ and ZWNJ characters in IdentifierPart as per ES5.

Contributed by Mathias Bynens <math...@qiwi.be>.

BUG=1958
TEST=Try `var a\u200c\u200d;` and confirm it doesn't throw an error.

Please review this at https://chromiumcodereview.appspot.com/9433031/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     AUTHORS
  M     src/char-predicates.h


Index: AUTHORS
===================================================================
--- AUTHORS     (revision 10785)
+++ AUTHORS     (working copy)
@@ -29,6 +29,7 @@
 John Jozwiak <jjozw...@codeaurora.org>
 Kun Zhang <zha...@codeaurora.org>
 Martyn Capewell <martyn.capew...@arm.com>
+Mathias Bynens <math...@qiwi.be>
 Matt Hanselman <mjhansel...@gmail.com>
 Maxim Mossienko <maxim.mossie...@gmail.com>
 Michael Smith <m...@w3.org>
Index: src/char-predicates.h
===================================================================
--- src/char-predicates.h       (revision 10785)
+++ src/char-predicates.h       (working copy)
@@ -56,6 +56,8 @@
 struct IdentifierPart {
   static inline bool Is(uc32 c) {
     return IdentifierStart::Is(c)
+        || c == 0x200C
+        || c == 0x200D
         || unibrow::Number::Is(c)
         || unibrow::CombiningMark::Is(c)
         || unibrow::ConnectorPunctuation::Is(c);


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to