| 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 /// Types needed to implement "strong" checking in the Dart analyzer. | 5 /// Types needed to implement "strong" checking in the Dart analyzer. |
| 6 /// This is intended to be used by analyzer_cli and analysis_server packages. | 6 /// This is intended to be used by analyzer_cli and analysis_server packages. |
| 7 library dev_compiler.strong_mode; | 7 library dev_compiler.strong_mode; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart' | 9 import 'package:analyzer/src/generated/engine.dart' |
| 10 show AnalysisContextImpl, AnalysisErrorInfo, AnalysisErrorInfoImpl; | 10 show AnalysisContextImpl, AnalysisErrorInfo, AnalysisErrorInfoImpl; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // TODO(jmesserly): change DDC to emit ErrorCodes directly. | 57 // TODO(jmesserly): change DDC to emit ErrorCodes directly. |
| 58 _reporter._log = (Message msg) { | 58 _reporter._log = (Message msg) { |
| 59 // Skip hints unless requested. | 59 // Skip hints unless requested. |
| 60 if (msg.level < Level.WARNING && !_options.hints) return; | 60 if (msg.level < Level.WARNING && !_options.hints) return; |
| 61 | 61 |
| 62 var errorCodeFactory = _levelToErrorCode[msg.level]; | 62 var errorCodeFactory = _levelToErrorCode[msg.level]; |
| 63 var category = '${msg.runtimeType}'; | 63 var category = '${msg.runtimeType}'; |
| 64 var errorCode = errorCodeFactory(category, msg.message); | 64 var errorCode = errorCodeFactory(category, msg.message); |
| 65 var len = msg.end - msg.begin; | 65 var len = msg.end - msg.begin; |
| 66 errors.add(new AnalysisError.con2(source, msg.begin, len, errorCode)); | 66 errors.add(new AnalysisError(source, msg.begin, len, errorCode)); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 for (Source librarySource in _context.getLibrariesContaining(source)) { | 69 for (Source librarySource in _context.getLibrariesContaining(source)) { |
| 70 var resolved = _context.resolveCompilationUnit2(source, librarySource); | 70 var resolved = _context.resolveCompilationUnit2(source, librarySource); |
| 71 _checker.visitCompilationUnit(resolved); | 71 _checker.visitCompilationUnit(resolved); |
| 72 } | 72 } |
| 73 _reporter._log = null; | 73 _reporter._log = null; |
| 74 return new AnalysisErrorInfoImpl(errors, _context.getLineInfo(source)); | 74 return new AnalysisErrorInfoImpl(errors, _context.getLineInfo(source)); |
| 75 } | 75 } |
| 76 } | 76 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 List<String> _optionsToList(String option, | 202 List<String> _optionsToList(String option, |
| 203 {List<String> defaultValue: const <String>[]}) { | 203 {List<String> defaultValue: const <String>[]}) { |
| 204 if (option == null) { | 204 if (option == null) { |
| 205 return defaultValue; | 205 return defaultValue; |
| 206 } else if (option.isEmpty) { | 206 } else if (option.isEmpty) { |
| 207 return <String>[]; | 207 return <String>[]; |
| 208 } else { | 208 } else { |
| 209 return option.split(','); | 209 return option.split(','); |
| 210 } | 210 } |
| 211 } | 211 } |
| OLD | NEW |