OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
10 import 'package:analyzer/src/summary/format.dart'; | 10 import 'package:analyzer/src/summary/format.dart'; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 String unitLibraryUri = null; | 341 String unitLibraryUri = null; |
342 String unitUnitUri = null; | 342 String unitUnitUri = null; |
343 for (int i = 0; i < unitIndex.definedNames.length; i++) { | 343 for (int i = 0; i < unitIndex.definedNames.length; i++) { |
344 if (unitIndex.definedNameKinds[i] == kind) { | 344 if (unitIndex.definedNameKinds[i] == kind) { |
345 int nameIndex = unitIndex.definedNames[i]; | 345 int nameIndex = unitIndex.definedNames[i]; |
346 String name = packageRequester.index.strings[nameIndex]; | 346 String name = packageRequester.index.strings[nameIndex]; |
347 if (regExp.matchAsPrefix(name) != null) { | 347 if (regExp.matchAsPrefix(name) != null) { |
348 unitLibraryUri ??= packageRequester.getUnitLibraryUri(unitIndex.unit); | 348 unitLibraryUri ??= packageRequester.getUnitLibraryUri(unitIndex.unit); |
349 unitUnitUri ??= packageRequester.getUnitUnitUri(unitIndex.unit); | 349 unitUnitUri ??= packageRequester.getUnitUnitUri(unitIndex.unit); |
350 locations.add(new Location(unitLibraryUri, unitUnitUri, | 350 locations.add(new Location(unitLibraryUri, unitUnitUri, |
351 unitIndex.definedNameOffsets[i], 0, false)); | 351 unitIndex.definedNameOffsets[i], name.length, false)); |
352 } | 352 } |
353 } | 353 } |
354 } | 354 } |
355 return locations; | 355 return locations; |
356 } | 356 } |
357 | 357 |
358 /** | 358 /** |
359 * Return a list of locations where an element with the given [elementId] has | 359 * Return a list of locations where an element with the given [elementId] has |
360 * relation of the given [kind]. | 360 * relation of the given [kind]. |
361 */ | 361 */ |
(...skipping 18 matching lines...) Expand all Loading... |
380 unitLibraryUri, | 380 unitLibraryUri, |
381 unitUnitUri, | 381 unitUnitUri, |
382 unitIndex.usedElementOffsets[i], | 382 unitIndex.usedElementOffsets[i], |
383 unitIndex.usedElementLengths[i], | 383 unitIndex.usedElementLengths[i], |
384 unitIndex.usedElementIsQualifiedFlags[i])); | 384 unitIndex.usedElementIsQualifiedFlags[i])); |
385 } | 385 } |
386 } | 386 } |
387 return locations; | 387 return locations; |
388 } | 388 } |
389 } | 389 } |
OLD | NEW |