Skip to content

Commit 4c50e5e

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate scope_test (fix scope.get2)
Change-Id: I0fdc5dac753ea452dfd0d7b4c8c310929233fd8c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405442 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
1 parent f7f17cf commit 4c50e5e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pkg/analyzer/lib/src/dart/resolver/scope.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ class PrefixedNamespace implements Namespace {
360360
}
361361

362362
@override
363-
Element2? get2(String name) => Namespace._convert(_definedNames[name]);
363+
Element2? get2(String name) => Namespace._convert(get(name));
364364

365365
@override
366366
Element? getPrefixed(String prefix, String name) {

pkg/analyzer/test/src/dart/resolution/scope_test.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
75
import 'package:analyzer/src/dart/resolver/scope.dart';
86
import 'package:analyzer/src/error/codes.dart';
97
import 'package:test/test.dart';
@@ -25,24 +23,24 @@ import 'dart:math' as prefix;
2523
''', [
2624
error(WarningCode.UNUSED_IMPORT, 7, 11),
2725
]);
28-
var namespace = findElement.import('dart:math').namespace;
26+
var namespace = findElement2.import('dart:math').namespace;
2927
return namespace as PrefixedNamespace;
3028
}
3129

3230
void test_lookup_missing() async {
3331
var namespace = await _dartMath;
34-
expect(namespace.get('prefix.Missing'), isNull);
32+
expect(namespace.get2('prefix.Missing'), isNull);
3533
}
3634

3735
Future<void> test_lookup_missing_matchesPrefix() async {
3836
var namespace = await _dartMath;
39-
expect(namespace.get('prefix'), isNull);
37+
expect(namespace.get2('prefix'), isNull);
4038
}
4139

4240
Future<void> test_lookup_valid() async {
4341
var namespace = await _dartMath;
4442

45-
var random = findElement.importFind('dart:math').class_('Random');
46-
expect(namespace.get('prefix.Random'), same(random));
43+
var random = findElement2.importFind('dart:math').class_('Random');
44+
expect(namespace.get2('prefix.Random'), same(random));
4745
}
4846
}

0 commit comments

Comments
 (0)