Skip to content

Commit 9936040

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate exit_detector
Change-Id: I6bb2121b5166012f6b68652ede3703933be9c6ea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399841 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 6f1bd6a commit 9936040

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pkg/analyzer/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ lib/src/dart/resolver/binary_expression_resolver.dart
6868
lib/src/dart/resolver/body_inference_context.dart
6969
lib/src/dart/resolver/comment_reference_resolver.dart
7070
lib/src/dart/resolver/constructor_reference_resolver.dart
71-
lib/src/dart/resolver/exit_detector.dart
7271
lib/src/dart/resolver/extension_member_resolver.dart
7372
lib/src/dart/resolver/flow_analysis_visitor.dart
7473
lib/src/dart/resolver/for_resolver.dart

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import 'package:analyzer/dart/ast/ast.dart';
66
import 'package:analyzer/dart/ast/token.dart';
77
import 'package:analyzer/dart/ast/visitor.dart';
8-
import 'package:analyzer/dart/element/element.dart';
8+
import 'package:analyzer/dart/element/element2.dart';
99
import 'package:analyzer/src/dart/element/type.dart';
1010

1111
/// Instances of the class `ExitDetector` determine whether the visited AST node
@@ -436,7 +436,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
436436
return false;
437437
}
438438
}
439-
var element = node.methodName.staticElement;
439+
var element = node.methodName.element;
440440
if (_elementExits(element)) {
441441
return true;
442442
}
@@ -696,10 +696,10 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
696696
return ExitDetector()._nodeExits(node);
697697
}
698698

699-
static bool _elementExits(Element? element) {
700-
if (element is ExecutableElement) {
701-
var declaration = element.declaration;
702-
return declaration.hasAlwaysThrows ||
699+
static bool _elementExits(Element2? element) {
700+
if (element is ExecutableElement2) {
701+
var declaration = element.baseElement;
702+
return declaration.metadata2.hasAlwaysThrows ||
703703
identical(declaration.returnType, NeverTypeImpl.instance);
704704
}
705705

0 commit comments

Comments
 (0)