| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library engine.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 3319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3330 static m() {} | 3330 static m() {} |
| 3331 } | 3331 } |
| 3332 main() { | 3332 main() { |
| 3333 _A.m(); | 3333 _A.m(); |
| 3334 }'''); | 3334 }'''); |
| 3335 resolve(source); | 3335 resolve(source); |
| 3336 assertNoErrors(source); | 3336 assertNoErrors(source); |
| 3337 verify([source]); | 3337 verify([source]); |
| 3338 } | 3338 } |
| 3339 | 3339 |
| 3340 void test_unusedElement_class_isUsed_typeArgument() { |
| 3341 enableUnusedElement = true; |
| 3342 Source source = addSource(r''' |
| 3343 class _A {} |
| 3344 main() { |
| 3345 var v = new List<_A>(); |
| 3346 print(v); |
| 3347 }'''); |
| 3348 resolve(source); |
| 3349 assertNoErrors(source); |
| 3350 verify([source]); |
| 3351 } |
| 3352 |
| 3340 void test_unusedElement_class_notUsed_inClassMember() { | 3353 void test_unusedElement_class_notUsed_inClassMember() { |
| 3341 enableUnusedElement = true; | 3354 enableUnusedElement = true; |
| 3342 Source source = addSource(r''' | 3355 Source source = addSource(r''' |
| 3343 class _A { | 3356 class _A { |
| 3344 static staticMethod() { | 3357 static staticMethod() { |
| 3345 new _A(); | 3358 new _A(); |
| 3346 } | 3359 } |
| 3347 instanceMethod() { | 3360 instanceMethod() { |
| 3348 new _A(); | 3361 new _A(); |
| 3349 } | 3362 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3561 enableUnusedElement = true; | 3574 enableUnusedElement = true; |
| 3562 Source source = addSource(r''' | 3575 Source source = addSource(r''' |
| 3563 typedef _F(a, b); | 3576 typedef _F(a, b); |
| 3564 main(_F f) { | 3577 main(_F f) { |
| 3565 }'''); | 3578 }'''); |
| 3566 resolve(source); | 3579 resolve(source); |
| 3567 assertNoErrors(source); | 3580 assertNoErrors(source); |
| 3568 verify([source]); | 3581 verify([source]); |
| 3569 } | 3582 } |
| 3570 | 3583 |
| 3584 void test_unusedElement_functionTypeAlias_isUsed_typeArgument() { |
| 3585 enableUnusedElement = true; |
| 3586 Source source = addSource(r''' |
| 3587 typedef _F(a, b); |
| 3588 main() { |
| 3589 var v = new List<_F>(); |
| 3590 print(v); |
| 3591 }'''); |
| 3592 resolve(source); |
| 3593 assertNoErrors(source); |
| 3594 verify([source]); |
| 3595 } |
| 3596 |
| 3571 void test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() { | 3597 void test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() { |
| 3572 enableUnusedElement = true; | 3598 enableUnusedElement = true; |
| 3573 Source source = addSource(r''' | 3599 Source source = addSource(r''' |
| 3574 typedef _F(a, b); | 3600 typedef _F(a, b); |
| 3575 class A { | 3601 class A { |
| 3576 _F f; | 3602 _F f; |
| 3577 }'''); | 3603 }'''); |
| 3578 resolve(source); | 3604 resolve(source); |
| 3579 assertNoErrors(source); | 3605 assertNoErrors(source); |
| 3580 verify([source]); | 3606 verify([source]); |
| (...skipping 10151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13732 // check propagated type | 13758 // check propagated type |
| 13733 FunctionType propagatedType = node.propagatedType as FunctionType; | 13759 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13734 expect(propagatedType.returnType, test.typeProvider.stringType); | 13760 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13735 } on AnalysisException catch (e, stackTrace) { | 13761 } on AnalysisException catch (e, stackTrace) { |
| 13736 thrownException[0] = new CaughtException(e, stackTrace); | 13762 thrownException[0] = new CaughtException(e, stackTrace); |
| 13737 } | 13763 } |
| 13738 } | 13764 } |
| 13739 return null; | 13765 return null; |
| 13740 } | 13766 } |
| 13741 } | 13767 } |
| OLD | NEW |