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

Side by Side Diff: pkg/analyzer/lib/src/generated/source.dart

Issue 1917203002: Remove more type casts (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 /** 261 /**
262 * Return the offset of the first character on the line with the given 262 * Return the offset of the first character on the line with the given
263 * [lineNumber]. 263 * [lineNumber].
264 */ 264 */
265 int getOffsetOfLine(int lineNumber) { 265 int getOffsetOfLine(int lineNumber) {
266 if (lineNumber < 0 || lineNumber >= lineCount) { 266 if (lineNumber < 0 || lineNumber >= lineCount) {
267 throw new ArgumentError('Invalid line number: $lineNumber'); 267 throw new ArgumentError('Invalid line number: $lineNumber');
268 } 268 }
269 return _lineStarts[lineNumber]; 269 return _lineStarts[lineNumber];
270 } 270 }
271
272 } 271 }
273 272
274 /** 273 /**
275 * Instances of the class `Location` represent the location of a character as a line and 274 * Instances of the class `Location` represent the location of a character as a line and
276 * column pair. 275 * column pair.
277 */ 276 */
278 class LineInfo_Location { 277 class LineInfo_Location {
279 /** 278 /**
280 * The one-based index of the line containing the character. 279 * The one-based index of the line containing the character.
281 */ 280 */
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 /** 748 /**
750 * @return the 0-based index of the after-last character of the source code fo r this element, 749 * @return the 0-based index of the after-last character of the source code fo r this element,
751 * relative to the source buffer in which this element is contained. 750 * relative to the source buffer in which this element is contained.
752 */ 751 */
753 int get end => offset + length; 752 int get end => offset + length;
754 753
755 @override 754 @override
756 int get hashCode => 31 * offset + length; 755 int get hashCode => 31 * offset + length;
757 756
758 @override 757 @override
759 bool operator ==(Object obj) { 758 bool operator ==(Object other) {
760 if (obj is! SourceRange) { 759 return other is SourceRange &&
761 return false; 760 other.offset == offset &&
762 } 761 other.length == length;
763 SourceRange sourceRange = obj as SourceRange;
764 return sourceRange.offset == offset && sourceRange.length == length;
765 } 762 }
766 763
767 /** 764 /**
768 * @return `true` if <code>x</code> is in [offset, offset + length) interval. 765 * @return `true` if <code>x</code> is in [offset, offset + length) interval.
769 */ 766 */
770 bool contains(int x) => offset <= x && x < offset + length; 767 bool contains(int x) => offset <= x && x < offset + length;
771 768
772 /** 769 /**
773 * @return `true` if <code>x</code> is in (offset, offset + length) interval. 770 * @return `true` if <code>x</code> is in (offset, offset + length) interval.
774 */ 771 */
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 Source resolveAbsolute(Uri uri, [Uri actualUri]); 915 Source resolveAbsolute(Uri uri, [Uri actualUri]);
919 916
920 /** 917 /**
921 * Return an absolute URI that represents the given [source], or `null` if a 918 * Return an absolute URI that represents the given [source], or `null` if a
922 * valid URI cannot be computed. 919 * valid URI cannot be computed.
923 * 920 *
924 * The computation should be based solely on [source.fullName]. 921 * The computation should be based solely on [source.fullName].
925 */ 922 */
926 Uri restoreAbsolute(Source source) => null; 923 Uri restoreAbsolute(Source source) => null;
927 } 924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698