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

Unified Diff: runtime/lib/string_patch.dart

Issue 345223003: Add VM internal Dart class 'ClassID' used to manage class-ids of known classes. Next CL: add consta… (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
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/lib/typed_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_patch.dart
===================================================================
--- runtime/lib/string_patch.dart (revision 37566)
+++ runtime/lib/string_patch.dart (working copy)
@@ -54,7 +54,7 @@
static String createFromCharCodes(Iterable<int> charCodes) {
if (charCodes != null) {
// TODO(srdjan): Also skip copying of wide typed arrays.
- final ccid = charCodes._cid;
+ final ccid = ClassID.getID(charCodes);
bool isOneByteString = false;
if ((ccid != _List._classId) &&
(ccid != _GrowableList._classId) &&
@@ -510,7 +510,7 @@
int totalLength = 0;
for (int i = 0; i < numValues; i++) {
var s = values[i].toString();
- if (isOneByteString && (s._cid == _OneByteString._classId)) {
+ if (isOneByteString && (ClassID.getID(s) == _OneByteString._classId)) {
totalLength += s.length;
} else {
isOneByteString = false;
@@ -625,7 +625,7 @@
class _OneByteString extends _StringBase implements String {
- static final int _classId = "A"._cid;
+ static final int _classId = ClassID.getID("A");
factory _OneByteString._uninstantiable() {
throw new UnsupportedError(
@@ -649,7 +649,8 @@
native "OneByteString_splitWithCharCode";
List<String> split(Pattern pattern) {
- if ((pattern._cid == _OneByteString._classId) && (pattern.length == 1)) {
+ if ((ClassID.getID(pattern) == _OneByteString._classId) &&
+ (pattern.length == 1)) {
return _splitWithCharCode(pattern.codeUnitAt(0));
}
return super.split(pattern);
@@ -677,7 +678,7 @@
int indexOf(Pattern pattern, [int start = 0]) {
// Specialize for single character pattern.
- final pCid = pattern._cid;
+ final pCid = ClassID.getID(pattern);
if ((pCid == _OneByteString._classId) ||
(pCid == _TwoByteString._classId) ||
(pCid == _ExternalOneByteString._classId)) {
@@ -699,7 +700,7 @@
}
bool contains(Pattern pattern, [int start = 0]) {
- final pCid = pattern._cid;
+ final pCid = ClassID.getID(pattern);
if ((pCid == _OneByteString._classId) ||
(pCid == _TwoByteString._classId) ||
(pCid == _ExternalOneByteString._classId)) {
@@ -736,7 +737,7 @@
}
String padLeft(int width, [String padding = ' ']) {
- int padCid = padding._cid;
+ int padCid = ClassID.getID(padding);
if (padCid != _OneByteString._classId &&
padCid != _ExternalOneByteString._classId) {
return super.padLeft(width, padding);
@@ -767,7 +768,7 @@
}
String padRight(int width, [String padding = ' ']) {
- int padCid = padding._cid;
+ int padCid = ClassID.getID(padding);
if (padCid != _OneByteString._classId &&
padCid != _ExternalOneByteString._classId) {
return super.padRight(width, padding);
@@ -906,7 +907,7 @@
class _TwoByteString extends _StringBase implements String {
- static final int _classId = "\u{FFFF}"._cid;
+ static final int _classId = ClassID.getID("\u{FFFF}");
factory _TwoByteString._uninstantiable() {
throw new UnsupportedError(
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/lib/typed_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698