OLD | NEW |
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/analysis/index/index_core.dart'; | 9 import 'package:analysis_server/analysis/index/index_core.dart'; |
10 import 'package:analysis_server/analysis/index/index_dart.dart'; | 10 import 'package:analysis_server/analysis/index/index_dart.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 // check unit | 28 // check unit |
29 if (unit == null) { | 29 if (unit == null) { |
30 return; | 30 return; |
31 } | 31 } |
32 // prepare unit element | 32 // prepare unit element |
33 CompilationUnitElement unitElement = unit.element; | 33 CompilationUnitElement unitElement = unit.element; |
34 if (unitElement == null) { | 34 if (unitElement == null) { |
35 return; | 35 return; |
36 } | 36 } |
37 // about to index | 37 // about to index |
38 bool mayIndex = store.aboutToIndexDart(context, unitElement); | 38 bool mayIndex = store.aboutToIndex(context, unitElement); |
39 if (!mayIndex) { | 39 if (!mayIndex) { |
40 return; | 40 return; |
41 } | 41 } |
42 // do index | 42 // do index |
43 try { | 43 try { |
44 unit.accept(new _IndexContributor(store)); | 44 unit.accept(new _IndexContributor(store)); |
45 store.doneIndex(); | 45 store.doneIndex(); |
46 } catch (e) { | 46 } catch (e) { |
47 store.cancelIndexDart(); | 47 store.cancelIndex(); |
48 rethrow; | 48 rethrow; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 /** | 52 /** |
53 * Adds data to [store] based on the resolved HTML [unit]. | 53 * Adds data to [store] based on the resolved HTML [unit]. |
54 */ | 54 */ |
55 void indexHtmlUnit( | 55 void indexHtmlUnit( |
56 InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) { | 56 InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) { |
57 // check unit | 57 // TODO(scheglov) remove or implement |
58 if (unit == null) { | 58 // // check unit |
59 return; | 59 // if (unit == null) { |
60 } | 60 // return; |
61 // prepare unit element | 61 // } |
62 HtmlElement unitElement = unit.element; | 62 // // prepare unit element |
63 if (unitElement == null) { | 63 // HtmlElement unitElement = unit.element; |
64 return; | 64 // if (unitElement == null) { |
65 } | 65 // return; |
66 // about to index | 66 // } |
67 bool mayIndex = store.aboutToIndexHtml(context, unitElement); | 67 // // about to index |
68 if (!mayIndex) { | 68 // bool mayIndex = store.aboutToIndexHtml(context, unitElement); |
69 return; | 69 // if (!mayIndex) { |
70 } | 70 // return; |
71 // do index | 71 // } |
72 store.doneIndex(); | 72 // // do index |
| 73 // store.doneIndex(); |
73 } | 74 } |
74 | 75 |
75 /** | 76 /** |
76 * An [IndexContributor] that can be used to contribute relationships for Dart | 77 * An [IndexContributor] that can be used to contribute relationships for Dart |
77 * files. | 78 * files. |
78 */ | 79 */ |
79 class DefaultDartIndexContributor extends DartIndexContributor { | 80 class DefaultDartIndexContributor extends DartIndexContributor { |
80 @override | 81 @override |
81 void internalContributeTo(IndexStore store, CompilationUnit unit) { | 82 void internalContributeTo(IndexStore store, CompilationUnit unit) { |
82 _IndexContributor contributor = | 83 _IndexContributor contributor = |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 } | 829 } |
829 | 830 |
830 /** | 831 /** |
831 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 832 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
832 */ | 833 */ |
833 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 834 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
834 AstNode parent = node.parent; | 835 AstNode parent = node.parent; |
835 return parent is PrefixedIdentifier && parent.identifier == node; | 836 return parent is PrefixedIdentifier && parent.identifier == node; |
836 } | 837 } |
837 } | 838 } |
OLD | NEW |