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

Unified Diff: sdk/lib/json/json_base.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 10 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 | « sdk/lib/io/websocket_impl.dart ('k') | sdk/lib/uri/encode_decode.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/json/json_base.dart
diff --git a/sdk/lib/json/json_base.dart b/sdk/lib/json/json_base.dart
index bf1b01e6fd6b8667e0e3c57395a50b3ff68d81be..4f666a92dee24d36345bff31ac824d2386d5787c 100644
--- a/sdk/lib/json/json_base.dart
+++ b/sdk/lib/json/json_base.dart
@@ -324,7 +324,7 @@ class JsonParser {
int position = 0;
int length = source.length;
while (position < length) {
- int char = source.charCodeAt(position);
+ int char = source.codeUnitAt(position);
switch (char) {
case SPACE:
case CARRIAGE_RETURN:
@@ -425,11 +425,11 @@ class JsonParser {
* [:source[position]:] must be "t".
*/
int parseTrue(int position) {
- assert(source.charCodeAt(position) == CHAR_t);
+ assert(source.codeUnitAt(position) == CHAR_t);
if (source.length < position + 4) fail(position, "Unexpected identifier");
- if (source.charCodeAt(position + 1) != CHAR_r ||
- source.charCodeAt(position + 2) != CHAR_u ||
- source.charCodeAt(position + 3) != CHAR_e) {
+ if (source.codeUnitAt(position + 1) != CHAR_r ||
+ source.codeUnitAt(position + 2) != CHAR_u ||
+ source.codeUnitAt(position + 3) != CHAR_e) {
fail(position);
}
listener.handleBool(true);
@@ -442,12 +442,12 @@ class JsonParser {
* [:source[position]:] must be "f".
*/
int parseFalse(int position) {
- assert(source.charCodeAt(position) == CHAR_f);
+ assert(source.codeUnitAt(position) == CHAR_f);
if (source.length < position + 5) fail(position, "Unexpected identifier");
- if (source.charCodeAt(position + 1) != CHAR_a ||
- source.charCodeAt(position + 2) != CHAR_l ||
- source.charCodeAt(position + 3) != CHAR_s ||
- source.charCodeAt(position + 4) != CHAR_e) {
+ if (source.codeUnitAt(position + 1) != CHAR_a ||
+ source.codeUnitAt(position + 2) != CHAR_l ||
+ source.codeUnitAt(position + 3) != CHAR_s ||
+ source.codeUnitAt(position + 4) != CHAR_e) {
fail(position);
}
listener.handleBool(false);
@@ -459,11 +459,11 @@ class JsonParser {
* [:source[position]:] must be "n".
*/
int parseNull(int position) {
- assert(source.charCodeAt(position) == CHAR_n);
+ assert(source.codeUnitAt(position) == CHAR_n);
if (source.length < position + 4) fail(position, "Unexpected identifier");
- if (source.charCodeAt(position + 1) != CHAR_u ||
- source.charCodeAt(position + 2) != CHAR_l ||
- source.charCodeAt(position + 3) != CHAR_l) {
+ if (source.codeUnitAt(position + 1) != CHAR_u ||
+ source.codeUnitAt(position + 2) != CHAR_l ||
+ source.codeUnitAt(position + 3) != CHAR_l) {
fail(position);
}
listener.handleNull();
@@ -479,7 +479,7 @@ class JsonParser {
if (position == source.length) {
fail(start - 1, "Unterminated string");
}
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
if (char == QUOTE) {
listener.handleString(source.substring(start, position));
return position + 1;
@@ -496,7 +496,7 @@ class JsonParser {
if (position == source.length) {
fail(start - 1, "Unterminated string");
}
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
switch (char) {
case CHAR_b: char = BACKSPACE; break;
case CHAR_f: char = FORM_FEED; break;
@@ -515,7 +515,7 @@ class JsonParser {
if (position == source.length) {
fail(start - 1, "Unterminated string");
}
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
char -= 0x30;
if (char < 0) fail(hexStart, "Invalid unicode escape");
if (char < 10) {
@@ -538,7 +538,7 @@ class JsonParser {
chars.add(char);
position++;
if (position == source.length) fail(start - 1, "Unterminated string");
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
if (char == QUOTE) {
String result = new String.fromCharCodes(chars);
if (start < firstEscape) {
@@ -564,7 +564,7 @@ class JsonParser {
if (char == MINUS) {
position++;
if (position == length) fail(position, "Missing expected digit");
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
}
if (char < CHAR_0 || char > CHAR_9) {
fail(position, "Missing expected digit");
@@ -579,7 +579,7 @@ class JsonParser {
if (char == CHAR_0) {
position++;
if (position == length) return handleLiteral(position);
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
if (CHAR_0 <= char && char <= CHAR_9) {
fail(position);
}
@@ -587,30 +587,30 @@ class JsonParser {
do {
position++;
if (position == length) return handleLiteral(position);
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
} while (CHAR_0 <= char && char <= CHAR_9);
}
if (char == DECIMALPOINT) {
isDouble = true;
position++;
if (position == length) fail(position, "Missing expected digit");
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
if (char < CHAR_0 || char > CHAR_9) fail(position);
do {
position++;
if (position == length) return handleLiteral(position);
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
} while (CHAR_0 <= char && char <= CHAR_9);
}
if (char == CHAR_e || char == CHAR_E) {
isDouble = true;
position++;
if (position == length) fail(position, "Missing expected digit");
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
if (char == PLUS || char == MINUS) {
position++;
if (position == length) fail(position, "Missing expected digit");
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
}
if (char < CHAR_0 || char > CHAR_9) {
fail(position, "Missing expected digit");
@@ -618,7 +618,7 @@ class JsonParser {
do {
position++;
if (position == length) return handleLiteral(position);
- char = source.charCodeAt(position);
+ char = source.codeUnitAt(position);
} while (CHAR_0 <= char && char <= CHAR_9);
}
return handleLiteral(position);
@@ -670,7 +670,7 @@ class _JsonStringifier {
bool needsEscape = false;
final charCodes = new List<int>();
for (int i = 0; i < length; i++) {
- int charCode = s.charCodeAt(i);
+ int charCode = s.codeUnitAt(i);
if (charCode < 32) {
needsEscape = true;
charCodes.add(JsonParser.BACKSLASH);
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | sdk/lib/uri/encode_decode.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698