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

Unified Diff: pkg/analysis_server/test/integration/support/integration_test_methods.dart

Issue 2972473002: Run the generator after updates to spec (Closed)
Patch Set: Created 3 years, 6 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: pkg/analysis_server/test/integration/support/integration_test_methods.dart
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index be714c71e016febca0bd70b9317ec7c615fc75dd..409e4e19f63819a4475cba82b06152f013562021 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -235,37 +235,51 @@ abstract class IntegrationTestMixin {
}
/**
- * Return the transitive closure of reachable sources for a given file.
+ * Return a description of all of the elements referenced in a given region
+ * of a given file that come from imported libraries.
*
- * If a request is made for a file which does not exist, or which is not
+ * If a request is made for a file that does not exist, or that is not
* currently subject to analysis (e.g. because it is not associated with any
- * analysis root specified to analysis.setAnalysisRoots), an error of type
- * GET_REACHABLE_SOURCES_INVALID_FILE will be generated.
+ * analysis root specified via analysis.setAnalysisRoots), an error of type
+ * GET_IMPORTED_ELEMENTS_INVALID_FILE will be generated.
*
* Parameters
*
* file: FilePath
*
- * The file for which reachable source information is being requested.
+ * The file in which import information is being requested.
+ *
+ * offset: int
+ *
+ * The offset of the region for which import information is being
+ * requested.
+ *
+ * length: int
+ *
+ * The length of the region for which import information is being
+ * requested.
*
* Returns
*
- * sources: Map<String, List<String>>
+ * elements: List<ImportedElements>
*
- * A mapping from source URIs to directly reachable source URIs. For
- * example, a file "foo.dart" that imports "bar.dart" would have the
- * corresponding mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If
- * "bar.dart" has further imports (or exports) there will be a mapping from
- * the URI "file:///bar.dart" to them. To check if a specific URI is
- * reachable from a given file, clients can check for its presence in the
- * resulting key set.
+ * The information about the elements that are referenced in the specified
+ * region of the specified file that come from imported libraries.
+ *
+ * complete: bool
+ *
+ * True if all of the elements that are referenced in the specified region
+ * are included in the list of elements. The list of elements will be
+ * incomplete if there is an error in the specified region that prevents an
+ * identifier from being resolved to a single element.
*/
- Future<AnalysisGetReachableSourcesResult> sendAnalysisGetReachableSources(
- String file) async {
- var params = new AnalysisGetReachableSourcesParams(file).toJson();
- var result = await server.send("analysis.getReachableSources", params);
+ Future<AnalysisGetImportedElementsResult> sendAnalysisGetImportedElements(
+ String file, int offset, int length) async {
+ var params =
+ new AnalysisGetImportedElementsParams(file, offset, length).toJson();
+ var result = await server.send("analysis.getImportedElements", params);
ResponseDecoder decoder = new ResponseDecoder(null);
- return new AnalysisGetReachableSourcesResult.fromJson(
+ return new AnalysisGetImportedElementsResult.fromJson(
decoder, 'result', result);
}
@@ -360,6 +374,41 @@ abstract class IntegrationTestMixin {
}
/**
+ * Return the transitive closure of reachable sources for a given file.
+ *
+ * If a request is made for a file which does not exist, or which is not
+ * currently subject to analysis (e.g. because it is not associated with any
+ * analysis root specified to analysis.setAnalysisRoots), an error of type
+ * GET_REACHABLE_SOURCES_INVALID_FILE will be generated.
+ *
+ * Parameters
+ *
+ * file: FilePath
+ *
+ * The file for which reachable source information is being requested.
+ *
+ * Returns
+ *
+ * sources: Map<String, List<String>>
+ *
+ * A mapping from source URIs to directly reachable source URIs. For
+ * example, a file "foo.dart" that imports "bar.dart" would have the
+ * corresponding mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If
+ * "bar.dart" has further imports (or exports) there will be a mapping from
+ * the URI "file:///bar.dart" to them. To check if a specific URI is
+ * reachable from a given file, clients can check for its presence in the
+ * resulting key set.
+ */
+ Future<AnalysisGetReachableSourcesResult> sendAnalysisGetReachableSources(
+ String file) async {
+ var params = new AnalysisGetReachableSourcesParams(file).toJson();
+ var result = await server.send("analysis.getReachableSources", params);
+ ResponseDecoder decoder = new ResponseDecoder(null);
+ return new AnalysisGetReachableSourcesResult.fromJson(
+ decoder, 'result', result);
+ }
+
+ /**
* Force the re-analysis of everything contained in the specified analysis
* roots. This will cause all previously computed analysis results to be
* discarded and recomputed, and will cause all subscribed notifications to
@@ -1572,6 +1621,44 @@ abstract class IntegrationTestMixin {
}
/**
+ * Return a list of edits that would need to be applied in order to ensure
+ * that all of the elements in the specified list of imported elements are
+ * accessible within the library.
+ *
+ * Parameters
+ *
+ * file: FilePath
+ *
+ * The file in which the specified elements are to be made accessible.
+ *
+ * elements: List<ImportedElements>
+ *
+ * The elements to be made accessible in the specified file.
+ *
+ * Returns
+ *
+ * edits: List<SourceEdit>
+ *
+ * The edit(s) to be applied in order to make the specified elements
+ * accessible.
+ *
+ * complete: bool
+ *
+ * True if all of the elements that are to be made accessible would be
+ * accessible if the edits were applied. The edits will not be complete,
+ * for example, if one of the libraries cannot be referenced in the target
+ * library or if one of the element names is already imported from a
+ * different library.
+ */
+ Future<EditImportElementsResult> sendEditImportElements(
+ String file, List<ImportedElements> elements) async {
+ var params = new EditImportElementsParams(file, elements).toJson();
+ var result = await server.send("edit.importElements", params);
+ ResponseDecoder decoder = new ResponseDecoder(null);
+ return new EditImportElementsResult.fromJson(decoder, 'result', result);
+ }
+
+ /**
* Sort all of the directives, unit and class members of the given Dart file.
*
* If a request is made for a file that does not exist, does not belong to an

Powered by Google App Engine
This is Rietveld 408576698