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

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 1507083002: Issue 24988. Parse source for sorting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/analysis_server/test/edit/sort_members_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 18651466477f61ee763508069ea86ee63fd312eb..93ad959770c60e8e4cf3ea6d617895466242695d 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -250,15 +250,20 @@ class EditDomainHandler implements RequestHandler {
if (!engine.AnalysisEngine.isDartFileName(file)) {
return new Response.sortMembersInvalidFile(request);
}
- // prepare resolved units
- List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
- if (units.isEmpty) {
+ // prepare location
+ ContextSourcePair contextSource = server.getContextSourcePair(file);
+ engine.AnalysisContext context = contextSource.context;
+ Source source = contextSource.source;
+ if (context == null || source == null) {
+ return new Response.sortMembersInvalidFile(request);
+ }
+ // prepare parsed unit
+ CompilationUnit unit;
+ try {
+ unit = context.parseCompilationUnit(source);
+ } catch (e) {
return new Response.sortMembersInvalidFile(request);
}
- // prepare context
- CompilationUnit unit = units.first;
- engine.AnalysisContext context = unit.element.context;
- Source source = unit.element.source;
// check if there are scan/parse errors in the file
engine.AnalysisErrorInfo errors = context.getErrors(source);
int numScanParseErrors = _getNumberOfScanParseErrors(errors.errors);
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/sort_members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698