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

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

Issue 1168473003: Issue 23573. Catch exception during indexing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Clean index information for the current Dart unit on exception. Created 5 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 unified diff | Download patch
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/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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698