| 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_cli.src.driver; | 5 library analyzer_cli.src.driver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 if (options.lints != _previousOptions.lints) { | 225 if (options.lints != _previousOptions.lints) { |
| 226 return false; | 226 return false; |
| 227 } | 227 } |
| 228 if (options.strongMode != _previousOptions.strongMode) { | 228 if (options.strongMode != _previousOptions.strongMode) { |
| 229 return false; | 229 return false; |
| 230 } | 230 } |
| 231 if (options.enableSuperMixins != _previousOptions.enableSuperMixins) { | 231 if (options.enableSuperMixins != _previousOptions.enableSuperMixins) { |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| 234 if (options.disableNewTaskModel != _previousOptions.disableNewTaskModel) { | |
| 235 return false; | |
| 236 } | |
| 237 return true; | 234 return true; |
| 238 } | 235 } |
| 239 | 236 |
| 240 /// Decide on the appropriate policy for which files need to be fully parsed | 237 /// Decide on the appropriate policy for which files need to be fully parsed |
| 241 /// and which files need to be diet parsed, based on [options], and return an | 238 /// and which files need to be diet parsed, based on [options], and return an |
| 242 /// [AnalyzeFunctionBodiesPredicate] that implements this policy. | 239 /// [AnalyzeFunctionBodiesPredicate] that implements this policy. |
| 243 AnalyzeFunctionBodiesPredicate _chooseDietParsingPolicy( | 240 AnalyzeFunctionBodiesPredicate _chooseDietParsingPolicy( |
| 244 CommandLineOptions options) { | 241 CommandLineOptions options) { |
| 245 if (_isBatch) { | 242 if (_isBatch) { |
| 246 // As analyzer is currently implemented, once a file has been diet | 243 // As analyzer is currently implemented, once a file has been diet |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return new FileBasedSource(sourceFile, uri); | 378 return new FileBasedSource(sourceFile, uri); |
| 382 } | 379 } |
| 383 | 380 |
| 384 /// Create an analysis context that is prepared to analyze sources according | 381 /// Create an analysis context that is prepared to analyze sources according |
| 385 /// to the given [options], and store it in [_context]. | 382 /// to the given [options], and store it in [_context]. |
| 386 void _createAnalysisContext(CommandLineOptions options) { | 383 void _createAnalysisContext(CommandLineOptions options) { |
| 387 if (_canContextBeReused(options)) { | 384 if (_canContextBeReused(options)) { |
| 388 return; | 385 return; |
| 389 } | 386 } |
| 390 _previousOptions = options; | 387 _previousOptions = options; |
| 391 // Determine whether the new task model should be used. | |
| 392 AnalysisEngine.instance.useTaskModel = !options.disableNewTaskModel; | |
| 393 // Choose a package resolution policy and a diet parsing policy based on | 388 // Choose a package resolution policy and a diet parsing policy based on |
| 394 // the command-line options. | 389 // the command-line options. |
| 395 SourceFactory sourceFactory = _chooseUriResolutionPolicy(options); | 390 SourceFactory sourceFactory = _chooseUriResolutionPolicy(options); |
| 396 AnalyzeFunctionBodiesPredicate dietParsingPolicy = | 391 AnalyzeFunctionBodiesPredicate dietParsingPolicy = |
| 397 _chooseDietParsingPolicy(options); | 392 _chooseDietParsingPolicy(options); |
| 398 // Create a context using these policies. | 393 // Create a context using these policies. |
| 399 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); | 394 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
| 400 | 395 |
| 401 context.sourceFactory = sourceFactory; | 396 context.sourceFactory = sourceFactory; |
| 402 | 397 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 for (var package in packages) { | 632 for (var package in packages) { |
| 638 var packageName = path.basename(package.path); | 633 var packageName = path.basename(package.path); |
| 639 var realPath = package.resolveSymbolicLinksSync(); | 634 var realPath = package.resolveSymbolicLinksSync(); |
| 640 result[packageName] = [ | 635 result[packageName] = [ |
| 641 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 636 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
| 642 ]; | 637 ]; |
| 643 } | 638 } |
| 644 return result; | 639 return result; |
| 645 } | 640 } |
| 646 } | 641 } |
| OLD | NEW |