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

Unified Diff: runtime/lib/string_patch.dart

Issue 351673002: Add class id constants fields to dart:_internal class 'ClassID'. Use the fields in the library (mor… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
Index: runtime/lib/string_patch.dart
===================================================================
--- runtime/lib/string_patch.dart (revision 37613)
+++ runtime/lib/string_patch.dart (working copy)
@@ -56,9 +56,9 @@
// TODO(srdjan): Also skip copying of wide typed arrays.
final ccid = ClassID.getID(charCodes);
bool isOneByteString = false;
- if ((ccid != _List._classId) &&
- (ccid != _GrowableList._classId) &&
- (ccid != _ImmutableList._classId)) {
+ if ((ccid != ClassID.cidArray) &&
+ (ccid != ClassID.cidGrowableObjectArray) &&
+ (ccid != ClassID.cidImmutableArray)) {
if ((charCodes is Uint8List) || (charCodes is Int8List)) {
isOneByteString = true;
} else {
@@ -510,7 +510,7 @@
int totalLength = 0;
for (int i = 0; i < numValues; i++) {
var s = values[i].toString();
- if (isOneByteString && (ClassID.getID(s) == _OneByteString._classId)) {
+ if (isOneByteString && (ClassID.getID(s) == ClassID.cidOneByteString)) {
totalLength += s.length;
} else {
isOneByteString = false;
@@ -625,7 +625,6 @@
class _OneByteString extends _StringBase implements String {
- static final int _classId = ClassID.getID("A");
factory _OneByteString._uninstantiable() {
throw new UnsupportedError(
@@ -649,7 +648,7 @@
native "OneByteString_splitWithCharCode";
List<String> split(Pattern pattern) {
- if ((ClassID.getID(pattern) == _OneByteString._classId) &&
+ if ((ClassID.getID(pattern) == ClassID.cidOneByteString) &&
(pattern.length == 1)) {
return _splitWithCharCode(pattern.codeUnitAt(0));
}
@@ -679,9 +678,9 @@
int indexOf(Pattern pattern, [int start = 0]) {
// Specialize for single character pattern.
final pCid = ClassID.getID(pattern);
- if ((pCid == _OneByteString._classId) ||
- (pCid == _TwoByteString._classId) ||
- (pCid == _ExternalOneByteString._classId)) {
+ if ((pCid == ClassID.cidOneByteString) ||
+ (pCid == ClassID.cidTwoByteString) ||
+ (pCid == ClassID.cidExternalOneByteString)) {
final len = this.length;
if ((pattern.length == 1) && (start >= 0) && (start < len)) {
final patternCu0 = pattern.codeUnitAt(0);
@@ -701,9 +700,9 @@
bool contains(Pattern pattern, [int start = 0]) {
final pCid = ClassID.getID(pattern);
- if ((pCid == _OneByteString._classId) ||
- (pCid == _TwoByteString._classId) ||
- (pCid == _ExternalOneByteString._classId)) {
+ if ((pCid == ClassID.cidOneByteString) ||
+ (pCid == ClassID.cidTwoByteString) ||
+ (pCid == ClassID.cidExternalOneByteString)) {
final len = this.length;
if ((pattern.length == 1) && (start >= 0) && (start < len)) {
final patternCu0 = pattern.codeUnitAt(0);
@@ -738,8 +737,8 @@
String padLeft(int width, [String padding = ' ']) {
int padCid = ClassID.getID(padding);
- if (padCid != _OneByteString._classId &&
- padCid != _ExternalOneByteString._classId) {
+ if ((padCid != ClassID.cidOneByteString) &&
+ (padCid != ClassID.cidExternalOneByteString)) {
return super.padLeft(width, padding);
}
int length = this.length;
@@ -769,8 +768,8 @@
String padRight(int width, [String padding = ' ']) {
int padCid = ClassID.getID(padding);
- if (padCid != _OneByteString._classId &&
- padCid != _ExternalOneByteString._classId) {
+ if ((padCid != ClassID.cidOneByteString) &&
+ (padCid != ClassID.cidExternalOneByteString)) {
return super.padRight(width, padding);
}
int length = this.length;
@@ -907,8 +906,6 @@
class _TwoByteString extends _StringBase implements String {
- static final int _classId = ClassID.getID("\u{FFFF}");
-
factory _TwoByteString._uninstantiable() {
throw new UnsupportedError(
"_TwoByteString can only be allocated by the VM");
@@ -925,8 +922,6 @@
class _ExternalOneByteString extends _StringBase implements String {
- static final int _classId = _getCid();
-
factory _ExternalOneByteString._uninstantiable() {
throw new UnsupportedError(
"_ExternalOneByteString can only be allocated by the VM");

Powered by Google App Engine
This is Rietveld 408576698