File tree Expand file tree Collapse file tree 3 files changed +2
-35
lines changed Expand file tree Collapse file tree 3 files changed +2
-35
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ typedef WorkToWaitAfterComputingResult = Future<void> Function(String path);
91
91
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
92
92
class AnalysisDriver implements AnalysisDriverGeneric {
93
93
/// The version of data format, should be incremented on every format change.
94
- static const int DATA_VERSION = 107 ;
94
+ static const int DATA_VERSION = 106 ;
95
95
96
96
/// The length of the list returned by [_computeDeclaredVariablesSignature] .
97
97
static const int _declaredVariablesSignatureLength = 4 ;
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import 'package:analyzer/dart/ast/ast.dart';
6
6
import 'package:analyzer/dart/ast/token.dart' ;
7
7
import 'package:analyzer/dart/ast/visitor.dart' ;
8
8
import 'package:analyzer/dart/element/element.dart' ;
9
- import 'package:analyzer/src/dart/element/type.dart' ;
10
9
11
10
/// Instances of the class `ExitDetector` determine whether the visited AST node
12
11
/// is guaranteed to terminate by executing a `return` statement, `throw`
@@ -424,7 +423,7 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
424
423
}
425
424
}
426
425
Element element = node.methodName.staticElement;
427
- if (_elementExits ( element) ) {
426
+ if (element != null && element.hasAlwaysThrows ) {
428
427
return true ;
429
428
}
430
429
return _nodeExits (node.argumentList);
@@ -661,14 +660,4 @@ class ExitDetector extends GeneralizingAstVisitor<bool> {
661
660
static bool exits (AstNode node) {
662
661
return ExitDetector ()._nodeExits (node);
663
662
}
664
-
665
- static bool _elementExits (Element element) {
666
- if (element is ExecutableElement ) {
667
- var declaration = element.declaration;
668
- return declaration.hasAlwaysThrows ||
669
- identical (declaration.returnType, NeverTypeImpl .instance);
670
- }
671
-
672
- return false ;
673
- }
674
663
}
Original file line number Diff line number Diff line change @@ -7,12 +7,10 @@ import 'package:analyzer/src/test_utilities/package_mixin.dart';
7
7
import 'package:test_reflective_loader/test_reflective_loader.dart' ;
8
8
9
9
import '../dart/resolution/driver_resolution.dart' ;
10
- import '../dart/resolution/with_null_safety_mixin.dart' ;
11
10
12
11
main () {
13
12
defineReflectiveSuite (() {
14
13
defineReflectiveTests (MissingReturnTest );
15
- defineReflectiveTests (MissingReturnWithNullSafetyTest );
16
14
});
17
15
}
18
16
@@ -215,23 +213,3 @@ class B extends A {
215
213
]);
216
214
}
217
215
}
218
-
219
- @reflectiveTest
220
- class MissingReturnWithNullSafetyTest extends DriverResolutionTest
221
- with WithNullSafetyMixin {
222
- test_returnNever () async {
223
- newFile ('/test/lib/a.dart' , content: r'''
224
- Never foo() {
225
- throw 0;
226
- }
227
- ''' );
228
- await assertNoErrorsInCode (r'''
229
- // @dart = 2.8
230
- import 'a.dart';
231
-
232
- int f() {
233
- foo();
234
- }
235
- ''' );
236
- }
237
- }
You can’t perform that action at this time.
0 commit comments