OLD | NEW |
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"; |
| 10 |
9 import "dart2jslib.dart"; | 11 import "dart2jslib.dart"; |
10 import "tree/tree.dart"; | 12 import "tree/tree.dart"; |
11 import "elements/elements.dart"; | 13 import "elements/elements.dart"; |
12 import "util/characters.dart"; | 14 import "util/characters.dart"; |
13 import "scanner/scannerlib.dart" show Token; | 15 import "scanner/scannerlib.dart" show Token; |
14 | 16 |
15 class StringValidator { | 17 class StringValidator { |
16 final DiagnosticListener listener; | 18 final DiagnosticListener listener; |
17 | 19 |
18 StringValidator(this.listener); | 20 StringValidator(this.listener); |
(...skipping 184 matching lines...) Loading... |
203 return null; | 205 return null; |
204 } | 206 } |
205 // String literal successfully validated. | 207 // String literal successfully validated. |
206 if (quoting.raw || !containsEscape) { | 208 if (quoting.raw || !containsEscape) { |
207 // A string without escapes could just as well have been raw. | 209 // A string without escapes could just as well have been raw. |
208 return new DartString.rawString(string, length); | 210 return new DartString.rawString(string, length); |
209 } | 211 } |
210 return new DartString.escapedString(string, length); | 212 return new DartString.escapedString(string, length); |
211 } | 213 } |
212 } | 214 } |
OLD | NEW |