| 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/dart/element/element.dart'; |
| 6 import 'package:analyzer/src/summary/format.dart'; | 7 import 'package:analyzer/src/summary/format.dart'; |
| 7 import 'package:analyzer/src/summary/link.dart'; | 8 import 'package:analyzer/src/summary/link.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 9 | 10 |
| 10 import '../../reflective_tests.dart'; | 11 import '../../reflective_tests.dart'; |
| 11 import 'summarize_ast_test.dart'; | 12 import 'summarize_ast_test.dart'; |
| 12 | 13 |
| 13 main() { | 14 main() { |
| 14 groupSep = ' | '; | 15 groupSep = ' | '; |
| 15 runReflectiveTests(LinkerUnitTest); | 16 runReflectiveTests(LinkerUnitTest); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 createLinker('var x;'); | 677 createLinker('var x;'); |
| 677 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); | 678 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
| 678 PropertyAccessorElementForLink_Variable x = library.getContainedName('x'); | 679 PropertyAccessorElementForLink_Variable x = library.getContainedName('x'); |
| 679 expect(x.isStatic, true); | 680 expect(x.isStatic, true); |
| 680 expect(x.variable.isStatic, true); | 681 expect(x.variable.isStatic, true); |
| 681 } | 682 } |
| 682 | 683 |
| 683 void test_typeParameter_isTypeParameterInScope_direct() { | 684 void test_typeParameter_isTypeParameterInScope_direct() { |
| 684 createLinker('class C<T, U> {}'); | 685 createLinker('class C<T, U> {}'); |
| 685 ClassElementForLink_Class c = testLibrary.getContainedName('C'); | 686 ClassElementForLink_Class c = testLibrary.getContainedName('C'); |
| 686 TypeParameterElementForLink t = c.typeParameters[0]; | 687 TypeParameterElementImpl t = c.typeParameters[0]; |
| 687 TypeParameterElementForLink u = c.typeParameters[1]; | 688 TypeParameterElementImpl u = c.typeParameters[1]; |
| 688 expect(c.isTypeParameterInScope(t), true); | 689 expect(c.isTypeParameterInScope(t), true); |
| 689 expect(c.isTypeParameterInScope(u), true); | 690 expect(c.isTypeParameterInScope(u), true); |
| 690 } | 691 } |
| 691 | 692 |
| 692 void test_typeParameter_isTypeParameterInScope_indirect() { | 693 void test_typeParameter_isTypeParameterInScope_indirect() { |
| 693 createLinker('class C<T, U> { f<V, W>() {} }'); | 694 createLinker('class C<T, U> { f<V, W>() {} }'); |
| 694 ClassElementForLink_Class c = testLibrary.getContainedName('C'); | 695 ClassElementForLink_Class c = testLibrary.getContainedName('C'); |
| 695 MethodElementForLink f = c.methods[0]; | 696 MethodElementForLink f = c.methods[0]; |
| 696 TypeParameterElementForLink t = c.typeParameters[0]; | 697 TypeParameterElementImpl t = c.typeParameters[0]; |
| 697 TypeParameterElementForLink u = c.typeParameters[1]; | 698 TypeParameterElementImpl u = c.typeParameters[1]; |
| 698 expect(f.isTypeParameterInScope(t), true); | 699 expect(f.isTypeParameterInScope(t), true); |
| 699 expect(f.isTypeParameterInScope(u), true); | 700 expect(f.isTypeParameterInScope(u), true); |
| 700 } | 701 } |
| 701 | 702 |
| 702 void test_typeParameter_isTypeParameterInScope_reversed() { | 703 void test_typeParameter_isTypeParameterInScope_reversed() { |
| 703 createLinker('class C<T, U> { f<V, W>() {} }'); | 704 createLinker('class C<T, U> { f<V, W>() {} }'); |
| 704 ClassElementForLink_Class c = testLibrary.getContainedName('C'); | 705 ClassElementForLink_Class c = testLibrary.getContainedName('C'); |
| 705 MethodElementForLink f = c.methods[0]; | 706 MethodElementForLink f = c.methods[0]; |
| 706 TypeParameterElementForLink v = f.typeParameters[0]; | 707 TypeParameterElementImpl v = f.typeParameters[0]; |
| 707 TypeParameterElementForLink w = f.typeParameters[1]; | 708 TypeParameterElementImpl w = f.typeParameters[1]; |
| 708 expect(c.isTypeParameterInScope(v), false); | 709 expect(c.isTypeParameterInScope(v), false); |
| 709 expect(c.isTypeParameterInScope(w), false); | 710 expect(c.isTypeParameterInScope(w), false); |
| 710 } | 711 } |
| 711 | 712 |
| 712 void test_typeParameter_isTypeParameterInScope_unrelated() { | 713 void test_typeParameter_isTypeParameterInScope_unrelated() { |
| 713 createLinker('class C<T, U> {} class D<V, W> {}'); | 714 createLinker('class C<T, U> {} class D<V, W> {}'); |
| 714 ClassElementForLink_Class c = testLibrary.getContainedName('C'); | 715 ClassElementForLink_Class c = testLibrary.getContainedName('C'); |
| 715 ClassElementForLink_Class d = testLibrary.getContainedName('D'); | 716 ClassElementForLink_Class d = testLibrary.getContainedName('D'); |
| 716 TypeParameterElementForLink t = c.typeParameters[0]; | 717 TypeParameterElementImpl t = c.typeParameters[0]; |
| 717 TypeParameterElementForLink u = c.typeParameters[1]; | 718 TypeParameterElementImpl u = c.typeParameters[1]; |
| 718 TypeParameterElementForLink v = d.typeParameters[0]; | 719 TypeParameterElementImpl v = d.typeParameters[0]; |
| 719 TypeParameterElementForLink w = d.typeParameters[1]; | 720 TypeParameterElementImpl w = d.typeParameters[1]; |
| 720 expect(c.isTypeParameterInScope(v), false); | 721 expect(c.isTypeParameterInScope(v), false); |
| 721 expect(c.isTypeParameterInScope(w), false); | 722 expect(c.isTypeParameterInScope(w), false); |
| 722 expect(d.isTypeParameterInScope(t), false); | 723 expect(d.isTypeParameterInScope(t), false); |
| 723 expect(d.isTypeParameterInScope(u), false); | 724 expect(d.isTypeParameterInScope(u), false); |
| 724 } | 725 } |
| 725 } | 726 } |
| OLD | NEW |