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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2473003003: Implement 'Sort Members' for the new analysis driver. (Closed)
Patch Set: Created 4 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 | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/file_state.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index f341b9decf72a0db7541d0373200a74c0558c811..5d11c9f6215d40a693de381ffd63125283b0dc54 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -140,6 +140,25 @@ class FileState {
UnlinkedUnit get unlinked => _unlinked;
/**
+ * Return a new parsed unresolved [CompilationUnit].
+ */
+ CompilationUnit parse(AnalysisErrorListener errorListener) {
+ AnalysisOptions analysisOptions = _fsState._analysisOptions;
+
+ CharSequenceReader reader = new CharSequenceReader(content);
+ Scanner scanner = new Scanner(source, reader, errorListener);
+ scanner.scanGenericMethodComments = analysisOptions.strongMode;
+ Token token = scanner.tokenize();
+ LineInfo lineInfo = new LineInfo(scanner.lineStarts);
+
+ Parser parser = new Parser(source, errorListener);
+ parser.parseGenericMethodComments = analysisOptions.strongMode;
+ CompilationUnit unit = parser.parseCompilationUnit(token);
+ unit.lineInfo = lineInfo;
+ return unit;
+ }
+
+ /**
* Read the file content and ensure that all of the file properties are
* consistent with the read content, including API signature.
*
@@ -182,8 +201,7 @@ class FileState {
{
bytes = _fsState._byteStore.get(unlinkedKey);
if (bytes == null) {
- CompilationUnit unit =
- _parse(source, _content, _fsState._analysisOptions);
+ CompilationUnit unit = parse(AnalysisErrorListener.NULL_LISTENER);
_fsState._logger.run('Create unlinked for $path', () {
UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit);
bytes = unlinkedUnit.toBuffer();
@@ -278,26 +296,6 @@ class FileState {
static bool _isDartUri(String uri) {
return uri.startsWith('dart:');
}
-
- /**
- * Return the parsed unresolved [CompilationUnit] for the given [content].
- */
- static CompilationUnit _parse(
- Source source, String content, AnalysisOptions analysisOptions) {
- AnalysisErrorListener errorListener = AnalysisErrorListener.NULL_LISTENER;
-
- CharSequenceReader reader = new CharSequenceReader(content);
- Scanner scanner = new Scanner(source, reader, errorListener);
- scanner.scanGenericMethodComments = analysisOptions.strongMode;
- Token token = scanner.tokenize();
- LineInfo lineInfo = new LineInfo(scanner.lineStarts);
-
- Parser parser = new Parser(source, errorListener);
- parser.parseGenericMethodComments = analysisOptions.strongMode;
- CompilationUnit unit = parser.parseCompilationUnit(token);
- unit.lineInfo = lineInfo;
- return unit;
- }
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698