Report HighlightRegionType.IMPORT_PREFIX for import prefix in NamedType.
Change-Id: I05ce7fb0010dafe69c6b5926a368350a3486332e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343541 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
a1c3a740a3
commit
40dfd1befe
@@ -1194,6 +1194,13 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitNamedType(NamedType node) {
|
||||
if (node.importPrefix case final importPrefix?) {
|
||||
computer._addRegion_token(
|
||||
importPrefix.name,
|
||||
HighlightRegionType.IMPORT_PREFIX,
|
||||
);
|
||||
}
|
||||
|
||||
var type = node.type;
|
||||
if (type != null) {
|
||||
var isDynamic = type is DynamicType && node.name2.lexeme == 'dynamic';
|
||||
|
||||
@@ -1256,6 +1256,28 @@ void f() {
|
||||
assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma.max');
|
||||
}
|
||||
|
||||
Future<void> test_IMPORT_PREFIX_methodInvocation() async {
|
||||
addTestFile('''
|
||||
import 'dart:math' as ma;
|
||||
void f() {
|
||||
ma.max(1, 2);
|
||||
}
|
||||
''');
|
||||
await prepareHighlights();
|
||||
assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma;');
|
||||
assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma.max');
|
||||
}
|
||||
|
||||
Future<void> test_IMPORT_PREFIX_namedType() async {
|
||||
addTestFile('''
|
||||
import 'dart:math' as math;
|
||||
void f(math.Random r) {}
|
||||
''');
|
||||
await prepareHighlights();
|
||||
assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'math;');
|
||||
assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'math.Random');
|
||||
}
|
||||
|
||||
Future<void> test_INSTANCE_FIELD() async {
|
||||
addTestFile('''
|
||||
class A {
|
||||
|
||||
Reference in New Issue
Block a user