| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 void test_enumConstant_partiallyResolved() { | 261 void test_enumConstant_partiallyResolved() { |
| 262 String code = r''' | 262 String code = r''' |
| 263 enum Fruit {apple, pear} | 263 enum Fruit {apple, pear} |
| 264 '''; | 264 '''; |
| 265 Source source = addNamedSource('/test.dart', code); | 265 Source source = addNamedSource('/test.dart', code); |
| 266 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 266 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 267 analysisContext.computeResult(source, LIBRARY_ELEMENT1); | 267 analysisContext.computeResult(source, LIBRARY_ELEMENT1); |
| 268 CompilationUnit unit = | 268 CompilationUnit unit = |
| 269 analysisContext.computeResult(target, RESOLVED_UNIT1); | 269 analysisContext.computeResult(target, RESOLVED_UNIT1); |
| 270 CompilationUnit unit2 = _cloneResolveUnit(unit); | 270 _cloneResolveUnit(unit); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void test_functionDeclaration_getter() { | 273 void test_functionDeclaration_getter() { |
| 274 String code = r''' | 274 String code = r''' |
| 275 int get zzz => 42; | 275 int get zzz => 42; |
| 276 '''; | 276 '''; |
| 277 CompilationUnit unit = resolveSource(code); | 277 CompilationUnit unit = resolveSource(code); |
| 278 PropertyAccessorElement getterElement = | 278 PropertyAccessorElement getterElement = |
| 279 _findSimpleIdentifier(unit, code, 'zzz =>').staticElement; | 279 _findSimpleIdentifier(unit, code, 'zzz =>').staticElement; |
| 280 expect(getterElement.isGetter, isTrue); | 280 expect(getterElement.isGetter, isTrue); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 expect(element.type.toString(), "<T>(T, T) → T"); | 536 expect(element.type.toString(), "<T>(T, T) → T"); |
| 537 expect(t.element, same(tElement)); | 537 expect(t.element, same(tElement)); |
| 538 | 538 |
| 539 // re-resolve | 539 // re-resolve |
| 540 CompilationUnit unit2 = _cloneResolveUnit(unit); | 540 CompilationUnit unit2 = _cloneResolveUnit(unit); |
| 541 node = _findSimpleIdentifier(unit2, code, 'max').parent; | 541 node = _findSimpleIdentifier(unit2, code, 'max').parent; |
| 542 t = node.typeParameters.typeParameters[0]; | 542 t = node.typeParameters.typeParameters[0]; |
| 543 expect(t.element, same(tElement)); | 543 expect(t.element, same(tElement)); |
| 544 } | 544 } |
| 545 } | 545 } |
| OLD | NEW |