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

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

Issue 1082913007: Move LibraryUnitTarget into API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 5 years, 8 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/task/dart.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/task/dart.dart
diff --git a/pkg/analyzer/lib/task/dart.dart b/pkg/analyzer/lib/task/dart.dart
index 819554965f0341d546e326401f689c42fc7d4585..cc3a5a3f1a0c2604c22373620e635d163750fcb1 100644
--- a/pkg/analyzer/lib/task/dart.dart
+++ b/pkg/analyzer/lib/task/dart.dart
@@ -9,6 +9,7 @@ import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/scanner.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/task/model.dart';
/**
@@ -120,3 +121,44 @@ final ResultDescriptor<Token> TOKEN_STREAM =
*/
final ListResultDescriptor<Source> UNITS =
new ListResultDescriptor<Source>('UNITS', Source.EMPTY_ARRAY);
+
+/**
+ * A specific compilation unit in a specific library.
+ *
+ * This kind of target is associated with information about a compilation unit
+ * that differs based on the library that the unit is a part of. For example,
+ * the result of resolving a compilation unit depends on the imports, which can
+ * change if a single part is included in more than one library.
+ */
+class LibrarySpecificUnit implements AnalysisTarget {
+ /**
+ * The defining compilation unit of the library in which the [unit]
+ * is analyzed.
+ */
+ final Source library;
+
+ /**
+ * The compilation unit which belongs to the [library].
+ */
+ final Source unit;
+
+ /**
+ * Initialize a newly created target for the [unit] in the [library].
+ */
+ LibrarySpecificUnit(this.library, this.unit);
+
+ @override
+ int get hashCode {
+ return JenkinsSmiHash.combine(library.hashCode, unit.hashCode);
+ }
+
+ @override
+ Source get source => unit;
+
+ @override
+ bool operator ==(other) {
+ return other is LibrarySpecificUnit &&
+ other.library == library &&
+ other.unit == unit;
+ }
+}
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698