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

Unified Diff: pkg/analysis_server/lib/src/index/index.dart

Issue 365193004: Move Index and IndexStore implementations into Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/index/index.dart
diff --git a/pkg/analysis_server/lib/src/index/index.dart b/pkg/analysis_server/lib/src/index/index.dart
deleted file mode 100644
index 023cfc9c2f4ea9d913be0110770e31a77c9b22d9..0000000000000000000000000000000000000000
--- a/pkg/analysis_server/lib/src/index/index.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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 index;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:analysis_server/src/index/store/codec.dart';
-import 'package:analysis_server/src/index/store/separate_file_manager.dart';
-import 'package:analysis_server/src/index/store/split_store.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/html.dart';
-import 'package:analyzer/src/generated/index.dart';
-import 'package:analyzer/src/generated/source.dart';
-
-
-Index createLocalFileSplitIndex(Directory directory) {
- var fileManager = new SeparateFileManager(directory);
- var stringCodec = new StringCodec();
- var nodeManager = new FileNodeManager(fileManager,
- AnalysisEngine.instance.logger, stringCodec, new ContextCodec(),
- new ElementCodec(stringCodec), new RelationshipCodec(stringCodec));
- return new LocalIndex(nodeManager);
-}
-
-
-/**
- * A local implementation of [Index].
- */
-class LocalIndex extends Index {
- SplitIndexStore _store;
-
- LocalIndex(NodeManager nodeManager) {
- _store = new SplitIndexStore(nodeManager);
- }
-
- @override
- String get statistics => _store.statistics;
-
- @override
- void clear() {
- _store.clear();
- }
-
- @override
- void getRelationships(Element element, Relationship relationship,
- RelationshipCallback callback) {
- // TODO(scheglov) update Index API to use asynchronous interface
- callback.hasRelationships(element, relationship, Location.EMPTY_ARRAY);
- }
-
- /**
- * Returns a `Future<List<Location>>` that completes with the list of
- * [Location]s of the given [relationship] with the given [element].
- *
- * For example, if the [element] represents a function and the [relationship]
- * is the `is-invoked-by` relationship, then the locations will be all of the
- * places where the function is invoked.
- */
- Future<List<Location>> getRelationshipsAsync(Element element,
- Relationship relationship) {
- return _store.getRelationshipsAsync(element, relationship);
- }
-
- @override
- void indexHtmlUnit(AnalysisContext context, HtmlUnit unit) {
- if (unit == null) {
- return;
- }
- if (unit.element == null) {
- return;
- }
- new IndexHtmlUnitOperation(_store, context, unit).performOperation();
- }
-
- @override
- void indexUnit(AnalysisContext context, CompilationUnit unit) {
- if (unit == null) {
- return;
- }
- if (unit.element == null) {
- return;
- }
- new IndexUnitOperation(_store, context, unit).performOperation();
- }
-
- @override
- void removeContext(AnalysisContext context) {
- _store.removeContext(context);
- }
-
- @override
- void removeSource(AnalysisContext context, Source source) {
- _store.removeSource(context, source);
- }
-
- @override
- void removeSources(AnalysisContext context, SourceContainer container) {
- _store.removeSources(context, container);
- }
-
- @override
- void run() {
- // NO-OP if in the same isolate
- }
-
- @override
- void stop() {
- // NO-OP if in the same isolate
- }
-}

Powered by Google App Engine
This is Rietveld 408576698