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

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

Issue 660203003: Add (an as yet unused) task (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/task_dart.dart
diff --git a/pkg/analyzer/lib/src/task/task_dart.dart b/pkg/analyzer/lib/src/task/task_dart.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8e123b3b8cfeb5701a6ca18c72a078117acd3096
--- /dev/null
+++ b/pkg/analyzer/lib/src/task/task_dart.dart
@@ -0,0 +1,86 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library engine.task.dart;
+
+import 'package:analyzer/src/generated/ast.dart';
+import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+/**
+ * A `BuildUnitElementTask` builds a compilation unit element for a single
+ * compilation unit.
+ */
+class BuildUnitElementTask extends AnalysisTask {
+ /**
+ * The source for which an element model will be built.
+ */
+ final Source source;
+
+ /**
+ * The source of the library in which an element model will be built.
+ */
+ final Source library;
+
+ /**
+ * The compilation unit from which an element model will be built.
+ */
+ final CompilationUnit unit;
+
+ /**
+ * The element model that was built.
+ */
+ CompilationUnitElement unitElement;
+
+ /**
+ * Initialize a newly created task to build a compilation unit element for
+ * the given [source] in the given [library] based on the compilation [unit]
+ * that was parsed.
+ */
+ BuildUnitElementTask(InternalAnalysisContext context, this.source, this.library, this.unit)
+ : super(context);
+
+ @override
+ accept(AnalysisTaskVisitor visitor) {
+ return visitor.visitBuildUnitElementTask(this);
+ }
+
+ /**
+ * Return the compilation unit from which the element model was built.
+ */
+ CompilationUnit getCompilationUnit() {
+ return unit;
+ }
+
+ /**
+ * Return the source that is to be parsed.
+ */
+ Source getSource() {
+ return source;
+ }
+
+ /**
+ * Return the compilation unit element that was produced, or `null` if the
+ * task has not yet been performed or if an exception occurred.
+ */
+ CompilationUnitElement getUnitElement() {
+ return unitElement;
+ }
+
+ @override
+ void internalPerform() {
+ CompilationUnitBuilder builder = new CompilationUnitBuilder();
+ unitElement = builder.buildCompilationUnit(source, unit);
+ }
+
+ @override
+ String get taskDescription {
+ if (source == null) {
+ return "build the unit element model for null source";
+ }
+ return "build the unit element model for " + source.fullName;
+ }
+}
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698