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 22 matching lines...) Expand all Loading... |
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.aboutToIndexDart(context, unitElement); |
39 if (!mayIndex) { | 39 if (!mayIndex) { |
40 return; | 40 return; |
41 } | 41 } |
42 // do index | 42 // do index |
43 unit.accept(new _IndexContributor(store)); | 43 try { |
44 store.doneIndex(); | 44 unit.accept(new _IndexContributor(store)); |
| 45 store.doneIndex(); |
| 46 } catch (e) { |
| 47 store.cancelIndexDart(); |
| 48 rethrow; |
| 49 } |
45 } | 50 } |
46 | 51 |
47 /** | 52 /** |
48 * Adds data to [store] based on the resolved HTML [unit]. | 53 * Adds data to [store] based on the resolved HTML [unit]. |
49 */ | 54 */ |
50 void indexHtmlUnit( | 55 void indexHtmlUnit( |
51 InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) { | 56 InternalIndexStore store, AnalysisContext context, ht.HtmlUnit unit) { |
52 // check unit | 57 // check unit |
53 if (unit == null) { | 58 if (unit == null) { |
54 return; | 59 return; |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 } | 799 } |
795 | 800 |
796 /** | 801 /** |
797 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 802 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
798 */ | 803 */ |
799 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 804 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
800 AstNode parent = node.parent; | 805 AstNode parent = node.parent; |
801 return parent is PrefixedIdentifier && parent.identifier == node; | 806 return parent is PrefixedIdentifier && parent.identifier == node; |
802 } | 807 } |
803 } | 808 } |
OLD | NEW |