Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: pkg/analyzer/benchmark/errors_in_all_libraries.dart

Issue 1847633002: Fix more strong mode errors in analyzer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix copied comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /// Resolves this library and everything it transitively imports and generates 6 /// Resolves this library and everything it transitively imports and generates
7 /// errors in all of those libraries. Does this in an infinite loop, starting 7 /// errors in all of those libraries. Does this in an infinite loop, starting
8 /// from scratch each time, to show how VM warm-up affects things and to make 8 /// from scratch each time, to show how VM warm-up affects things and to make
9 /// it easier to connect to this with observatory. 9 /// it easier to connect to this with observatory.
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 22 matching lines...) Expand all
33 var start = new DateTime.now(); 33 var start = new DateTime.now();
34 AnalysisEngine.instance.clearCaches(); 34 AnalysisEngine.instance.clearCaches();
35 35
36 var context = AnalysisEngine.instance.createAnalysisContext(); 36 var context = AnalysisEngine.instance.createAnalysisContext();
37 context.sourceFactory = new SourceFactory([ 37 context.sourceFactory = new SourceFactory([
38 new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), 38 new DartUriResolver(DirectoryBasedDartSdk.defaultSdk),
39 new FileUriResolver(), 39 new FileUriResolver(),
40 new PackageUriResolver([new JavaFile(packageRoot)]) 40 new PackageUriResolver([new JavaFile(packageRoot)])
41 ]); 41 ]);
42 42
43 context.analysisOptions.strongMode = true; 43 AnalysisOptionsImpl options = context.analysisOptions;
44 context.analysisOptions.strongModeHints = true; 44 options.strongMode = true;
45 options.strongModeHints = true;
45 46
46 var mainSource = 47 var mainSource =
47 new FileBasedSource(new JavaFile(p.fromUri(Platform.script))); 48 new FileBasedSource(new JavaFile(p.fromUri(Platform.script)));
48 context.applyChanges(new ChangeSet()..addedSource(mainSource)); 49 context.applyChanges(new ChangeSet()..addedSource(mainSource));
49 50
50 var initialLibrary = 51 var initialLibrary =
51 context.resolveCompilationUnit2(mainSource, mainSource); 52 context.resolveCompilationUnit2(mainSource, mainSource);
52 53
53 // Walk all of the transitively referenced libraries and compute errors. 54 // Walk all of the transitively referenced libraries and compute errors.
54 var errorCount = 0; 55 var errorCount = 0;
(...skipping 24 matching lines...) Expand all
79 void find(LibraryElement lib) { 80 void find(LibraryElement lib) {
80 if (seen.contains(lib)) return; 81 if (seen.contains(lib)) return;
81 seen.add(lib); 82 seen.add(lib);
82 results.add(lib); 83 results.add(lib);
83 lib.importedLibraries.forEach(find); 84 lib.importedLibraries.forEach(find);
84 lib.exportedLibraries.forEach(find); 85 lib.exportedLibraries.forEach(find);
85 } 86 }
86 find(start); 87 find(start);
87 return results; 88 return results;
88 } 89 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/file_system/memory_file_system.dart » ('j') | pkg/analyzer/test/generated/parser_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698