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

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

Issue 1454813002: Add server utilities for the stress test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/analysis_server/test/stress/utilities/server.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
213 * [lineNumber].
214 */
215 int getLineOffset(int lineNumber) {
216 if (lineNumber < 0 || lineNumber >= _lineStarts.length) {
217 throw new ArgumentError('Invalid line number: $lineNumber');
218 }
219 return _lineStarts[lineNumber];
220 }
221
222 /**
212 * Return the location information for the character at the given offset. 223 * Return the location information for the character at the given offset.
213 * 224 *
214 * @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
215 * @return the location information for the character at the given offset 226 * @return the location information for the character at the given offset
216 */ 227 */
217 LineInfo_Location getLocation(int offset) { 228 LineInfo_Location getLocation(int offset) {
218 var min = 0; 229 var min = 0;
219 var max = _lineStarts.length - 1; 230 var max = _lineStarts.length - 1;
220 231
221 // Subsequent calls to [getLocation] are often for offsets near each other. 232 // Subsequent calls to [getLocation] are often for offsets near each other.
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 Source resolveAbsolute(Uri uri, [Uri actualUri]); 1088 Source resolveAbsolute(Uri uri, [Uri actualUri]);
1078 1089
1079 /** 1090 /**
1080 * 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
1081 * valid URI cannot be computed. 1092 * valid URI cannot be computed.
1082 * 1093 *
1083 * The computation should be based solely on [source.fullName]. 1094 * The computation should be based solely on [source.fullName].
1084 */ 1095 */
1085 Uri restoreAbsolute(Source source) => null; 1096 Uri restoreAbsolute(Source source) => null;
1086 } 1097 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/stress/utilities/server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698