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.error; | 5 library engine.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
| 9 import 'package:source_span/source_span.dart'; |
| 10 |
9 import 'ast.dart' show AstNode; | 11 import 'ast.dart' show AstNode; |
10 import 'element.dart'; | 12 import 'element.dart'; |
11 import 'java_core.dart'; | 13 import 'java_core.dart'; |
12 import 'scanner.dart' show Token; | 14 import 'scanner.dart' show Token; |
13 import 'source.dart'; | 15 import 'source.dart'; |
14 | 16 |
15 /** | 17 /** |
16 * An error discovered during the analysis of some Dart code. | 18 * An error discovered during the analysis of some Dart code. |
17 * | 19 * |
18 * See [AnalysisErrorListener]. | 20 * See [AnalysisErrorListener]. |
(...skipping 2637 matching lines...) Loading... |
2656 * Report an error with the given [errorCode] and [arguments]. The location of | 2658 * Report an error with the given [errorCode] and [arguments]. The location of |
2657 * the error is specified by the given [offset] and [length]. | 2659 * the error is specified by the given [offset] and [length]. |
2658 */ | 2660 */ |
2659 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, | 2661 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, |
2660 [List<Object> arguments]) { | 2662 [List<Object> arguments]) { |
2661 _errorListener.onError( | 2663 _errorListener.onError( |
2662 new AnalysisError(_source, offset, length, errorCode, arguments)); | 2664 new AnalysisError(_source, offset, length, errorCode, arguments)); |
2663 } | 2665 } |
2664 | 2666 |
2665 /** | 2667 /** |
| 2668 * Report an error with the given [errorCode] and [arguments]. The location of |
| 2669 * the error is specified by the given [span]. |
| 2670 */ |
| 2671 void reportErrorForSpan(ErrorCode errorCode, SourceSpan span, |
| 2672 [List<Object> arguments]) { |
| 2673 reportErrorForOffset(errorCode, span.start.offset, span.length, arguments); |
| 2674 } |
| 2675 |
| 2676 /** |
2666 * Report an error with the given [errorCode] and [arguments]. The [token] is | 2677 * Report an error with the given [errorCode] and [arguments]. The [token] is |
2667 * used to compute the location of the error. | 2678 * used to compute the location of the error. |
2668 */ | 2679 */ |
2669 void reportErrorForToken(ErrorCode errorCode, Token token, | 2680 void reportErrorForToken(ErrorCode errorCode, Token token, |
2670 [List<Object> arguments]) { | 2681 [List<Object> arguments]) { |
2671 reportErrorForOffset(errorCode, token.offset, token.length, arguments); | 2682 reportErrorForOffset(errorCode, token.offset, token.length, arguments); |
2672 } | 2683 } |
2673 | 2684 |
2674 /** | 2685 /** |
2675 * Report an error with the given [errorCode] and [arguments]. The [node] is | 2686 * Report an error with the given [errorCode] and [arguments]. The [node] is |
(...skipping 2379 matching lines...) Loading... |
5055 * Initialize a newly created error code to have the given [name]. | 5066 * Initialize a newly created error code to have the given [name]. |
5056 */ | 5067 */ |
5057 const TodoCode(String name) : super(name, "{0}"); | 5068 const TodoCode(String name) : super(name, "{0}"); |
5058 | 5069 |
5059 @override | 5070 @override |
5060 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5071 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5061 | 5072 |
5062 @override | 5073 @override |
5063 ErrorType get type => ErrorType.TODO; | 5074 ErrorType get type => ErrorType.TODO; |
5064 } | 5075 } |
OLD | NEW |