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

Unified Diff: editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | pkg/analyzer/lib/src/analyzer_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java
diff --git a/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java b/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java
index 620937bf42a536bca534679f4420d3b79798f1a8..340d9ea9fa3102a7e89bdbc75e9109e23c8a7dde 100644
--- a/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java
+++ b/editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerImpl.java
@@ -14,6 +14,10 @@
package com.google.dart.command.analyze;
import com.google.dart.engine.AnalysisEngine;
+import com.google.dart.engine.ast.CompilationUnit;
+import com.google.dart.engine.ast.Directive;
+import com.google.dart.engine.ast.LibraryDirective;
+import com.google.dart.engine.ast.PartOfDirective;
import com.google.dart.engine.context.AnalysisContext;
import com.google.dart.engine.context.AnalysisException;
import com.google.dart.engine.element.CompilationUnitElement;
@@ -134,10 +138,24 @@ class AnalyzerImpl {
context.setSourceFactory(sourceFactory);
context.setAnalysisOptions(contextOptions);
- // analyze the given file
+ // prepare Source
sourceFile = sourceFile.getAbsoluteFile();
UriKind uriKind = getUriKind(sourceFile);
Source librarySource = new FileBasedSource(sourceFactory.getContentCache(), sourceFile, uriKind);
+
+ // don't try to analyzer parts
+ CompilationUnit unit = context.parseCompilationUnit(librarySource);
+ boolean hasLibraryDirective = false;
+ boolean hasPartOfDirective = false;
+ for (Directive directive : unit.getDirectives()) {
+ hasLibraryDirective |= directive instanceof LibraryDirective;
+ hasPartOfDirective |= directive instanceof PartOfDirective;
+ }
+ if (hasPartOfDirective && !hasLibraryDirective) {
+ return ErrorSeverity.NONE;
Brian Wilkerson 2013/11/01 23:02:20 If I understand correctly, this will silently igno
+ }
+
+ // analyze Source
LibraryElement library = context.computeLibraryElement(librarySource);
context.resolveCompilationUnit(librarySource, library);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | pkg/analyzer/lib/src/analyzer_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698