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 analyzer.test.src.context.context_test; | 5 library analyzer.test.src.context.context_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 _assertValidForChangedLibrary(a); | 3085 _assertValidForChangedLibrary(a); |
3086 _assertInvalid(a, LIBRARY_ERRORS_READY); | 3086 _assertInvalid(a, LIBRARY_ERRORS_READY); |
3087 _assertValidForDependentLibrary(b); | 3087 _assertValidForDependentLibrary(b); |
3088 _assertInvalid(b, LIBRARY_ERRORS_READY); | 3088 _assertInvalid(b, LIBRARY_ERRORS_READY); |
3089 _assertInvalidUnits(b, RESOLVED_UNIT4); | 3089 _assertInvalidUnits(b, RESOLVED_UNIT4); |
3090 // Now b.dart is analyzed and it again has the error. | 3090 // Now b.dart is analyzed and it again has the error. |
3091 _performPendingAnalysisTasks(); | 3091 _performPendingAnalysisTasks(); |
3092 expect(context.getErrors(b).errors, hasLength(1)); | 3092 expect(context.getErrors(b).errors, hasLength(1)); |
3093 } | 3093 } |
3094 | 3094 |
| 3095 void test_sequence_class_removeMethod_overridden() { |
| 3096 Source a = addSource( |
| 3097 '/a.dart', |
| 3098 r''' |
| 3099 class A { |
| 3100 void foo() {} |
| 3101 } |
| 3102 '''); |
| 3103 Source b = addSource( |
| 3104 '/b.dart', |
| 3105 r''' |
| 3106 import 'a.dart'; |
| 3107 class B extends A { |
| 3108 @override |
| 3109 void foo() {} |
| 3110 } |
| 3111 '''); |
| 3112 _performPendingAnalysisTasks(); |
| 3113 expect(context.getErrors(b).errors, hasLength(0)); |
| 3114 // Update a.dart: remove add A.foo. |
| 3115 // b.dart has a new hint, because B.foo does not override anything |
| 3116 context.setContents( |
| 3117 a, |
| 3118 r''' |
| 3119 class A { |
| 3120 } |
| 3121 '''); |
| 3122 _assertValidForChangedLibrary(a); |
| 3123 _assertInvalid(a, LIBRARY_ERRORS_READY); |
| 3124 _assertValidForDependentLibrary(b); |
| 3125 _assertInvalid(b, LIBRARY_ERRORS_READY); |
| 3126 _assertInvalidUnits(b, RESOLVED_UNIT4); |
| 3127 |
| 3128 _performPendingAnalysisTasks(); |
| 3129 expect(context.getErrors(b).errors, hasLength(1)); |
| 3130 } |
| 3131 |
3095 void test_sequence_inBodyChange_addRef_deltaChange() { | 3132 void test_sequence_inBodyChange_addRef_deltaChange() { |
3096 Source a = addSource( | 3133 Source a = addSource( |
3097 '/a.dart', | 3134 '/a.dart', |
3098 r''' | 3135 r''' |
3099 class A { | 3136 class A { |
3100 } | 3137 } |
3101 '''); | 3138 '''); |
3102 Source b = addSource( | 3139 Source b = addSource( |
3103 '/b.dart', | 3140 '/b.dart', |
3104 r''' | 3141 r''' |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3821 * Initialize the visitor. | 3858 * Initialize the visitor. |
3822 */ | 3859 */ |
3823 _ElementGatherer(); | 3860 _ElementGatherer(); |
3824 | 3861 |
3825 @override | 3862 @override |
3826 void visitElement(Element element) { | 3863 void visitElement(Element element) { |
3827 elements[element] = element; | 3864 elements[element] = element; |
3828 super.visitElement(element); | 3865 super.visitElement(element); |
3829 } | 3866 } |
3830 } | 3867 } |
OLD | NEW |