mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:39:48 +00:00
Fix for Cider completion in libraries with parts.
R=brianwilkerson@google.com, keertip@google.com Change-Id: I834d27cad96092d32d7c1bacb71fc4584ba3503d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154381 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
63a57a76ce
commit
b6773035ba
|
@ -366,6 +366,20 @@ void foo() {
|
|||
_assertHasGetter(text: 'isEven');
|
||||
}
|
||||
|
||||
Future<void> test_partialResolution_hasPart() async {
|
||||
newFile('/workspace/dart/test/lib/a.dart', content: r'''
|
||||
class A {}
|
||||
''');
|
||||
|
||||
await _compute(r'''
|
||||
part 'a.dart';
|
||||
^
|
||||
''');
|
||||
|
||||
_assertHasClass(text: 'int');
|
||||
_assertHasClass(text: 'A');
|
||||
}
|
||||
|
||||
Future<void> test_warmUp_cachesImportedLibraries() async {
|
||||
var aPath = convertPath('/workspace/dart/test/lib/a.dart');
|
||||
newFile(aPath, content: r'''
|
||||
|
|
|
@ -139,7 +139,7 @@ class LibraryAnalyzer {
|
|||
_libraryScope = LibraryScope(_libraryElement);
|
||||
|
||||
performance.run('resolveDirectives', (performance) {
|
||||
_resolveDirectives(units);
|
||||
_resolveDirectives(units, forCompletion);
|
||||
});
|
||||
|
||||
performance.run('resolveFiles', (performance) {
|
||||
|
@ -536,10 +536,17 @@ class LibraryAnalyzer {
|
|||
return unit;
|
||||
}
|
||||
|
||||
void _resolveDirectives(Map<FileState, CompilationUnit> units) {
|
||||
void _resolveDirectives(
|
||||
Map<FileState, CompilationUnit> units,
|
||||
bool forCompletion,
|
||||
) {
|
||||
CompilationUnit definingCompilationUnit = units[_library];
|
||||
definingCompilationUnit.element = _libraryElement.definingCompilationUnit;
|
||||
|
||||
if (forCompletion) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool matchNodeElement(Directive node, Element element) {
|
||||
return node.keyword.offset == element.nameOffset;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue