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

Side by Side Diff: pkg/compiler/lib/src/string_validator.dart

Issue 2304923002: Allow surrogates in string literals. (Closed)
Patch Set: Fix bug in dart2js code. Missing return after detecting error. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Check the validity of string literals. 5 // Check the validity of string literals.
6 6
7 library stringvalidator; 7 library stringvalidator;
8 8
9 import 'dart:collection'; 9 import 'dart:collection';
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 value = value * 16 + hexDigitValue(code); 193 value = value * 16 + hexDigitValue(code);
194 } 194 }
195 } 195 }
196 code = value; 196 code = value;
197 } 197 }
198 } 198 }
199 if (code >= 0x10000) { 199 if (code >= 0x10000) {
200 length++; 200 length++;
201 if (code > 0x10FFFF) { 201 if (code > 0x10FFFF) {
202 stringParseError("Invalid code point", token, index); 202 stringParseError("Invalid code point", token, index);
203 return null;
203 } 204 }
204 } 205 }
205 } 206 }
206 // String literal successfully validated. 207 // String literal successfully validated.
207 if (quoting.raw || !containsEscape) { 208 if (quoting.raw || !containsEscape) {
208 // A string without escapes could just as well have been raw. 209 // A string without escapes could just as well have been raw.
209 return new DartString.rawString(string, length); 210 return new DartString.rawString(string, length);
210 } 211 }
211 return new DartString.escapedString(string, length); 212 return new DartString.escapedString(string, length);
212 } 213 }
213 } 214 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698