Index: sdk/lib/json/json.dart |
diff --git a/sdk/lib/json/json.dart b/sdk/lib/json/json.dart |
index 4348767eea666865b422cd6e22b80c4042b1f1bc..d150709e5933415102c010b0a6a70f54e092ec3e 100644 |
--- a/sdk/lib/json/json.dart |
+++ b/sdk/lib/json/json.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); |