| 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/dart/element/element.dart'; |
| 7 import 'package:analyzer/src/summary/format.dart'; | 7 import 'package:analyzer/src/summary/format.dart'; |
| 8 import 'package:analyzer/src/summary/link.dart'; | 8 import 'package:analyzer/src/summary/link.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 ClassElementForLink_Class d = testLibrary.getContainedName('D'); | 716 ClassElementForLink_Class d = testLibrary.getContainedName('D'); |
| 717 TypeParameterElementImpl t = c.typeParameters[0]; | 717 TypeParameterElementImpl t = c.typeParameters[0]; |
| 718 TypeParameterElementImpl u = c.typeParameters[1]; | 718 TypeParameterElementImpl u = c.typeParameters[1]; |
| 719 TypeParameterElementImpl v = d.typeParameters[0]; | 719 TypeParameterElementImpl v = d.typeParameters[0]; |
| 720 TypeParameterElementImpl w = d.typeParameters[1]; | 720 TypeParameterElementImpl w = d.typeParameters[1]; |
| 721 expect(c.isTypeParameterInScope(v), false); | 721 expect(c.isTypeParameterInScope(v), false); |
| 722 expect(c.isTypeParameterInScope(w), false); | 722 expect(c.isTypeParameterInScope(w), false); |
| 723 expect(d.isTypeParameterInScope(t), false); | 723 expect(d.isTypeParameterInScope(t), false); |
| 724 expect(d.isTypeParameterInScope(u), false); | 724 expect(d.isTypeParameterInScope(u), false); |
| 725 } | 725 } |
| 726 |
| 727 void test_variable_initializer_presence() { |
| 728 // Any variable declaration with an initializer should have a non-null value |
| 729 // for `initializer`, regardless of whether it is constant and regardless of |
| 730 // whether it has an explicit type. |
| 731 createLinker(''' |
| 732 const int c = 0; |
| 733 int i = 0; |
| 734 int j; |
| 735 var v = 0; |
| 736 '''); |
| 737 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
| 738 PropertyAccessorElementForLink_Variable c = library.getContainedName('c'); |
| 739 expect(c.variable.initializer, isNotNull); |
| 740 PropertyAccessorElementForLink_Variable i = library.getContainedName('i'); |
| 741 expect(i.variable.initializer, isNotNull); |
| 742 PropertyAccessorElementForLink_Variable j = library.getContainedName('j'); |
| 743 expect(j.variable.initializer, isNull); |
| 744 PropertyAccessorElementForLink_Variable v = library.getContainedName('v'); |
| 745 expect(v.variable.initializer, isNotNull); |
| 746 } |
| 726 } | 747 } |
| OLD | NEW |