Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2124413002: When in-body incremantal resolution is performed, it should update REFERENCED_NAMES. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/generated/incremental_resolver_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 _assertValidForChangedLibrary(a); 3096 _assertValidForChangedLibrary(a);
3097 _assertInvalid(a, LIBRARY_ERRORS_READY); 3097 _assertInvalid(a, LIBRARY_ERRORS_READY);
3098 _assertValidForDependentLibrary(b); 3098 _assertValidForDependentLibrary(b);
3099 _assertInvalid(b, LIBRARY_ERRORS_READY); 3099 _assertInvalid(b, LIBRARY_ERRORS_READY);
3100 _assertInvalidUnits(b, RESOLVED_UNIT4); 3100 _assertInvalidUnits(b, RESOLVED_UNIT4);
3101 // Now b.dart is analyzed and it again has the error. 3101 // Now b.dart is analyzed and it again has the error.
3102 _performPendingAnalysisTasks(); 3102 _performPendingAnalysisTasks();
3103 expect(context.getErrors(b).errors, hasLength(1)); 3103 expect(context.getErrors(b).errors, hasLength(1));
3104 } 3104 }
3105 3105
3106 void test_sequence_inBodyChange_deltaChange() {
Brian Wilkerson 2016/07/07 20:58:41 This will test that the newly referenced name gets
scheglov 2016/07/07 21:02:45 Good idea, thank you. I've added a new test for th
3107 Source a = addSource(
3108 '/a.dart',
3109 r'''
3110 class A {
3111 }
3112 ''');
3113 Source b = addSource(
3114 '/b.dart',
3115 r'''
3116 import 'a.dart';
3117 main(A a) {
3118 }
3119 ''');
3120 _performPendingAnalysisTasks();
3121 expect(context.getErrors(b).errors, hasLength(0));
3122 // Update b.dart: in-body incremental change
3123 // Should update referenced names.
3124 context.setContents(
3125 b,
3126 r'''
3127 import 'a.dart';
3128 main(A a) {
3129 a.foo;
3130 }
3131 ''');
3132 _performPendingAnalysisTasks();
3133 expect(context.getErrors(b).errors, hasLength(1));
3134 // Update a.dart: add A.foo
3135 // b.dart is invalid, because it references 'foo'.
3136 context.setContents(
3137 a,
3138 r'''
3139 class A {
3140 int foo;
3141 }
3142 ''');
3143 _assertValidForChangedLibrary(a);
3144 _assertInvalid(a, LIBRARY_ERRORS_READY);
3145 _assertValidForDependentLibrary(b);
3146 _assertInvalid(b, LIBRARY_ERRORS_READY);
3147 _assertInvalidUnits(b, RESOLVED_UNIT4);
3148 // No errors after analysis.
3149 _performPendingAnalysisTasks();
3150 expect(context.getErrors(b).errors, hasLength(0));
3151 }
3152
3106 void test_sequence_noChange_thenChange() { 3153 void test_sequence_noChange_thenChange() {
3107 Source a = addSource( 3154 Source a = addSource(
3108 '/a.dart', 3155 '/a.dart',
3109 r''' 3156 r'''
3110 class A { 3157 class A {
3111 A(); 3158 A();
3112 } 3159 }
3113 3160
3114 class B { 3161 class B {
3115 B(); 3162 B();
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
3741 * Initialize the visitor. 3788 * Initialize the visitor.
3742 */ 3789 */
3743 _ElementGatherer(); 3790 _ElementGatherer();
3744 3791
3745 @override 3792 @override
3746 void visitElement(Element element) { 3793 void visitElement(Element element) {
3747 elements[element] = element; 3794 elements[element] = element;
3748 super.visitElement(element); 3795 super.visitElement(element);
3749 } 3796 }
3750 } 3797 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/incremental_resolver_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698