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 21 matching lines...) Expand all Loading... |
32 import 'package:linter/src/plugin/linter_plugin.dart'; | 32 import 'package:linter/src/plugin/linter_plugin.dart'; |
33 import 'package:package_config/discovery.dart' as pkgDiscovery; | 33 import 'package:package_config/discovery.dart' as pkgDiscovery; |
34 import 'package:package_config/packages.dart' show Packages; | 34 import 'package:package_config/packages.dart' show Packages; |
35 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 35 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
36 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 36 import 'package:package_config/src/packages_impl.dart' show MapPackages; |
37 import 'package:path/path.dart' as path; | 37 import 'package:path/path.dart' as path; |
38 import 'package:plugin/manager.dart'; | 38 import 'package:plugin/manager.dart'; |
39 import 'package:plugin/plugin.dart'; | 39 import 'package:plugin/plugin.dart'; |
40 import 'package:yaml/yaml.dart'; | 40 import 'package:yaml/yaml.dart'; |
41 | 41 |
42 /// The maximum number of sources for which AST structures should be kept in the | |
43 /// cache. | |
44 const int _maxCacheSize = 512; | |
45 | |
46 /// Shared IO sink for standard error reporting. | 42 /// Shared IO sink for standard error reporting. |
47 /// | 43 /// |
48 /// *Visible for testing.* | 44 /// *Visible for testing.* |
49 StringSink errorSink = stderr; | 45 StringSink errorSink = stderr; |
50 | 46 |
51 /// Shared IO sink for standard out reporting. | 47 /// Shared IO sink for standard out reporting. |
52 /// | 48 /// |
53 /// *Visible for testing.* | 49 /// *Visible for testing.* |
54 StringSink outSink = stdout; | 50 StringSink outSink = stdout; |
55 | 51 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 declaredVariables.define(variableName, value); | 399 declaredVariables.define(variableName, value); |
404 }); | 400 }); |
405 } | 401 } |
406 | 402 |
407 if (options.log) { | 403 if (options.log) { |
408 AnalysisEngine.instance.logger = new StdLogger(); | 404 AnalysisEngine.instance.logger = new StdLogger(); |
409 } | 405 } |
410 | 406 |
411 // Set context options. | 407 // Set context options. |
412 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); | 408 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); |
413 contextOptions.cacheSize = _maxCacheSize; | |
414 contextOptions.hint = !options.disableHints; | 409 contextOptions.hint = !options.disableHints; |
415 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks; | 410 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks; |
416 contextOptions.enableSuperMixins = options.enableSuperMixins; | 411 contextOptions.enableSuperMixins = options.enableSuperMixins; |
417 contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy; | 412 contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy; |
418 contextOptions.generateImplicitErrors = options.showPackageWarnings; | 413 contextOptions.generateImplicitErrors = options.showPackageWarnings; |
419 contextOptions.generateSdkErrors = options.showSdkWarnings; | 414 contextOptions.generateSdkErrors = options.showSdkWarnings; |
420 contextOptions.lint = options.lints; | 415 contextOptions.lint = options.lints; |
421 contextOptions.strongMode = options.strongMode; | 416 contextOptions.strongMode = options.strongMode; |
422 context.analysisOptions = contextOptions; | 417 context.analysisOptions = contextOptions; |
423 _context = context; | 418 _context = context; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 for (var package in packages) { | 630 for (var package in packages) { |
636 var packageName = path.basename(package.path); | 631 var packageName = path.basename(package.path); |
637 var realPath = package.resolveSymbolicLinksSync(); | 632 var realPath = package.resolveSymbolicLinksSync(); |
638 result[packageName] = [ | 633 result[packageName] = [ |
639 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 634 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
640 ]; | 635 ]; |
641 } | 636 } |
642 return result; | 637 return result; |
643 } | 638 } |
644 } | 639 } |
OLD | NEW |