| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analyzer/dart/element/type.dart'; | 5 import 'package:analyzer/dart/element/type.dart'; |
| 6 import 'package:analyzer/src/summary/format.dart'; | 6 import 'package:analyzer/src/summary/format.dart'; |
| 7 import 'package:analyzer/src/summary/link.dart'; | 7 import 'package:analyzer/src/summary/link.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 linker | 447 linker |
| 448 .getLibrary(linkerInputs.testDartUri) | 448 .getLibrary(linkerInputs.testDartUri) |
| 449 .getContainedName('b') | 449 .getContainedName('b') |
| 450 .asTypeInferenceNode | 450 .asTypeInferenceNode |
| 451 .variableElement | 451 .variableElement |
| 452 .inferredType | 452 .inferredType |
| 453 .toString(), | 453 .toString(), |
| 454 'int'); | 454 'int'); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void test_leastUpperBound_functionAndClass() { |
| 458 createLinker(''' |
| 459 class C {} |
| 460 void f() {} |
| 461 var x = { |
| 462 'C': C, |
| 463 'f': f |
| 464 }; |
| 465 '''); |
| 466 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
| 467 library.libraryCycleForLink.ensureLinked(); |
| 468 // No assertions--just make sure it doesn't crash. |
| 469 } |
| 470 |
| 457 void test_libraryCycle_ignoresDependenciesOutsideBuildUnit() { | 471 void test_libraryCycle_ignoresDependenciesOutsideBuildUnit() { |
| 458 createLinker('import "dart:async";'); | 472 createLinker('import "dart:async";'); |
| 459 LibraryCycleForLink libraryCycle = testLibrary.libraryCycleForLink; | 473 LibraryCycleForLink libraryCycle = testLibrary.libraryCycleForLink; |
| 460 expect(libraryCycle.dependencies, isEmpty); | 474 expect(libraryCycle.dependencies, isEmpty); |
| 461 expect(libraryCycle.libraries, [testLibrary]); | 475 expect(libraryCycle.libraries, [testLibrary]); |
| 462 } | 476 } |
| 463 | 477 |
| 464 void test_libraryCycle_linkEnsuresDependenciesLinked() { | 478 void test_libraryCycle_linkEnsuresDependenciesLinked() { |
| 465 addNamedSource('/a.dart', 'import "b.dart";'); | 479 addNamedSource('/a.dart', 'import "b.dart";'); |
| 466 addNamedSource('/b.dart', ''); | 480 addNamedSource('/b.dart', ''); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 ParameterElementForLink g = f.parameters[0]; | 591 ParameterElementForLink g = f.parameters[0]; |
| 578 FunctionType gType = g.type; | 592 FunctionType gType = g.type; |
| 579 FunctionElementForLink_FunctionTypedParam gTypeElement = gType.element; | 593 FunctionElementForLink_FunctionTypedParam gTypeElement = gType.element; |
| 580 expect(gTypeElement.innermostExecutable, same(f)); | 594 expect(gTypeElement.innermostExecutable, same(f)); |
| 581 ParameterElementForLink h = gTypeElement.parameters[0]; | 595 ParameterElementForLink h = gTypeElement.parameters[0]; |
| 582 FunctionType hType = h.type; | 596 FunctionType hType = h.type; |
| 583 FunctionElementForLink_FunctionTypedParam hTypeElement = hType.element; | 597 FunctionElementForLink_FunctionTypedParam hTypeElement = hType.element; |
| 584 expect(hTypeElement.innermostExecutable, same(f)); | 598 expect(hTypeElement.innermostExecutable, same(f)); |
| 585 } | 599 } |
| 586 } | 600 } |
| OLD | NEW |