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

Side by Side Diff: pkg/analyzer/test/generated/declaration_resolver_test.dart

Issue 1771243002: Change when enum constant elements are created to fix bug in re-creating ASTs from existing element… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/lib/src/generated/resolver.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.declaration_resolver_test; 5 library engine.declaration_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/dart/ast/ast.dart'; 9 import 'package:analyzer/src/dart/ast/ast.dart';
10 import 'package:analyzer/src/dart/ast/utilities.dart'; 10 import 'package:analyzer/src/dart/ast/utilities.dart';
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 } 252 }
253 253
254 @reflectiveTest 254 @reflectiveTest
255 class DeclarationResolverTest extends ResolverTestCase { 255 class DeclarationResolverTest extends ResolverTestCase {
256 @override 256 @override
257 void setUp() { 257 void setUp() {
258 super.setUp(); 258 super.setUp();
259 } 259 }
260 260
261 void test_enumConstant_partiallyResolved() {
262 String code = r'''
263 enum Fruit {apple, pear}
264 ''';
265 Source source = addNamedSource('/test.dart', code);
266 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
267 analysisContext.computeResult(source, LIBRARY_ELEMENT1);
268 CompilationUnit unit =
269 analysisContext.computeResult(target, RESOLVED_UNIT1);
270 CompilationUnit unit2 = _cloneResolveUnit(unit);
271 }
272
261 void test_functionDeclaration_getter() { 273 void test_functionDeclaration_getter() {
262 String code = r''' 274 String code = r'''
263 int get zzz => 42; 275 int get zzz => 42;
264 '''; 276 ''';
265 CompilationUnit unit = resolveSource(code); 277 CompilationUnit unit = resolveSource(code);
266 PropertyAccessorElement getterElement = 278 PropertyAccessorElement getterElement =
267 _findSimpleIdentifier(unit, code, 'zzz =>').staticElement; 279 _findSimpleIdentifier(unit, code, 'zzz =>').staticElement;
268 expect(getterElement.isGetter, isTrue); 280 expect(getterElement.isGetter, isTrue);
269 // re-resolve 281 // re-resolve
270 CompilationUnit unit2 = _cloneResolveUnit(unit); 282 CompilationUnit unit2 = _cloneResolveUnit(unit);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 expect(element.type.toString(), "<T>(T, T) → T"); 536 expect(element.type.toString(), "<T>(T, T) → T");
525 expect(t.element, same(tElement)); 537 expect(t.element, same(tElement));
526 538
527 // re-resolve 539 // re-resolve
528 CompilationUnit unit2 = _cloneResolveUnit(unit); 540 CompilationUnit unit2 = _cloneResolveUnit(unit);
529 node = _findSimpleIdentifier(unit2, code, 'max').parent; 541 node = _findSimpleIdentifier(unit2, code, 'max').parent;
530 t = node.typeParameters.typeParameters[0]; 542 t = node.typeParameters.typeParameters[0];
531 expect(t.element, same(tElement)); 543 expect(t.element, same(tElement));
532 } 544 }
533 } 545 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698