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

Unified Diff: pkg/analysis_server/lib/src/domains/analysis/occurrences.dart

Issue 1337143002: Add OCCURRENCES_CONTRIBUTOR_EXTENSION_POINT_ID. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/lib/src/domains/analysis/occurrences.dart
diff --git a/pkg/analysis_server/lib/src/domains/analysis/occurrences.dart b/pkg/analysis_server/lib/src/domains/analysis/occurrences.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b8fd2a0dd98fb1597b8d36cb6a84fb90f833408e
--- /dev/null
+++ b/pkg/analysis_server/lib/src/domains/analysis/occurrences.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
Brian Wilkerson 2015/09/11 20:26:24 2015
+// 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 domains.analysis.occurrences;
+
+import 'package:analysis_server/analysis/occurrences_core.dart';
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/protocol_server.dart' as protocol;
+import 'package:analyzer/src/generated/engine.dart'
+ show AnalysisContext, AnalysisEngine;
+import 'package:analyzer/src/generated/java_engine.dart' show CaughtException;
+import 'package:analyzer/src/generated/source.dart' show Source;
+
+/**
+ * Compute all known occurrences for the given [source].
+ */
+OccurrencesCollectorImpl computeOccurrences(
+ AnalysisServer server, AnalysisContext context, Source source) {
+ OccurrencesCollectorImpl collector = new OccurrencesCollectorImpl();
+ List<OccurrencesContributor> contributors =
+ server.serverPlugin.occurrencesContributors;
+ for (OccurrencesContributor contributor in contributors) {
+ try {
+ contributor.computeOccurrences(collector, context, source);
+ } catch (exception, stackTrace) {
+ AnalysisEngine.instance.logger.logError(
+ 'Exception from occurrences contributor: ${contributor.runtimeType}',
+ new CaughtException(exception, stackTrace));
+ }
+ }
+ return collector;
+}
+
+/**
+ * A concrete implementation of [OccurrencesCollector].
+ */
+class OccurrencesCollectorImpl implements OccurrencesCollector {
+ final List<protocol.Occurrences> allOccurrences = <protocol.Occurrences>[];
+
+ @override
+ void addOccurrences(protocol.Occurrences occurrences) {
+ allOccurrences.add(occurrences);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698