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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 1370833002: Remove ElementLocator.locateWithOffset altogether. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/computer/computer_hover.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 import 'dart:math' show max; 10 import 'dart:math' show max;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 return new ContextSourcePair(null, fileSource); 549 return new ContextSourcePair(null, fileSource);
550 } 550 }
551 551
552 /** 552 /**
553 * Returns [Element]s at the given [offset] of the given [file]. 553 * Returns [Element]s at the given [offset] of the given [file].
554 * 554 *
555 * May be empty if cannot be resolved, but not `null`. 555 * May be empty if cannot be resolved, but not `null`.
556 */ 556 */
557 List<Element> getElementsAtOffset(String file, int offset) { 557 List<Element> getElementsAtOffset(String file, int offset) {
558 List<AstNode> nodes = getNodesAtOffset(file, offset); 558 List<AstNode> nodes = getNodesAtOffset(file, offset);
559 return getElementsOfNodes(nodes, offset); 559 return getElementsOfNodes(nodes);
560 } 560 }
561 561
562 /** 562 /**
563 * Returns [Element]s of the given [nodes]. 563 * Returns [Element]s of the given [nodes].
564 * 564 *
565 * May be empty if not resolved, but not `null`. 565 * May be empty if not resolved, but not `null`.
566 */ 566 */
567 List<Element> getElementsOfNodes(List<AstNode> nodes, int offset) { 567 List<Element> getElementsOfNodes(List<AstNode> nodes) {
568 List<Element> elements = <Element>[]; 568 List<Element> elements = <Element>[];
569 for (AstNode node in nodes) { 569 for (AstNode node in nodes) {
570 if (node is SimpleIdentifier && node.parent is LibraryIdentifier) { 570 if (node is SimpleIdentifier && node.parent is LibraryIdentifier) {
571 node = node.parent; 571 node = node.parent;
572 } 572 }
573 if (node is LibraryIdentifier) { 573 if (node is LibraryIdentifier) {
574 node = node.parent; 574 node = node.parent;
575 } 575 }
576 Element element = ElementLocator.locateWithOffset(node, offset); 576 Element element = ElementLocator.locate(node);
577 if (node is SimpleIdentifier && element is PrefixElement) { 577 if (node is SimpleIdentifier && element is PrefixElement) {
578 element = getImportElement(node); 578 element = getImportElement(node);
579 } 579 }
580 if (element != null) { 580 if (element != null) {
581 elements.add(element); 581 elements.add(element);
582 } 582 }
583 } 583 }
584 return elements; 584 return elements;
585 } 585 }
586 586
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 /** 1593 /**
1594 * The [PerformanceTag] for time spent in server request handlers. 1594 * The [PerformanceTag] for time spent in server request handlers.
1595 */ 1595 */
1596 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1596 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1597 1597
1598 /** 1598 /**
1599 * The [PerformanceTag] for time spent in split store microtasks. 1599 * The [PerformanceTag] for time spent in split store microtasks.
1600 */ 1600 */
1601 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1601 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1602 } 1602 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/computer/computer_hover.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698