AS strong-mode .analysis_options awareness.

R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1403983002 .
This commit is contained in:
pq 2015-10-13 13:22:49 -07:00
parent 80522629b3
commit e5f3bb163b
2 changed files with 32 additions and 3 deletions

View file

@ -484,6 +484,16 @@ class ContextManagerImpl implements ContextManager {
return;
}
// Set strong mode.
var strongMode = analyzer['strong-mode'];
if (strongMode == true) {
AnalysisContext context = info.context;
AnalysisOptionsImpl options =
new AnalysisOptionsImpl.from(context.analysisOptions);
options.strongMode = true;
context.analysisOptions = options;
}
// Set ignore patterns.
YamlList exclude = analyzer['exclude'];
if (exclude != null) {

View file

@ -369,9 +369,6 @@ analyzer:
expect(contexts[1].name, equals('/my/proj/lib'));
}
// TODO(paulberry): This test only tests PackagesFileDisposition.
// Once http://dartbug.com/23909 is fixed, add a test for sdk extensions
// and PackageMapDisposition.
test_refresh_folder_with_packagespec() {
// create a context with a .packages file
String packagespecFile = posix.join(projPath, '.packages');
@ -388,6 +385,9 @@ analyzer:
});
}
// TODO(paulberry): This test only tests PackagesFileDisposition.
// Once http://dartbug.com/23909 is fixed, add a test for sdk extensions
// and PackageMapDisposition.
test_refresh_folder_with_packagespec_subfolders() {
// Create a folder with no .packages file, containing two subfolders with
// .packages files.
@ -1107,6 +1107,25 @@ test_pack:lib/
callbacks.assertContextFiles(project, [fileA]);
}
test_strong_mode_analysis_option() async {
// Create files.
newFile(
[projPath, '.analysis_options'],
r'''
analyzer:
strong-mode: true
''');
String libPath = newFolder([projPath, LIB_NAME]);
newFile([libPath, 'main.dart']);
// Setup context.
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// Verify that analysis options was parsed and strong-mode set.
Map<String, int> fileTimestamps =
callbacks.currentContextFilePaths[projPath];
expect(fileTimestamps, isNotEmpty);
expect(callbacks.currentContext.analysisOptions.strongMode, true);
}
test_watch_addDummyLink() {
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// empty folder initially