| 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.index; | 8 library engine.index; |
| 9 | 9 |
| 10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 return super.visitXmlTagNode(node); | 168 return super.visitXmlTagNode(node); |
| 169 } | 169 } |
| 170 | 170 |
| 171 Location _createLocationForIdentifier(SimpleIdentifier identifier) => new Loca
tion(_htmlUnitElement, identifier.offset, identifier.length); | 171 Location _createLocationForIdentifier(SimpleIdentifier identifier) => new Loca
tion(_htmlUnitElement, identifier.offset, identifier.length); |
| 172 | 172 |
| 173 Location _createLocationForToken(ht.Token token) => new Location(_htmlUnitElem
ent, token.offset, token.length); | 173 Location _createLocationForToken(ht.Token token) => new Location(_htmlUnitElem
ent, token.offset, token.length); |
| 174 } | 174 } |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Instances of the [ClearOperation] implement an operation that removes all of
the |
| 178 * information from the index. |
| 179 */ |
| 180 class ClearOperation implements IndexOperation { |
| 181 /** |
| 182 * The index store against which this operation is being run. |
| 183 */ |
| 184 final IndexStore _indexStore; |
| 185 |
| 186 ClearOperation(this._indexStore); |
| 187 |
| 188 @override |
| 189 bool get isQuery => false; |
| 190 |
| 191 @override |
| 192 void performOperation() { |
| 193 _indexStore.clear(); |
| 194 } |
| 195 |
| 196 @override |
| 197 bool removeWhenSourceRemoved(Source source) => false; |
| 198 |
| 199 @override |
| 200 String toString() => "ClearOperation()"; |
| 201 } |
| 202 |
| 203 /** |
| 177 * Recursively visits [HtmlUnit] and every embedded [Expression]. | 204 * Recursively visits [HtmlUnit] and every embedded [Expression]. |
| 178 */ | 205 */ |
| 179 abstract class ExpressionVisitor extends ht.RecursiveXmlVisitor<Object> { | 206 abstract class ExpressionVisitor extends ht.RecursiveXmlVisitor<Object> { |
| 180 /** | 207 /** |
| 181 * Visits the given [Expression]s embedded into tag or attribute. | 208 * Visits the given [Expression]s embedded into tag or attribute. |
| 182 * | 209 * |
| 183 * @param expression the [Expression] to visit, not `null` | 210 * @param expression the [Expression] to visit, not `null` |
| 184 */ | 211 */ |
| 185 void visitExpression(Expression expression); | 212 void visitExpression(Expression expression); |
| 186 | 213 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 * defined on the index are asynchronous, and results, when there are any, are p
rovided through a | 285 * defined on the index are asynchronous, and results, when there are any, are p
rovided through a |
| 259 * callback. | 286 * callback. |
| 260 * | 287 * |
| 261 * Despite being asynchronous, the results of the operations are guaranteed to b
e consistent with | 288 * Despite being asynchronous, the results of the operations are guaranteed to b
e consistent with |
| 262 * the expectation that operations are performed in the order in which they are
requested. | 289 * the expectation that operations are performed in the order in which they are
requested. |
| 263 * Modification operations are executed before any read operation. There is no g
uarantee about the | 290 * Modification operations are executed before any read operation. There is no g
uarantee about the |
| 264 * order in which the callbacks for read operations will be invoked. | 291 * order in which the callbacks for read operations will be invoked. |
| 265 */ | 292 */ |
| 266 abstract class Index { | 293 abstract class Index { |
| 267 /** | 294 /** |
| 295 * Asynchronously remove from the index all of the information. |
| 296 */ |
| 297 void clear(); |
| 298 |
| 299 /** |
| 268 * Asynchronously invoke the given callback with an array containing all of th
e locations of the | 300 * Asynchronously invoke the given callback with an array containing all of th
e locations of the |
| 269 * elements that have the given relationship with the given element. For examp
le, if the element | 301 * elements that have the given relationship with the given element. For examp
le, if the element |
| 270 * represents a method and the relationship is the is-referenced-by relationsh
ip, then the | 302 * represents a method and the relationship is the is-referenced-by relationsh
ip, then the |
| 271 * locations that will be passed into the callback will be all of the places w
here the method is | 303 * locations that will be passed into the callback will be all of the places w
here the method is |
| 272 * invoked. | 304 * invoked. |
| 273 * | 305 * |
| 274 * @param element the element that has the relationship with the locations to
be returned | 306 * @param element the element that has the relationship with the locations to
be returned |
| 275 * @param relationship the relationship between the given element and the loca
tions to be returned | 307 * @param relationship the relationship between the given element and the loca
tions to be returned |
| 276 * @param callback the callback that will be invoked when the locations are fo
und | 308 * @param callback the callback that will be invoked when the locations are fo
und |
| 277 */ | 309 */ |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 * Notifies the index store that we are going to index the given [HtmlElement]
. | 1588 * Notifies the index store that we are going to index the given [HtmlElement]
. |
| 1557 * | 1589 * |
| 1558 * @param the [AnalysisContext] in which unit being indexed | 1590 * @param the [AnalysisContext] in which unit being indexed |
| 1559 * @param htmlElement the [HtmlElement] being indexed | 1591 * @param htmlElement the [HtmlElement] being indexed |
| 1560 * @return `true` the given [AnalysisContext] is active, or `false` if it was | 1592 * @return `true` the given [AnalysisContext] is active, or `false` if it was |
| 1561 * removed before, so no any unit may be indexed with it | 1593 * removed before, so no any unit may be indexed with it |
| 1562 */ | 1594 */ |
| 1563 bool aboutToIndexHtml(AnalysisContext context, HtmlElement htmlElement); | 1595 bool aboutToIndexHtml(AnalysisContext context, HtmlElement htmlElement); |
| 1564 | 1596 |
| 1565 /** | 1597 /** |
| 1598 * Removes all of the information. |
| 1599 */ |
| 1600 void clear(); |
| 1601 |
| 1602 /** |
| 1566 * Return the locations of the elements that have the given relationship with
the given element. | 1603 * Return the locations of the elements that have the given relationship with
the given element. |
| 1567 * For example, if the element represents a method and the relationship is the
is-referenced-by | 1604 * For example, if the element represents a method and the relationship is the
is-referenced-by |
| 1568 * relationship, then the returned locations will be all of the places where t
he method is | 1605 * relationship, then the returned locations will be all of the places where t
he method is |
| 1569 * invoked. | 1606 * invoked. |
| 1570 * | 1607 * |
| 1571 * @param element the the element that has the relationship with the locations
to be returned | 1608 * @param element the the element that has the relationship with the locations
to be returned |
| 1572 * @param relationship the [Relationship] between the given element and the lo
cations to be | 1609 * @param relationship the [Relationship] between the given element and the lo
cations to be |
| 1573 * returned | 1610 * returned |
| 1574 * @return the locations that have the given relationship with the given eleme
nt | 1611 * @return the locations that have the given relationship with the given eleme
nt |
| 1575 */ | 1612 */ |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 } | 1980 } |
| 1944 } | 1981 } |
| 1945 } | 1982 } |
| 1946 // remember libraries in which unit is used | 1983 // remember libraries in which unit is used |
| 1947 _recordUnitInLibrary(context, null, source); | 1984 _recordUnitInLibrary(context, null, source); |
| 1948 // OK, we can index | 1985 // OK, we can index |
| 1949 return true; | 1986 return true; |
| 1950 } | 1987 } |
| 1951 | 1988 |
| 1952 @override | 1989 @override |
| 1990 void clear() { |
| 1991 _canonicalKeys.clear(); |
| 1992 _keyToLocations.clear(); |
| 1993 _contextToSourceToKeys.clear(); |
| 1994 _contextToSourceToLocations.clear(); |
| 1995 _contextToLibraryToUnits.clear(); |
| 1996 _contextToUnitToLibraries.clear(); |
| 1997 } |
| 1998 |
| 1999 @override |
| 1953 List<Location> getRelationships(Element element, Relationship relationship) { | 2000 List<Location> getRelationships(Element element, Relationship relationship) { |
| 1954 MemoryIndexStoreImpl_ElementRelationKey key = new MemoryIndexStoreImpl_Eleme
ntRelationKey(element, relationship); | 2001 MemoryIndexStoreImpl_ElementRelationKey key = new MemoryIndexStoreImpl_Eleme
ntRelationKey(element, relationship); |
| 1955 Set<Location> locations = _keyToLocations[key]; | 2002 Set<Location> locations = _keyToLocations[key]; |
| 1956 if (locations != null) { | 2003 if (locations != null) { |
| 1957 return new List.from(locations); | 2004 return new List.from(locations); |
| 1958 } | 2005 } |
| 1959 return Location.EMPTY_ARRAY; | 2006 return Location.EMPTY_ARRAY; |
| 1960 } | 2007 } |
| 1961 | 2008 |
| 1962 @override | 2009 @override |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); | 2582 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); |
| 2536 | 2583 |
| 2537 UniverseElementImpl() : super("--universe--", -1); | 2584 UniverseElementImpl() : super("--universe--", -1); |
| 2538 | 2585 |
| 2539 @override | 2586 @override |
| 2540 accept(ElementVisitor visitor) => null; | 2587 accept(ElementVisitor visitor) => null; |
| 2541 | 2588 |
| 2542 @override | 2589 @override |
| 2543 ElementKind get kind => ElementKind.UNIVERSE; | 2590 ElementKind get kind => ElementKind.UNIVERSE; |
| 2544 } | 2591 } |
| OLD | NEW |