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

Side by Side Diff: pkg/analyzer_experimental/lib/src/analyzer_impl.dart

Issue 24669002: Support for --no-hints in analyzer_experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix hint check; print hints in Dart verison. Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_impl; 5 library analyzer_impl;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'generated/java_io.dart'; 9 import 'generated/java_io.dart';
10 import 'generated/engine.dart'; 10 import 'generated/engine.dart';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } else { 79 } else {
80 packageDirectory = getPackageDirectoryFor(sourceFile); 80 packageDirectory = getPackageDirectoryFor(sourceFile);
81 } 81 }
82 if (packageDirectory != null) { 82 if (packageDirectory != null) {
83 resolvers.add(new PackageUriResolver([packageDirectory])); 83 resolvers.add(new PackageUriResolver([packageDirectory]));
84 } 84 }
85 } 85 }
86 sourceFactory = new SourceFactory.con1(contentCache, resolvers); 86 sourceFactory = new SourceFactory.con1(contentCache, resolvers);
87 context = AnalysisEngine.instance.createAnalysisContext(); 87 context = AnalysisEngine.instance.createAnalysisContext();
88 context.sourceFactory = sourceFactory; 88 context.sourceFactory = sourceFactory;
89
90 // set options for context
91 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
92 contextOptions.hint = !options.disableHints;
93 context.analysisOptions = contextOptions;
89 } 94 }
90 95
91 /// Fills [sources]. 96 /// Fills [sources].
92 void prepareSources(LibraryElement library) { 97 void prepareSources(LibraryElement library) {
93 var units = new Set<CompilationUnitElement>(); 98 var units = new Set<CompilationUnitElement>();
94 var libraries = new Set<LibraryElement>(); 99 var libraries = new Set<LibraryElement>();
95 addLibrarySources(library, libraries, units); 100 addLibrarySources(library, libraries, units);
96 } 101 }
97 102
98 void addCompilationUnitSource(CompilationUnitElement unit, Set<LibraryElement> libraries, 103 void addCompilationUnitSource(CompilationUnitElement unit, Set<LibraryElement> libraries,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 addLibrarySources(child, libraries, units); 137 addLibrarySources(child, libraries, units);
133 } 138 }
134 for (LibraryElement child in library.exportedLibraries) { 139 for (LibraryElement child in library.exportedLibraries) {
135 addLibrarySources(child, libraries, units); 140 addLibrarySources(child, libraries, units);
136 } 141 }
137 } 142 }
138 143
139 /// Fills [errorInfos]. 144 /// Fills [errorInfos].
140 void prepareErrors() { 145 void prepareErrors() {
141 for (Source source in sources) { 146 for (Source source in sources) {
147 context.computeErrors(source);
142 var sourceErrors = context.getErrors(source); 148 var sourceErrors = context.getErrors(source);
143 errorInfos.add(sourceErrors); 149 errorInfos.add(sourceErrors);
144 } 150 }
145 } 151 }
146 152
147 static JavaFile getPackageDirectoryFor(JavaFile sourceFile) { 153 static JavaFile getPackageDirectoryFor(JavaFile sourceFile) {
148 // we are going to ask parent file, so get absolute path 154 // we are going to ask parent file, so get absolute path
149 sourceFile = sourceFile.getAbsoluteFile(); 155 sourceFile = sourceFile.getAbsoluteFile();
150 // look in the containing directories 156 // look in the containing directories
151 JavaFile dir = sourceFile.getParentFile(); 157 JavaFile dir = sourceFile.getParentFile();
152 while (dir != null) { 158 while (dir != null) {
153 JavaFile packagesDir = new JavaFile.relative(dir, "packages"); 159 JavaFile packagesDir = new JavaFile.relative(dir, "packages");
154 if (packagesDir.exists()) { 160 if (packagesDir.exists()) {
155 return packagesDir; 161 return packagesDir;
156 } 162 }
157 dir = dir.getParentFile(); 163 dir = dir.getParentFile();
158 } 164 }
159 // not found 165 // not found
160 return null; 166 return null;
161 } 167 }
162 } 168 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/options.dart ('k') | pkg/analyzer_experimental/lib/src/error_formatter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698