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

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

Issue 2160673002: Another fix incremental constants - annotations should use the old unit element. (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
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 3294 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 r''' 3305 r'''
3306 int _A = 2; 3306 int _A = 2;
3307 int B = _A + 1; 3307 int B = _A + 1;
3308 '''); 3308 ''');
3309 _assertValidForChangedLibrary(a); 3309 _assertValidForChangedLibrary(a);
3310 _assertInvalid(a, LIBRARY_ERRORS_READY); 3310 _assertInvalid(a, LIBRARY_ERRORS_READY);
3311 _assertValidForDependentLibrary(b); 3311 _assertValidForDependentLibrary(b);
3312 _assertInvalid(b, LIBRARY_ERRORS_READY); 3312 _assertInvalid(b, LIBRARY_ERRORS_READY);
3313 } 3313 }
3314 3314
3315 void test_sequence_add_annotation() {
3316 Source a = addSource(
3317 '/a.dart',
3318 r'''
3319 const myAnnotation = const Object();
3320 class A {}
3321 ''');
3322 _performPendingAnalysisTasks();
3323 // Add a new annotation.
3324 context.setContents(
3325 a,
3326 r'''
3327 const myAnnotation = const Object();
3328 @myAnnotation
3329 class A {}
3330 ''');
3331 _assertValidForChangedLibrary(a);
3332 _assertInvalid(a, LIBRARY_ERRORS_READY);
3333 // Analysis is done successfully.
3334 _performPendingAnalysisTasks();
3335 _assertValid(a, LIBRARY_ERRORS_READY);
3336 _assertValid(a, READY_RESOLVED_UNIT);
3337 }
3338
3315 void test_sequence_class_give_take() { 3339 void test_sequence_class_give_take() {
3316 Source a = addSource( 3340 Source a = addSource(
3317 '/a.dart', 3341 '/a.dart',
3318 r''' 3342 r'''
3319 class A {} 3343 class A {}
3320 class B {} 3344 class B {}
3321 class C {} 3345 class C {}
3322 '''); 3346 ''');
3323 Source b = addSource( 3347 Source b = addSource(
3324 '/b.dart', 3348 '/b.dart',
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
4240 * Initialize the visitor. 4264 * Initialize the visitor.
4241 */ 4265 */
4242 _ElementGatherer(); 4266 _ElementGatherer();
4243 4267
4244 @override 4268 @override
4245 void visitElement(Element element) { 4269 void visitElement(Element element) {
4246 elements[element] = element; 4270 elements[element] = element;
4247 super.visitElement(element); 4271 super.visitElement(element);
4248 } 4272 }
4249 } 4273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698