Index: runtime/lib/string_patch.dart |
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart |
index 9a454b114da22988e9e3ccbb692b605011f8ea72..deb5fcf161410224d29ca5ef2cfc6d68399fc668 100644 |
--- a/runtime/lib/string_patch.dart |
+++ b/runtime/lib/string_patch.dart |
@@ -260,12 +260,13 @@ class _StringBase { |
native "StringBase_substringUnchecked"; |
// Checks for one-byte whitespaces only. |
- static bool _isOneByteWhitespace(int codePoint) { |
- return |
- (codePoint == 32) || // Space. |
- ((codePoint <= 13) ? (9 <= codePoint) // CR, LF, TAB, etc. |
- : ((codePoint == 0x85) || // NEL |
- (codePoint == 0xA0))); // NBSP |
+ static bool _isOneByteWhitespace(int codeUnit) { |
+ if (codeUnit <= 32) { |
+ return ((codeUnit == 32) || // Space. |
+ ((codeUnit <= 13) && (codeUnit >= 9))); // CR, LF, TAB, etc. |
+ } |
+ if (codeUnit < 0x85) return false; |
+ return (codeUnit == 0x85) || (codeUnit == 0xA0); |
Lasse Reichstein Nielsen
2014/09/23 11:34:45
Restructured to return false quickly on most ASCII
|
} |
// Characters with Whitespace property (Unicode 6.2). |
@@ -284,7 +285,12 @@ class _StringBase { |
// |
// BOM: 0xFEFF |
static bool _isTwoByteWhitespace(int codeUnit) { |
- if (codeUnit <= 0xA0) return _isOneByteWhitespace(codeUnit); |
+ if (codeUnit <= 32) { |
+ return (codeUnit == 32) || |
+ ((codeUnit <= 13) && (codeUnit >= 9)); |
+ } |
+ if (codeUnit < 0x85) return false; |
+ if ((codeUnit == 0x85) || (codeUnit == 0xA0)) return true; |
return (codeUnit <= 0x200A) |
? ((codeUnit == 0x1680) || |
(codeUnit == 0x180E) || |