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

Side by Side Diff: pkg/analysis_server/lib/src/services/index/index_contributor.dart

Issue 1100673005: Rename IndexStore to avoid confusion with the new public API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/index/index_store.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.src.index.index_contributor; 5 library services.src.index.index_contributor;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'package:analysis_server/src/services/correction/namespace.dart'; 9 import 'package:analysis_server/src/services/correction/namespace.dart';
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
11 import 'package:analysis_server/src/services/index/index_store.dart'; 11 import 'package:analysis_server/src/services/index/index_store.dart';
12 import 'package:analyzer/src/generated/ast.dart'; 12 import 'package:analyzer/src/generated/ast.dart';
13 import 'package:analyzer/src/generated/element.dart'; 13 import 'package:analyzer/src/generated/element.dart';
14 import 'package:analyzer/src/generated/engine.dart'; 14 import 'package:analyzer/src/generated/engine.dart';
15 import 'package:analyzer/src/generated/html.dart' as ht; 15 import 'package:analyzer/src/generated/html.dart' as ht;
16 import 'package:analyzer/src/generated/java_engine.dart'; 16 import 'package:analyzer/src/generated/java_engine.dart';
17 import 'package:analyzer/src/generated/scanner.dart'; 17 import 'package:analyzer/src/generated/scanner.dart';
18 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
19 19
20 /** 20 /**
21 * Adds data to [store] based on the resolved Dart [unit]. 21 * Adds data to [store] based on the resolved Dart [unit].
22 */ 22 */
23 void indexDartUnit( 23 void indexDartUnit(
24 IndexStore store, AnalysisContext context, CompilationUnit unit) { 24 InternalIndexStore store, AnalysisContext context, CompilationUnit unit) {
25 // check unit 25 // check unit
26 if (unit == null) { 26 if (unit == null) {
27 return; 27 return;
28 } 28 }
29 // prepare unit element 29 // prepare unit element
30 CompilationUnitElement unitElement = unit.element; 30 CompilationUnitElement unitElement = unit.element;
31 if (unitElement == null) { 31 if (unitElement == null) {
32 return; 32 return;
33 } 33 }
34 // about to index 34 // about to index
35 bool mayIndex = store.aboutToIndexDart(context, unitElement); 35 bool mayIndex = store.aboutToIndexDart(context, unitElement);
36 if (!mayIndex) { 36 if (!mayIndex) {
37 return; 37 return;
38 } 38 }
39 // do index 39 // do index
40 unit.accept(new _IndexContributor(store)); 40 unit.accept(new _IndexContributor(store));
41 store.doneIndex(); 41 store.doneIndex();
42 } 42 }
43 43
44 /** 44 /**
45 * Adds data to [store] based on the resolved HTML [unit]. 45 * Adds data to [store] based on the resolved HTML [unit].
46 */ 46 */
47 void indexHtmlUnit( 47 void indexHtmlUnit(
48 IndexStore store, AnalysisContext context, ht.HtmlUnit unit) { 48 InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) {
49 // check unit 49 // check unit
50 if (unit == null) { 50 if (unit == null) {
51 return; 51 return;
52 } 52 }
53 // prepare unit element 53 // prepare unit element
54 HtmlElement unitElement = unit.element; 54 HtmlElement unitElement = unit.element;
55 if (unitElement == null) { 55 if (unitElement == null) {
56 return; 56 return;
57 } 57 }
58 // about to index 58 // about to index
59 bool mayIndex = store.aboutToIndexHtml(context, unitElement); 59 bool mayIndex = store.aboutToIndexHtml(context, unitElement);
60 if (!mayIndex) { 60 if (!mayIndex) {
61 return; 61 return;
62 } 62 }
63 // do index 63 // do index
64 store.doneIndex(); 64 store.doneIndex();
65 } 65 }
66 66
67 /** 67 /**
68 * Visits a resolved AST and adds relationships into [IndexStore]. 68 * Visits a resolved AST and adds relationships into [InternalIndexStore].
69 */ 69 */
70 class _IndexContributor extends GeneralizingAstVisitor { 70 class _IndexContributor extends GeneralizingAstVisitor {
71 final IndexStore _store; 71 final InternalIndexStore _store;
72 72
73 LibraryElement _libraryElement; 73 LibraryElement _libraryElement;
74 74
75 Map<ImportElement, Set<Element>> _importElementsMap = {}; 75 Map<ImportElement, Set<Element>> _importElementsMap = {};
76 76
77 /** 77 /**
78 * A stack whose top element (the element with the largest index) is an 78 * A stack whose top element (the element with the largest index) is an
79 * element representing the inner-most enclosing scope. 79 * element representing the inner-most enclosing scope.
80 */ 80 */
81 Queue<Element> _elementStack = new Queue(); 81 Queue<Element> _elementStack = new Queue();
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 } 782 }
783 783
784 /** 784 /**
785 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node ". 785 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node ".
786 */ 786 */
787 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { 787 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) {
788 AstNode parent = node.parent; 788 AstNode parent = node.parent;
789 return parent is PrefixedIdentifier && parent.identifier == node; 789 return parent is PrefixedIdentifier && parent.identifier == node;
790 } 790 }
791 } 791 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/index/index_store.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698