| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_impl; | 5 library analyzer_impl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 setupForAnalysis(); | 143 setupForAnalysis(); |
| 144 return _analyzeSync(printMode); | 144 return _analyzeSync(printMode); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void prepareAnalysisContext(JavaFile sourceFile, Source source) { | 147 void prepareAnalysisContext(JavaFile sourceFile, Source source) { |
| 148 List<UriResolver> resolvers = [ | 148 List<UriResolver> resolvers = [ |
| 149 new CustomUriResolver(options.customUrlMappings), | 149 new CustomUriResolver(options.customUrlMappings), |
| 150 new DartUriResolver(sdk), | 150 new DartUriResolver(sdk), |
| 151 new FileUriResolver() | 151 new FileUriResolver() |
| 152 ]; | 152 ]; |
| 153 // may be add package resolver | 153 // maybe add package resolver |
| 154 { | 154 { |
| 155 JavaFile packageDirectory; | 155 JavaFile packageDirectory; |
| 156 if (options.packageRootPath != null) { | 156 if (options.packageRootPath != null) { |
| 157 packageDirectory = new JavaFile(options.packageRootPath); | 157 packageDirectory = new JavaFile(options.packageRootPath); |
| 158 resolvers.add(new PackageUriResolver([packageDirectory])); | 158 resolvers.add(new PackageUriResolver([packageDirectory])); |
| 159 } else { | 159 } else { |
| 160 PubPackageMapProvider pubPackageMapProvider = | 160 PubPackageMapProvider pubPackageMapProvider = |
| 161 new PubPackageMapProvider(PhysicalResourceProvider.INSTANCE, sdk); | 161 new PubPackageMapProvider(PhysicalResourceProvider.INSTANCE, sdk); |
| 162 PackageMapInfo packageMapInfo = pubPackageMapProvider.computePackageMap( | 162 PackageMapInfo packageMapInfo = pubPackageMapProvider.computePackageMap( |
| 163 PhysicalResourceProvider.INSTANCE.getResource('.')); | 163 PhysicalResourceProvider.INSTANCE.getResource('.')); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 180 } | 180 } |
| 181 // Uncomment the following to have errors reported on stdout and stderr | 181 // Uncomment the following to have errors reported on stdout and stderr |
| 182 AnalysisEngine.instance.logger = new StdLogger(options.log); | 182 AnalysisEngine.instance.logger = new StdLogger(options.log); |
| 183 | 183 |
| 184 // set options for context | 184 // set options for context |
| 185 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); | 185 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); |
| 186 contextOptions.cacheSize = _MAX_CACHE_SIZE; | 186 contextOptions.cacheSize = _MAX_CACHE_SIZE; |
| 187 contextOptions.hint = !options.disableHints; | 187 contextOptions.hint = !options.disableHints; |
| 188 contextOptions.analyzeFunctionBodiesPredicate = | 188 contextOptions.analyzeFunctionBodiesPredicate = |
| 189 _analyzeFunctionBodiesPredicate; | 189 _analyzeFunctionBodiesPredicate; |
| 190 contextOptions.generateImplicitErrors = options.showPackageWarnings; |
| 191 contextOptions.generateSdkErrors = options.showSdkWarnings; |
| 190 context.analysisOptions = contextOptions; | 192 context.analysisOptions = contextOptions; |
| 191 | 193 |
| 192 // Create and add a ChangeSet | 194 // Create and add a ChangeSet |
| 193 ChangeSet changeSet = new ChangeSet(); | 195 ChangeSet changeSet = new ChangeSet(); |
| 194 changeSet.addedSource(source); | 196 changeSet.addedSource(source); |
| 195 context.applyChanges(changeSet); | 197 context.applyChanges(changeSet); |
| 196 } | 198 } |
| 197 | 199 |
| 198 /// Fills [errorInfos] using [sources]. | 200 /// Fills [errorInfos] using [sources]. |
| 199 void prepareErrors() { | 201 void prepareErrors() { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 } | 460 } |
| 459 } | 461 } |
| 460 | 462 |
| 461 @override | 463 @override |
| 462 void logInformation2(String message, Object exception) { | 464 void logInformation2(String message, Object exception) { |
| 463 if (log) { | 465 if (log) { |
| 464 stdout.writeln(message); | 466 stdout.writeln(message); |
| 465 } | 467 } |
| 466 } | 468 } |
| 467 } | 469 } |
| OLD | NEW |