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 protocol.server; | 5 library protocol.server; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
8 import 'package:analysis_server/plugin/protocol/protocol_dart.dart'; | 8 import 'package:analysis_server/plugin/protocol/protocol_dart.dart'; |
9 import 'package:analysis_server/src/services/correction/fix.dart'; | 9 import 'package:analysis_server/src/services/correction/fix.dart'; |
10 import 'package:analysis_server/src/services/search/search_engine.dart' | 10 import 'package:analysis_server/src/services/search/search_engine.dart' |
(...skipping 25 matching lines...) Expand all Loading... |
36 ErrorProcessor processor = ErrorProcessor.getProcessor(context, error); | 36 ErrorProcessor processor = ErrorProcessor.getProcessor(context, error); |
37 if (processor != null) { | 37 if (processor != null) { |
38 engine.ErrorSeverity severity = processor.severity; | 38 engine.ErrorSeverity severity = processor.severity; |
39 // Errors with null severity are filtered out. | 39 // Errors with null severity are filtered out. |
40 if (severity != null) { | 40 if (severity != null) { |
41 // Specified severities override. | 41 // Specified severities override. |
42 serverErrors | 42 serverErrors |
43 .add(newAnalysisError_fromEngine(lineInfo, error, severity)); | 43 .add(newAnalysisError_fromEngine(lineInfo, error, severity)); |
44 } | 44 } |
45 } else { | 45 } else { |
46 AnalysisError error2 = newAnalysisError_fromEngine(lineInfo, error); | 46 serverErrors.add(newAnalysisError_fromEngine(lineInfo, error)); |
47 bool isStrongMode = context.analysisOptions.strongMode; | |
48 if (isStrongMode && | |
49 error is engine.StaticWarningCode && | |
50 (error as engine.StaticWarningCode).isStrongModeError) { | |
51 error2.severity = AnalysisErrorSeverity.ERROR; | |
52 } | |
53 serverErrors.add(error2); | |
54 } | 47 } |
55 } | 48 } |
56 return serverErrors; | 49 return serverErrors; |
57 } | 50 } |
58 | 51 |
59 /** | 52 /** |
60 * Adds [edit] to the [FileEdit] for the given [element]. | 53 * Adds [edit] to the [FileEdit] for the given [element]. |
61 */ | 54 */ |
62 void doSourceChange_addElementEdit( | 55 void doSourceChange_addElementEdit( |
63 SourceChange change, engine.Element element, SourceEdit edit) { | 56 SourceChange change, engine.Element element, SourceEdit edit) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (lineInfo != null) { | 259 if (lineInfo != null) { |
267 engine.LineInfo_Location offsetLocation = | 260 engine.LineInfo_Location offsetLocation = |
268 lineInfo.getLocation(range.offset); | 261 lineInfo.getLocation(range.offset); |
269 startLine = offsetLocation.lineNumber; | 262 startLine = offsetLocation.lineNumber; |
270 startColumn = offsetLocation.columnNumber; | 263 startColumn = offsetLocation.columnNumber; |
271 } | 264 } |
272 } | 265 } |
273 return new Location( | 266 return new Location( |
274 source.fullName, range.offset, range.length, startLine, startColumn); | 267 source.fullName, range.offset, range.length, startLine, startColumn); |
275 } | 268 } |
OLD | NEW |