| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.test_support; | 8 library engine.test_support; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects | 133 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects |
| 134 * all of the errors passed to it for later examination. | 134 * all of the errors passed to it for later examination. |
| 135 */ | 135 */ |
| 136 class GatheringErrorListener implements AnalysisErrorListener { | 136 class GatheringErrorListener implements AnalysisErrorListener { |
| 137 /** | 137 /** |
| 138 * An empty array of errors used when no errors are expected. | 138 * An empty array of errors used when no errors are expected. |
| 139 */ | 139 */ |
| 140 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); | 140 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * The source being parsed. | |
| 144 */ | |
| 145 final String _rawSource; | |
| 146 | |
| 147 /** | |
| 148 * The source being parsed after inserting a marker at the beginning and end o
f the range of the | |
| 149 * most recent error. | |
| 150 */ | |
| 151 String _markedSource; | |
| 152 | |
| 153 /** | |
| 154 * A list containing the errors that were collected. | 143 * A list containing the errors that were collected. |
| 155 */ | 144 */ |
| 156 List<AnalysisError> _errors = new List<AnalysisError>(); | 145 List<AnalysisError> _errors = new List<AnalysisError>(); |
| 157 | 146 |
| 158 /** | 147 /** |
| 159 * A table mapping sources to the line information for the source. | 148 * A table mapping sources to the line information for the source. |
| 160 */ | 149 */ |
| 161 HashMap<Source, LineInfo> _lineInfoMap = new HashMap<Source, LineInfo>(); | 150 HashMap<Source, LineInfo> _lineInfoMap = new HashMap<Source, LineInfo>(); |
| 162 | 151 |
| 163 /** | 152 /** |
| 164 * Initialize a newly created error listener to collect errors. | 153 * Initialize a newly created error listener to collect errors. |
| 165 */ | 154 */ |
| 166 GatheringErrorListener() : this.con1(null); | 155 GatheringErrorListener(); |
| 167 | |
| 168 /** | |
| 169 * Initialize a newly created error listener to collect errors. | |
| 170 */ | |
| 171 GatheringErrorListener.con1(this._rawSource) { | |
| 172 this._markedSource = _rawSource; | |
| 173 } | |
| 174 | 156 |
| 175 /** | 157 /** |
| 176 * Return the errors that were collected. | 158 * Return the errors that were collected. |
| 177 * | 159 * |
| 178 * @return the errors that were collected | 160 * @return the errors that were collected |
| 179 */ | 161 */ |
| 180 List<AnalysisError> get errors => _errors; | 162 List<AnalysisError> get errors => _errors; |
| 181 | 163 |
| 182 /** | 164 /** |
| 183 * Return `true` if at least one error has been gathered. | 165 * Return `true` if at least one error has been gathered. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 for (AnalysisError error in _errors) { | 372 for (AnalysisError error in _errors) { |
| 391 if (identical(error.errorCode, errorCode)) { | 373 if (identical(error.errorCode, errorCode)) { |
| 392 return true; | 374 return true; |
| 393 } | 375 } |
| 394 } | 376 } |
| 395 return false; | 377 return false; |
| 396 } | 378 } |
| 397 | 379 |
| 398 @override | 380 @override |
| 399 void onError(AnalysisError error) { | 381 void onError(AnalysisError error) { |
| 400 if (_rawSource != null) { | |
| 401 int left = error.offset; | |
| 402 int right = left + error.length - 1; | |
| 403 _markedSource = | |
| 404 "${_rawSource.substring(0, left)}^${_rawSource.substring(left, right)}
^${_rawSource.substring(right)}"; | |
| 405 } | |
| 406 _errors.add(error); | 382 _errors.add(error); |
| 407 } | 383 } |
| 408 | 384 |
| 409 /** | 385 /** |
| 410 * Set the line information associated with the given source to the given info
rmation. | 386 * Set the line information associated with the given source to the given info
rmation. |
| 411 * | 387 * |
| 412 * @param source the source with which the line information is associated | 388 * @param source the source with which the line information is associated |
| 413 * @param lineStarts the line start information to be associated with the sour
ce | 389 * @param lineStarts the line start information to be associated with the sour
ce |
| 414 */ | 390 */ |
| 415 void setLineInfo(Source source, List<int> lineStarts) { | 391 void setLineInfo(Source source, List<int> lineStarts) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 void getContentsToReceiver(Source_ContentReceiver receiver) { | 614 void getContentsToReceiver(Source_ContentReceiver receiver) { |
| 639 throw new UnsupportedOperationException(); | 615 throw new UnsupportedOperationException(); |
| 640 } | 616 } |
| 641 Source resolve(String uri) { | 617 Source resolve(String uri) { |
| 642 throw new UnsupportedOperationException(); | 618 throw new UnsupportedOperationException(); |
| 643 } | 619 } |
| 644 Uri resolveRelativeUri(Uri uri) { | 620 Uri resolveRelativeUri(Uri uri) { |
| 645 return new Uri(scheme: 'file', path: _name).resolveUri(uri); | 621 return new Uri(scheme: 'file', path: _name).resolveUri(uri); |
| 646 } | 622 } |
| 647 } | 623 } |
| OLD | NEW |