OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
8 import 'package:analyzer/src/dart/analysis/driver.dart'; | 8 import 'package:analyzer/src/dart/analysis/driver.dart'; |
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
10 | 10 |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 '''); | 794 '''); |
795 checkElementText( | 795 checkElementText( |
796 library, | 796 library, |
797 r''' | 797 r''' |
798 dynamic d; | 798 dynamic d; |
799 String s; | 799 String s; |
800 dynamic h/*error: instanceGetter*/; | 800 dynamic h/*error: instanceGetter*/; |
801 '''); | 801 '''); |
802 } | 802 } |
803 | 803 |
| 804 test_initializer_error_methodInvocation_cycle_topLevel() async { |
| 805 var library = await _encodeDecodeLibrary(r''' |
| 806 var a = b.foo(); |
| 807 var b = a.foo(); |
| 808 '''); |
| 809 checkElementText( |
| 810 library, |
| 811 r''' |
| 812 dynamic a/*error: dependencyCycle*/; |
| 813 dynamic b/*error: dependencyCycle*/; |
| 814 '''); |
| 815 } |
| 816 |
| 817 test_initializer_error_methodInvocation_cycle_topLevel_self() async { |
| 818 var library = await _encodeDecodeLibrary(r''' |
| 819 var a = a.foo(); |
| 820 '''); |
| 821 checkElementText( |
| 822 library, |
| 823 r''' |
| 824 dynamic a/*error: dependencyCycle*/; |
| 825 '''); |
| 826 } |
| 827 |
804 test_initializer_error_referenceToFieldOfStaticField() async { | 828 test_initializer_error_referenceToFieldOfStaticField() async { |
805 var library = await _encodeDecodeLibrary(r''' | 829 var library = await _encodeDecodeLibrary(r''' |
806 class C { | 830 class C { |
807 static D d; | 831 static D d; |
808 } | 832 } |
809 class D { | 833 class D { |
810 int i; | 834 int i; |
811 } | 835 } |
812 final x = C.d.i; | 836 final x = C.d.i; |
813 '''); | 837 '''); |
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 | 2724 |
2701 Future<LibraryElement> _encodeDecodeLibrary(String text) async { | 2725 Future<LibraryElement> _encodeDecodeLibrary(String text) async { |
2702 String path = _p('/test.dart'); | 2726 String path = _p('/test.dart'); |
2703 provider.newFile(path, text); | 2727 provider.newFile(path, text); |
2704 UnitElementResult result = await driver.getUnitElement(path); | 2728 UnitElementResult result = await driver.getUnitElement(path); |
2705 return result.element.library; | 2729 return result.element.library; |
2706 } | 2730 } |
2707 | 2731 |
2708 String _p(String path) => provider.convertPath(path); | 2732 String _p(String path) => provider.convertPath(path); |
2709 } | 2733 } |
OLD | NEW |