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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java

Issue 10174004: Update AnalysisServer to preserve DartC import prefixes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java (revision 6826)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/AnalysisUtility.java (working copy)
@@ -27,6 +27,9 @@
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.parser.DartParser;
+import com.google.dart.compiler.parser.DartPrefixParser;
+import com.google.dart.compiler.parser.DartScannerParserContext;
+import com.google.dart.compiler.parser.ParserContext;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.internal.builder.CachingArtifactProvider;
import com.google.dart.tools.core.internal.model.SystemLibraryManagerProvider;
@@ -39,6 +42,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
/**
* Static utility methods
@@ -61,10 +65,13 @@
};
/**
- * Parse a single file and report the errors/warnings
+ * Parse a single file and report the errors/warnings.
+ *
+ * @param prefixes the collection of import prefixes. If the file being parsed contains import
+ * directives, then this collection will be updated to include any specified prefixes
*/
static DartUnit parse(AnalysisServer server, File libraryFile, LibrarySource librarySource,
- File sourceFile) {
+ File sourceFile, Set<String> prefixes) {
ErrorListener errorListener = new ErrorListener(server);
DartSource source = new UrlDartSource(sourceFile, librarySource);
@@ -78,7 +85,8 @@
DartUnit dartUnit = null;
if (sourceCode != null) {
try {
- DartParser parser = new DartParser(source, sourceCode, errorListener);
+ ParserContext parserCtx = new DartScannerParserContext(source, sourceCode, errorListener);
+ DartParser parser = new DartPrefixParser(parserCtx, false, prefixes);
dartUnit = parser.parseUnit(source);
} catch (Throwable e) {
DartCore.logError("Exception while parsing " + sourceFile.getPath(), e);

Powered by Google App Engine
This is Rietveld 408576698