| 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/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3755 enableUnusedElement = true; | 3755 enableUnusedElement = true; |
| 3756 Source source = addSource(r''' | 3756 Source source = addSource(r''' |
| 3757 class _A {} | 3757 class _A {} |
| 3758 main() { | 3758 main() { |
| 3759 }'''); | 3759 }'''); |
| 3760 computeLibrarySourceErrors(source); | 3760 computeLibrarySourceErrors(source); |
| 3761 assertErrors(source, [HintCode.UNUSED_ELEMENT]); | 3761 assertErrors(source, [HintCode.UNUSED_ELEMENT]); |
| 3762 verify([source]); | 3762 verify([source]); |
| 3763 } | 3763 } |
| 3764 | 3764 |
| 3765 void test_unusedElement_class_isUsed_fieldDeclaration() { |
| 3766 enableUnusedElement = true; |
| 3767 var src = r''' |
| 3768 class Foo { |
| 3769 _Bar x; |
| 3770 } |
| 3771 |
| 3772 class _Bar { |
| 3773 } |
| 3774 '''; |
| 3775 Source source = addSource(src); |
| 3776 computeLibrarySourceErrors(source); |
| 3777 assertNoErrors(source); |
| 3778 verify([source]); |
| 3779 } |
| 3780 |
| 3765 void test_unusedElement_class_notUsed_variableDeclaration() { | 3781 void test_unusedElement_class_notUsed_variableDeclaration() { |
| 3766 enableUnusedElement = true; | 3782 enableUnusedElement = true; |
| 3767 Source source = addSource(r''' | 3783 Source source = addSource(r''' |
| 3768 class _A {} | 3784 class _A {} |
| 3769 main() { | 3785 main() { |
| 3770 _A v; | 3786 _A v; |
| 3771 print(v); | 3787 print(v); |
| 3772 } | 3788 } |
| 3773 print(x) {} | 3789 print(x) {} |
| 3774 '''); | 3790 '''); |
| (...skipping 12274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16049 | 16065 |
| 16050 void _resolveTestUnit(String code) { | 16066 void _resolveTestUnit(String code) { |
| 16051 testCode = code; | 16067 testCode = code; |
| 16052 testSource = addSource(testCode); | 16068 testSource = addSource(testCode); |
| 16053 LibraryElement library = resolve2(testSource); | 16069 LibraryElement library = resolve2(testSource); |
| 16054 assertNoErrors(testSource); | 16070 assertNoErrors(testSource); |
| 16055 verify([testSource]); | 16071 verify([testSource]); |
| 16056 testUnit = resolveCompilationUnit(testSource, library); | 16072 testUnit = resolveCompilationUnit(testSource, library); |
| 16057 } | 16073 } |
| 16058 } | 16074 } |
| OLD | NEW |