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

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

Issue 54903009: Issue 14685. Don't analyzer parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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';
11 import 'generated/error.dart'; 11 import 'generated/error.dart';
12 import 'generated/source_io.dart'; 12 import 'generated/source_io.dart';
13 import 'generated/sdk.dart'; 13 import 'generated/sdk.dart';
14 import 'generated/sdk_io.dart'; 14 import 'generated/sdk_io.dart';
15 import 'generated/ast.dart';
15 import 'generated/element.dart'; 16 import 'generated/element.dart';
16 import '../options.dart'; 17 import '../options.dart';
17 18
18 19
19 DartSdk sdk; 20 DartSdk sdk;
20 21
21 /// Analyzes single library [File]. 22 /// Analyzes single library [File].
22 class AnalyzerImpl { 23 class AnalyzerImpl {
23 final CommandLineOptions options; 24 final CommandLineOptions options;
24 25
(...skipping 18 matching lines...) Expand all
43 */ 44 */
44 void analyze(String sourcePath) { 45 void analyze(String sourcePath) {
45 sources.clear(); 46 sources.clear();
46 errorInfos.clear(); 47 errorInfos.clear();
47 if (sourcePath == null) { 48 if (sourcePath == null) {
48 throw new ArgumentError("sourcePath cannot be null"); 49 throw new ArgumentError("sourcePath cannot be null");
49 } 50 }
50 var sourceFile = new JavaFile(sourcePath); 51 var sourceFile = new JavaFile(sourcePath);
51 var uriKind = getUriKind(sourceFile); 52 var uriKind = getUriKind(sourceFile);
52 var librarySource = new FileBasedSource.con2(contentCache, sourceFile, uriKi nd); 53 var librarySource = new FileBasedSource.con2(contentCache, sourceFile, uriKi nd);
54 // prepare context
55 prepareAnalysisContext(sourceFile);
56 // don't try to analyzer parts
57 var unit = context.parseCompilationUnit(librarySource);
58 var hasLibraryDirective = false;
59 var hasPartOfDirective = false;
60 for (var directive in unit.directives) {
61 if (directive is LibraryDirective) hasLibraryDirective = true;
62 if (directive is PartOfDirective) hasPartOfDirective = true;
63 }
64 if (hasPartOfDirective && !hasLibraryDirective) return;
Brian Wilkerson 2013/11/01 23:02:20 Ditto.
53 // resolve library 65 // resolve library
54 prepareAnalysisContext(sourceFile);
55 var libraryElement = context.computeLibraryElement(librarySource); 66 var libraryElement = context.computeLibraryElement(librarySource);
56 // prepare source and errors 67 // prepare source and errors
57 prepareSources(libraryElement); 68 prepareSources(libraryElement);
58 prepareErrors(); 69 prepareErrors();
59 } 70 }
60 71
61 /// Returns the maximal [ErrorSeverity] of the recorded errors. 72 /// Returns the maximal [ErrorSeverity] of the recorded errors.
62 ErrorSeverity get maxErrorSeverity { 73 ErrorSeverity get maxErrorSeverity {
63 var status = ErrorSeverity.NONE; 74 var status = ErrorSeverity.NONE;
64 for (AnalysisErrorInfo errorInfo in errorInfos) { 75 for (AnalysisErrorInfo errorInfo in errorInfos) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 DirectoryBasedDartSdk directoryBasedSdk = sdk; 190 DirectoryBasedDartSdk directoryBasedSdk = sdk;
180 String sdkLibPath = directoryBasedSdk.libraryDirectory.getPath() + JavaFil e.separator; 191 String sdkLibPath = directoryBasedSdk.libraryDirectory.getPath() + JavaFil e.separator;
181 if (file.getPath().startsWith(sdkLibPath)) { 192 if (file.getPath().startsWith(sdkLibPath)) {
182 return UriKind.DART_URI; 193 return UriKind.DART_URI;
183 } 194 }
184 } 195 }
185 // some generic file 196 // some generic file
186 return UriKind.FILE_URI; 197 return UriKind.FILE_URI;
187 } 198 }
188 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698