| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.src.index; | 8 library engine.src.index_contributor; |
| 9 | 9 |
| 10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
| 11 | 11 |
| 12 import 'package:analyzer/index/index.dart'; | 12 import 'package:analyzer/index/index.dart'; |
| 13 import 'package:analyzer/index/index_store.dart'; | 13 import 'package:analyzer/index/index_store.dart'; |
| 14 import 'package:analyzer/src/generated/ast.dart'; | 14 import 'package:analyzer/src/generated/ast.dart'; |
| 15 import 'package:analyzer/src/generated/element.dart'; | 15 import 'package:analyzer/src/generated/element.dart'; |
| 16 import 'package:analyzer/src/generated/engine.dart'; | 16 import 'package:analyzer/src/generated/engine.dart'; |
| 17 import 'package:analyzer/src/generated/html.dart' as ht; | 17 import 'package:analyzer/src/generated/html.dart' as ht; |
| 18 import 'package:analyzer/src/generated/java_core.dart'; | 18 import 'package:analyzer/src/generated/java_core.dart'; |
| 19 import 'package:analyzer/src/generated/java_engine.dart'; | 19 import 'package:analyzer/src/generated/java_engine.dart'; |
| 20 import 'package:analyzer/src/generated/resolver.dart'; | 20 import 'package:analyzer/src/generated/resolver.dart'; |
| 21 import 'package:analyzer/src/generated/scanner.dart'; | 21 import 'package:analyzer/src/generated/scanner.dart'; |
| 22 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 23 | 23 |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Adds data to [store] based on the resolved Dart [unit]. | 26 * Adds data to [store] based on the resolved Dart [unit]. |
| 27 */ | 27 */ |
| 28 void indexDartUnit(IndexStore store, AnalysisContext context, | 28 void indexDartUnit(IndexStore store, AnalysisContext context, |
| 29 CompilationUnit unit) { | 29 CompilationUnit unit) { |
| 30 // check unit |
| 31 if (unit == null) { |
| 32 return; |
| 33 } |
| 34 // prepare unit element |
| 30 CompilationUnitElement unitElement = unit.element; | 35 CompilationUnitElement unitElement = unit.element; |
| 36 if (unitElement == null) { |
| 37 return; |
| 38 } |
| 39 // about to index |
| 31 bool mayIndex = store.aboutToIndexDart(context, unitElement); | 40 bool mayIndex = store.aboutToIndexDart(context, unitElement); |
| 32 if (!mayIndex) { | 41 if (!mayIndex) { |
| 33 return; | 42 return; |
| 34 } | 43 } |
| 44 // do index |
| 35 unit.accept(new _IndexContributor(store)); | 45 unit.accept(new _IndexContributor(store)); |
| 36 unit.accept(new _AngularDartIndexContributor(store)); | 46 unit.accept(new _AngularDartIndexContributor(store)); |
| 37 store.doneIndex(); | 47 store.doneIndex(); |
| 38 } | 48 } |
| 39 | 49 |
| 40 | 50 |
| 41 /** | 51 /** |
| 42 * Adds data to [store] based on the resolved HTML [unit]. | 52 * Adds data to [store] based on the resolved HTML [unit]. |
| 43 */ | 53 */ |
| 44 void indexHtmlUnit(IndexStore store, AnalysisContext context, ht.HtmlUnit unit) | 54 void indexHtmlUnit(IndexStore store, AnalysisContext context, ht.HtmlUnit unit) |
| 45 { | 55 { |
| 56 // check unit |
| 57 if (unit == null) { |
| 58 return; |
| 59 } |
| 60 // prepare unit element |
| 46 HtmlElement unitElement = unit.element; | 61 HtmlElement unitElement = unit.element; |
| 62 if (unitElement == null) { |
| 63 return; |
| 64 } |
| 65 // about to index |
| 47 bool mayIndex = store.aboutToIndexHtml(context, unitElement); | 66 bool mayIndex = store.aboutToIndexHtml(context, unitElement); |
| 48 if (!mayIndex) { | 67 if (!mayIndex) { |
| 49 return; | 68 return; |
| 50 } | 69 } |
| 70 // do index |
| 51 unit.accept(new _AngularHtmlIndexContributor(store)); | 71 unit.accept(new _AngularHtmlIndexContributor(store)); |
| 52 store.doneIndex(); | 72 store.doneIndex(); |
| 53 } | 73 } |
| 54 | 74 |
| 55 | 75 |
| 56 /** | 76 /** |
| 57 * Visits resolved [CompilationUnit] and adds Angular specific relationships | 77 * Visits resolved [CompilationUnit] and adds Angular specific relationships |
| 58 * into [IndexStore]. | 78 * into [IndexStore]. |
| 59 */ | 79 */ |
| 60 class _AngularDartIndexContributor extends GeneralizingAstVisitor<Object> { | 80 class _AngularDartIndexContributor extends GeneralizingAstVisitor<Object> { |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 } | 1204 } |
| 1185 | 1205 |
| 1186 /** | 1206 /** |
| 1187 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 1207 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
| 1188 */ | 1208 */ |
| 1189 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 1209 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
| 1190 AstNode parent = node.parent; | 1210 AstNode parent = node.parent; |
| 1191 return parent is PrefixedIdentifier && identical(parent.identifier, node); | 1211 return parent is PrefixedIdentifier && identical(parent.identifier, node); |
| 1192 } | 1212 } |
| 1193 } | 1213 } |
| OLD | NEW |