Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: runtime/lib/string_patch.dart

Issue 381603002: Address comments on double-parse implementation from earlier CL. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_patch.dart
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index c5ed491013dba18c11c69ad2f9fcc0dbff78e44e..0550ca77a32c68c5aa44e5187f078ffc73db1958 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -133,12 +133,12 @@ class _StringBase {
int otherLength = other.length;
int len = (thisLength < otherLength) ? thisLength : otherLength;
for (int i = 0; i < len; i++) {
- int thisCodePoint = this.codeUnitAt(i);
- int otherCodePoint = other.codeUnitAt(i);
- if (thisCodePoint < otherCodePoint) {
+ int thisCodeUnit = this.codeUnitAt(i);
+ int otherCodeUnit = other.codeUnitAt(i);
+ if (thisCodeUnit < otherCodeUnit) {
return -1;
}
- if (thisCodePoint > otherCodePoint) {
+ if (thisCodeUnit > otherCodeUnit) {
return 1;
}
}
@@ -280,17 +280,17 @@ class _StringBase {
// 3000 ; White_Space # Zs IDEOGRAPHIC SPACE
//
// BOM: 0xFEFF
- static bool _isTwoByteWhitespace(int codePoint) {
- if (codePoint < 256) return _isOneByteWhitespace(codePoint);
- return (codePoint == 0x1680) ||
- (codePoint == 0x180E) ||
- ((0x2000 <= codePoint) && (codePoint <= 0x200A)) ||
- (codePoint == 0x2028) ||
- (codePoint == 0x2029) ||
- (codePoint == 0x202F) ||
- (codePoint == 0x205F) ||
- (codePoint == 0x3000) ||
- (codePoint == 0xFEFF);
+ static bool _isTwoByteWhitespace(int codeUnit) {
+ if (codeUnit < 256) return _isOneByteWhitespace(codeUnit);
+ return (codeUnit == 0x1680) ||
+ (codeUnit == 0x180E) ||
+ ((0x2000 <= codeUnit) && (codeUnit <= 0x200A)) ||
+ (codeUnit == 0x2028) ||
+ (codeUnit == 0x2029) ||
+ (codeUnit == 0x202F) ||
+ (codeUnit == 0x205F) ||
+ (codeUnit == 0x3000) ||
+ (codeUnit == 0xFEFF);
}
int _firstNonWhitespace() {
@@ -643,8 +643,8 @@ class _OneByteString extends _StringBase implements String {
int get hashCode native "String_getHashCode";
- bool _isWhitespace(int codePoint) {
- return _StringBase._isOneByteWhitespace(codePoint);
+ bool _isWhitespace(int codeUnit) {
+ return _StringBase._isOneByteWhitespace(codeUnit);
}
bool operator ==(Object other) {
@@ -921,8 +921,8 @@ class _TwoByteString extends _StringBase implements String {
"_TwoByteString can only be allocated by the VM");
}
- bool _isWhitespace(int codePoint) {
- return _StringBase._isTwoByteWhitespace(codePoint);
+ bool _isWhitespace(int codeUnit) {
+ return _StringBase._isTwoByteWhitespace(codeUnit);
}
bool operator ==(Object other) {
@@ -937,8 +937,8 @@ class _ExternalOneByteString extends _StringBase implements String {
"_ExternalOneByteString can only be allocated by the VM");
}
- bool _isWhitespace(int codePoint) {
- return _StringBase._isOneByteWhitespace(codePoint);
+ bool _isWhitespace(int codeUnit) {
+ return _StringBase._isOneByteWhitespace(codeUnit);
}
bool operator ==(Object other) {
@@ -955,8 +955,8 @@ class _ExternalTwoByteString extends _StringBase implements String {
"_ExternalTwoByteString can only be allocated by the VM");
}
- bool _isWhitespace(int codePoint) {
- return _StringBase._isTwoByteWhitespace(codePoint);
+ bool _isWhitespace(int codeUnit) {
+ return _StringBase._isTwoByteWhitespace(codeUnit);
}
bool operator ==(Object other) {
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698