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

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 998053002: Task: Build Public Namespace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/dart.dart » ('j') | pkg/analyzer/test/src/task/dart_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/dart.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index dab9a8947a54a05564a3f7722efe0518f61cfb30..6ebc427d07b787454abedde4052c89d4c79f0cf7 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -340,6 +340,61 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
}
/**
+ * A task that builds [PUBLIC_NAMESPACE] for a library.
+ */
+class BuildPublicNamespaceTask extends SourceBasedAnalysisTask {
+ /**
+ * The name of the [BUILT_LIBRARY_ELEMENT] input.
+ */
+ static const String BUILT_LIBRARY_ELEMENT_INPUT_NAME = "builtLibraryElement";
+
+ /**
+ * The task descriptor describing this kind of task.
+ */
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
+ 'BUILD_PUBLIC_NAMESPACE', createTask, buildInputs, <ResultDescriptor>[
+ PUBLIC_NAMESPACE
+ ]);
+
+ BuildPublicNamespaceTask(
+ InternalAnalysisContext context, AnalysisTarget target)
+ : super(context, target);
+
+ @override
+ TaskDescriptor get descriptor => DESCRIPTOR;
+
+ @override
+ void internalPerform() {
+ LibraryElement library = getRequiredInput(BUILT_LIBRARY_ELEMENT_INPUT_NAME);
+
+ NamespaceBuilder builder = new NamespaceBuilder();
+ Namespace namespace = builder.createPublicNamespaceForLibrary(library);
+
+ outputs[PUBLIC_NAMESPACE] = namespace;
+ }
+
+ /**
+ * Return a map from the names of the inputs of this kind of task to the task
+ * input descriptors describing those inputs for a task with the
+ * given [target].
+ */
+ static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
+ return <String, TaskInput>{
+ BUILT_LIBRARY_ELEMENT_INPUT_NAME: BUILT_LIBRARY_ELEMENT.inputFor(target)
+ };
+ }
+
+ /**
+ * Create a [BuildPublicNamespaceTask] based on the given [target] in
+ * the given [context].
+ */
+ static BuildPublicNamespaceTask createTask(
+ AnalysisContext context, AnalysisTarget target) {
+ return new BuildPublicNamespaceTask(context, target);
+ }
+}
+
+/**
* A task that parses the content of a Dart file, producing an AST structure.
*/
class ParseDartTask extends SourceBasedAnalysisTask {
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/dart.dart » ('j') | pkg/analyzer/test/src/task/dart_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698