OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.source.error_processor; | 5 library analyzer.source.error_processor; |
6 | 6 |
7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
9 import 'package:analyzer/src/generated/utilities_general.dart'; | 9 import 'package:analyzer/src/generated/utilities_general.dart'; |
10 import 'package:analyzer/src/task/options.dart'; | 10 import 'package:analyzer/src/task/options.dart'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 // TODO(rnystrom): As far as I know, this is only used to implement | 115 // TODO(rnystrom): As far as I know, this is only used to implement |
116 // appliesTo(). Consider making it private in ErrorProcessor if possible. | 116 // appliesTo(). Consider making it private in ErrorProcessor if possible. |
117 String get code => throw new UnsupportedError( | 117 String get code => throw new UnsupportedError( |
118 "_StrongModeTypeErrorProcessor is not specific to an error code."); | 118 "_StrongModeTypeErrorProcessor is not specific to an error code."); |
119 | 119 |
120 /// In strong mode, type warnings are upgraded to errors. | 120 /// In strong mode, type warnings are upgraded to errors. |
121 ErrorSeverity get severity => ErrorSeverity.ERROR; | 121 ErrorSeverity get severity => ErrorSeverity.ERROR; |
122 | 122 |
123 /// Check if this processor applies to the given [error]. | 123 /// Check if this processor applies to the given [error]. |
124 bool appliesTo(AnalysisError error) => | 124 bool appliesTo(AnalysisError error) { |
125 error.errorCode.type == ErrorType.STATIC_TYPE_WARNING; | 125 ErrorCode errorCode = error.errorCode; |
| 126 if (errorCode is StaticTypeWarningCode) { |
| 127 return true; |
| 128 } |
| 129 if (errorCode is StaticWarningCode) { |
| 130 return errorCode.isStrongModeError; |
| 131 } |
| 132 return false; |
| 133 } |
126 } | 134 } |
OLD | NEW |