| 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 engine.source; | 5 library engine.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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 * @param lineStarts the offsets of the first character of each line in the so
urce code | 201 * @param lineStarts the offsets of the first character of each line in the so
urce code |
| 202 */ | 202 */ |
| 203 LineInfo(this._lineStarts) { | 203 LineInfo(this._lineStarts) { |
| 204 if (_lineStarts == null) { | 204 if (_lineStarts == null) { |
| 205 throw new IllegalArgumentException("lineStarts must be non-null"); | 205 throw new IllegalArgumentException("lineStarts must be non-null"); |
| 206 } else if (_lineStarts.length < 1) { | 206 } else if (_lineStarts.length < 1) { |
| 207 throw new IllegalArgumentException("lineStarts must be non-empty"); | 207 throw new IllegalArgumentException("lineStarts must be non-empty"); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 /** | 211 // /** |
| 212 * Return the offset of the first character on the line with the given | 212 // * Return the offset of the first character on the line with the given |
| 213 * [lineNumber]. | 213 // * [lineNumber]. |
| 214 */ | 214 // */ |
| 215 int getLineOffset(int lineNumber) { | 215 // int getLineOffset(int lineNumber) { |
| 216 if (lineNumber < 0 || lineNumber >= _lineStarts.length) { | 216 // if (lineNumber < 0 || lineNumber >= _lineStarts.length) { |
| 217 throw new ArgumentError('Invalid line number: $lineNumber'); | 217 // throw new ArgumentError('Invalid line number: $lineNumber'); |
| 218 } | 218 // } |
| 219 return _lineStarts[lineNumber]; | 219 // return _lineStarts[lineNumber]; |
| 220 } | 220 // } |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * Return the location information for the character at the given offset. | 223 * Return the location information for the character at the given offset. |
| 224 * | 224 * |
| 225 * @param offset the offset of the character for which location information is
to be returned | 225 * @param offset the offset of the character for which location information is
to be returned |
| 226 * @return the location information for the character at the given offset | 226 * @return the location information for the character at the given offset |
| 227 */ | 227 */ |
| 228 LineInfo_Location getLocation(int offset) { | 228 LineInfo_Location getLocation(int offset) { |
| 229 var min = 0; | 229 var min = 0; |
| 230 var max = _lineStarts.length - 1; | 230 var max = _lineStarts.length - 1; |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 1088 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 1089 | 1089 |
| 1090 /** | 1090 /** |
| 1091 * Return an absolute URI that represents the given [source], or `null` if a | 1091 * Return an absolute URI that represents the given [source], or `null` if a |
| 1092 * valid URI cannot be computed. | 1092 * valid URI cannot be computed. |
| 1093 * | 1093 * |
| 1094 * The computation should be based solely on [source.fullName]. | 1094 * The computation should be based solely on [source.fullName]. |
| 1095 */ | 1095 */ |
| 1096 Uri restoreAbsolute(Source source) => null; | 1096 Uri restoreAbsolute(Source source) => null; |
| 1097 } | 1097 } |
| OLD | NEW |