| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 | 8 |
| 9 // ASCII character codes. | 9 // ASCII character codes. |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 /// | 81 /// |
| 82 /// Throws an [ArgumentError] if [literal] contains interpolated strings. | 82 /// Throws an [ArgumentError] if [literal] contains interpolated strings. |
| 83 StringLiteralIterator(StringLiteral literal) { | 83 StringLiteralIterator(StringLiteral literal) { |
| 84 if (literal is StringInterpolation) { | 84 if (literal is StringInterpolation) { |
| 85 throw new ArgumentError("Can't iterate over an interpolated string."); | 85 throw new ArgumentError("Can't iterate over an interpolated string."); |
| 86 } else if (literal is SimpleStringLiteral) { | 86 } else if (literal is SimpleStringLiteral) { |
| 87 _strings.add(literal); | 87 _strings.add(literal); |
| 88 } else { | 88 } else { |
| 89 assert(literal is AdjacentStrings); | 89 assert(literal is AdjacentStrings); |
| 90 | 90 |
| 91 for (var string in literal.strings) { | 91 for (var string in (literal as AdjacentStrings).strings) { |
| 92 if (string is StringInterpolation) { | 92 if (string is StringInterpolation) { |
| 93 throw new ArgumentError("Can't iterate over an interpolated string."); | 93 throw new ArgumentError("Can't iterate over an interpolated string."); |
| 94 } | 94 } |
| 95 assert(string is SimpleStringLiteral); | 95 assert(string is SimpleStringLiteral); |
| 96 _strings.add(string); | 96 _strings.add(string); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 _offset = _strings.first.contentsOffset - 1; | 100 _offset = _strings.first.contentsOffset - 1; |
| 101 } | 101 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return null; | 236 return null; |
| 237 } | 237 } |
| 238 | 238 |
| 239 /// Move [_runes] to the next rune and update [_nextOffset]. | 239 /// Move [_runes] to the next rune and update [_nextOffset]. |
| 240 bool _moveRunesNext() { | 240 bool _moveRunesNext() { |
| 241 var result = _runes.moveNext(); | 241 var result = _runes.moveNext(); |
| 242 _nextOffset++; | 242 _nextOffset++; |
| 243 return result; | 243 return result; |
| 244 } | 244 } |
| 245 } | 245 } |
| OLD | NEW |