| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.generated.source; | 5 library analyzer.src.generated.source; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 * Return the offset of the first character on the line with the given | 285 * Return the offset of the first character on the line with the given |
| 286 * [lineNumber]. | 286 * [lineNumber]. |
| 287 */ | 287 */ |
| 288 int getOffsetOfLine(int lineNumber) { | 288 int getOffsetOfLine(int lineNumber) { |
| 289 if (lineNumber < 0 || lineNumber >= lineCount) { | 289 if (lineNumber < 0 || lineNumber >= lineCount) { |
| 290 throw new ArgumentError( | 290 throw new ArgumentError( |
| 291 'Invalid line number: $lineNumber; must be between 0 and ${lineCount -
1}'); | 291 'Invalid line number: $lineNumber; must be between 0 and ${lineCount -
1}'); |
| 292 } | 292 } |
| 293 return lineStarts[lineNumber]; | 293 return lineStarts[lineNumber]; |
| 294 } | 294 } |
| 295 |
| 296 /** |
| 297 * Return the offset of the first character on the line following the line |
| 298 * containing the given [offset]. |
| 299 */ |
| 300 int getOffsetOfLineAfter(int offset) { |
| 301 return getOffsetOfLine(getLocation(offset).lineNumber + 1); |
| 302 } |
| 295 } | 303 } |
| 296 | 304 |
| 297 /** | 305 /** |
| 298 * Instances of the class `Location` represent the location of a character as a
line and | 306 * Instances of the class `Location` represent the location of a character as a
line and |
| 299 * column pair. | 307 * column pair. |
| 300 */ | 308 */ |
| 301 class LineInfo_Location { | 309 class LineInfo_Location { |
| 302 /** | 310 /** |
| 303 * The one-based index of the line containing the character. | 311 * The one-based index of the line containing the character. |
| 304 */ | 312 */ |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 770 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 763 | 771 |
| 764 /** | 772 /** |
| 765 * Return an absolute URI that represents the given [source], or `null` if a | 773 * Return an absolute URI that represents the given [source], or `null` if a |
| 766 * valid URI cannot be computed. | 774 * valid URI cannot be computed. |
| 767 * | 775 * |
| 768 * The computation should be based solely on [source.fullName]. | 776 * The computation should be based solely on [source.fullName]. |
| 769 */ | 777 */ |
| 770 Uri restoreAbsolute(Source source) => null; | 778 Uri restoreAbsolute(Source source) => null; |
| 771 } | 779 } |
| OLD | NEW |