summaryrefslogtreecommitdiffstats
path: root/js/src/vm/Unicode.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/vm/Unicode.h')
-rw-r--r--js/src/vm/Unicode.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/js/src/vm/Unicode.h b/js/src/vm/Unicode.h
index 8b538d06d..bdac848fb 100644
--- a/js/src/vm/Unicode.h
+++ b/js/src/vm/Unicode.h
@@ -143,11 +143,15 @@ IsIdentifierStart(char16_t ch)
return CharInfo(ch).isUnicodeIDStart();
}
+bool
+IsIdentifierStartNonBMP(uint32_t codePoint);
+
inline bool
IsIdentifierStart(uint32_t codePoint)
{
- // TODO: Supplemental code points not yet supported (bug 1197230).
- return codePoint <= UTF16Max && IsIdentifierStart(char16_t(codePoint));
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierStartNonBMP(codePoint);
+ return IsIdentifierStart(char16_t(codePoint));
}
inline bool
@@ -170,11 +174,16 @@ IsIdentifierPart(char16_t ch)
return CharInfo(ch).isUnicodeIDContinue();
}
+
+bool
+IsIdentifierPartNonBMP(uint32_t codePoint);
+
inline bool
IsIdentifierPart(uint32_t codePoint)
{
- // TODO: Supplemental code points not yet supported (bug 1197230).
- return codePoint <= UTF16Max && IsIdentifierPart(char16_t(codePoint));
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierPartNonBMP(codePoint);
+ return IsIdentifierPart(char16_t(codePoint));
}
inline bool
@@ -183,6 +192,17 @@ IsUnicodeIDStart(char16_t ch)
return CharInfo(ch).isUnicodeIDStart();
}
+bool
+IsUnicodeIDStartNonBMP(uint32_t codePoint);
+
+inline bool
+IsUnicodeIDStart(uint32_t codePoint)
+{
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierStartNonBMP(codePoint);
+ return IsUnicodeIDStart(char16_t(codePoint));
+}
+
inline bool
IsSpace(char16_t ch)
{