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...) Expand 10 before | Expand all | Expand 10 after 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 _errorListener.onError(new AnalysisError( | |
2674 _source, span.start.offset, span.length, errorCode, arguments)); | |
scheglov
2015/10/21 23:47:21
I'd use reportErrorForOffset() as other reportErro
pquitslund
2015/10/21 23:56:57
Done.
| |
2675 } | |
2676 | |
2677 /** | |
2666 * Report an error with the given [errorCode] and [arguments]. The [token] is | 2678 * Report an error with the given [errorCode] and [arguments]. The [token] is |
2667 * used to compute the location of the error. | 2679 * used to compute the location of the error. |
2668 */ | 2680 */ |
2669 void reportErrorForToken(ErrorCode errorCode, Token token, | 2681 void reportErrorForToken(ErrorCode errorCode, Token token, |
2670 [List<Object> arguments]) { | 2682 [List<Object> arguments]) { |
2671 reportErrorForOffset(errorCode, token.offset, token.length, arguments); | 2683 reportErrorForOffset(errorCode, token.offset, token.length, arguments); |
2672 } | 2684 } |
2673 | 2685 |
2674 /** | 2686 /** |
2675 * Report an error with the given [errorCode] and [arguments]. The [node] is | 2687 * Report an error with the given [errorCode] and [arguments]. The [node] is |
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5055 * Initialize a newly created error code to have the given [name]. | 5067 * Initialize a newly created error code to have the given [name]. |
5056 */ | 5068 */ |
5057 const TodoCode(String name) : super(name, "{0}"); | 5069 const TodoCode(String name) : super(name, "{0}"); |
5058 | 5070 |
5059 @override | 5071 @override |
5060 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5072 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5061 | 5073 |
5062 @override | 5074 @override |
5063 ErrorType get type => ErrorType.TODO; | 5075 ErrorType get type => ErrorType.TODO; |
5064 } | 5076 } |
OLD | NEW |