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

Unified Diff: pkg/analyzer/lib/context/context_root.dart

Issue 2795743002: Add context information to driver and add hooks for plugin management (Closed)
Patch Set: Created 3 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
Index: pkg/analyzer/lib/context/context_root.dart
diff --git a/pkg/analyzer/lib/context/context_root.dart b/pkg/analyzer/lib/context/context_root.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f871ab1c0a8993bd93aa8895d26917d86bddc601
--- /dev/null
+++ b/pkg/analyzer/lib/context/context_root.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2017, 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.
+
+import 'package:analyzer/src/generated/utilities_general.dart';
+
+/**
+ * Information about the root directory associated with an analysis context.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+class ContextRoot {
+ /**
+ * The absolute path of the root directory containing the files to be
+ * analyzed.
+ */
+ final String root;
+
+ /**
+ * A list of the absolute paths of files and directories within the root
+ * directory that should not be analyzed.
+ */
+ final List<String> exclude;
+
+ /**
+ * Initialize a newly created context root.
+ */
+ ContextRoot(this.root, this.exclude);
+
+ @override
+ int get hashCode {
+ int hash = 0;
+ hash = JenkinsSmiHash.combine(hash, root.hashCode);
+ hash = JenkinsSmiHash.combine(hash, exclude.hashCode);
+ return JenkinsSmiHash.finish(hash);
+ }
+
+ @override
+ bool operator ==(other) {
+ if (other is ContextRoot) {
+ return root == other.root &&
+ _listEqual(exclude, other.exclude, (String a, String b) => a == b);
+ }
+ return false;
+ }
+
+ /**
+ * Compare the lists [listA] and [listB], using [itemEqual] to compare
+ * list elements.
+ */
+ bool _listEqual(List listA, List listB, bool itemEqual(a, b)) {
+ if (listA == null) {
+ return listB == null;
+ }
+ if (listB == null) {
+ return false;
+ }
+ if (listA.length != listB.length) {
+ return false;
+ }
+ for (int i = 0; i < listA.length; i++) {
+ if (!itemEqual(listA[i], listB[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
« no previous file with comments | « pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart ('k') | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698