OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |