| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.test.generated.resolver_test_case; | 5 library analyzer.test.generated.resolver_test_case; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 bool enableUnusedElement = false; | 328 bool enableUnusedElement = false; |
| 329 | 329 |
| 330 /** | 330 /** |
| 331 * Specifies if [assertErrors] should check for [HintCode.UNUSED_LOCAL_VARIABL
E]. | 331 * Specifies if [assertErrors] should check for [HintCode.UNUSED_LOCAL_VARIABL
E]. |
| 332 */ | 332 */ |
| 333 bool enableUnusedLocalVariable = false; | 333 bool enableUnusedLocalVariable = false; |
| 334 | 334 |
| 335 final Map<Source, TestAnalysisResult> analysisResults = {}; | 335 final Map<Source, TestAnalysisResult> analysisResults = {}; |
| 336 | 336 |
| 337 StringBuffer _logBuffer = new StringBuffer(); | 337 StringBuffer _logBuffer = new StringBuffer(); |
| 338 FileContentOverlay _fileContentOverlay = new FileContentOverlay(); | 338 FileContentOverlay fileContentOverlay = new FileContentOverlay(); |
| 339 AnalysisDriver driver; | 339 AnalysisDriver driver; |
| 340 | 340 |
| 341 AnalysisContext get analysisContext => analysisContext2; | 341 AnalysisContext get analysisContext => analysisContext2; |
| 342 | 342 |
| 343 bool get enableNewAnalysisDriver => false; | 343 bool get enableNewAnalysisDriver => false; |
| 344 | 344 |
| 345 /** | 345 /** |
| 346 * Return a type provider that can be used to test the results of resolution. | 346 * Return a type provider that can be used to test the results of resolution. |
| 347 * | 347 * |
| 348 * @return a type provider | 348 * @return a type provider |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 File file = resourceProvider.newFile(path, content); | 680 File file = resourceProvider.newFile(path, content); |
| 681 packageMap[name] = <Folder>[file.parent]; | 681 packageMap[name] = <Folder>[file.parent]; |
| 682 }); | 682 }); |
| 683 resolvers.add(new PackageMapUriResolver(resourceProvider, packageMap)); | 683 resolvers.add(new PackageMapUriResolver(resourceProvider, packageMap)); |
| 684 } | 684 } |
| 685 SourceFactory sourceFactory = new SourceFactory(resolvers); | 685 SourceFactory sourceFactory = new SourceFactory(resolvers); |
| 686 | 686 |
| 687 PerformanceLog log = new PerformanceLog(_logBuffer); | 687 PerformanceLog log = new PerformanceLog(_logBuffer); |
| 688 AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log); | 688 AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log); |
| 689 driver = new AnalysisDriver(scheduler, log, resourceProvider, | 689 driver = new AnalysisDriver(scheduler, log, resourceProvider, |
| 690 new MemoryByteStore(), _fileContentOverlay, sourceFactory, options); | 690 new MemoryByteStore(), fileContentOverlay, sourceFactory, options); |
| 691 scheduler.start(); | 691 scheduler.start(); |
| 692 } else { | 692 } else { |
| 693 if (packages != null) { | 693 if (packages != null) { |
| 694 var packageMap = <String, String>{}; | 694 var packageMap = <String, String>{}; |
| 695 packages.forEach((args) { | 695 packages.forEach((args) { |
| 696 String name = args[0]; | 696 String name = args[0]; |
| 697 String content = args[1]; | 697 String content = args[1]; |
| 698 packageMap['package:$name/$name.dart'] = content; | 698 packageMap['package:$name/$name.dart'] = content; |
| 699 }); | 699 }); |
| 700 analysisContext2 = AnalysisContextFactory.contextWithCoreAndPackages( | 700 analysisContext2 = AnalysisContextFactory.contextWithCoreAndPackages( |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 } | 929 } |
| 930 | 930 |
| 931 class TestAnalysisResult { | 931 class TestAnalysisResult { |
| 932 final Source source; | 932 final Source source; |
| 933 final CompilationUnit unit; | 933 final CompilationUnit unit; |
| 934 final List<AnalysisError> errors; | 934 final List<AnalysisError> errors; |
| 935 TestAnalysisResult(this.source, this.unit, this.errors); | 935 TestAnalysisResult(this.source, this.unit, this.errors); |
| 936 } | 936 } |
| OLD | NEW |