Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.test.generated.incremental_resolver_test; | 5 library analyzer.test.generated.incremental_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/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| (...skipping 3785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3796 } | 3796 } |
| 3797 '''); | 3797 '''); |
| 3798 _updateAndValidate(r''' | 3798 _updateAndValidate(r''' |
| 3799 main() { | 3799 main() { |
| 3800 // edited comment text | 3800 // edited comment text |
| 3801 print(0); | 3801 print(0); |
| 3802 } | 3802 } |
| 3803 '''); | 3803 '''); |
| 3804 } | 3804 } |
| 3805 | 3805 |
| 3806 void test_endOfLineComment_localFunction_inTopLevelVariable() { | |
| 3807 _resolveUnit(r''' | |
| 3808 typedef int Binary(one, two, three); | |
| 3809 | |
| 3810 int Global = f((a, b, c) { | |
| 3811 return 0; // Some comment | |
| 3812 }); | |
| 3813 '''); | |
| 3814 _updateAndValidate(r''' | |
| 3815 typedef int Binary(one, two, three); | |
| 3816 | |
| 3817 int Global = f((a, b, c) { | |
| 3818 return 0; // Some comment | |
| 3819 }); | |
| 3820 '''); | |
| 3821 } | |
| 3822 | |
| 3823 void test_endOfLineComment_outBody_add() { | 3806 void test_endOfLineComment_outBody_add() { |
| 3824 _resolveUnit(r''' | 3807 _resolveUnit(r''' |
| 3825 main() { | 3808 main() { |
| 3826 Object x; | 3809 Object x; |
| 3827 x.foo(); | 3810 x.foo(); |
| 3828 } | 3811 } |
| 3829 '''); | 3812 '''); |
| 3830 _updateAndValidate( | 3813 _updateAndValidate( |
| 3831 r''' | 3814 r''' |
| 3832 // 000 | 3815 // 000 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3926 const C(this.x); | 3909 const C(this.x); |
| 3927 const C.foo() : x = 1; | 3910 const C.foo() : x = 1; |
| 3928 } | 3911 } |
| 3929 main() { | 3912 main() { |
| 3930 const {const C(0): 0, const C.foo(): 1}; | 3913 const {const C(0): 0, const C.foo(): 1}; |
| 3931 } | 3914 } |
| 3932 ''', | 3915 ''', |
| 3933 expectedSuccess: false); | 3916 expectedSuccess: false); |
| 3934 } | 3917 } |
| 3935 | 3918 |
| 3919 void test_false_constructor_initializer() { | |
|
Brian Wilkerson
2016/01/20 14:53:56
Given the number of new cases that appear to have
| |
| 3920 _resolveUnit(r''' | |
| 3921 class Problem { | |
| 3922 final Map location; | |
| 3923 final String message; | |
| 3924 | |
| 3925 Problem(Map json) | |
| 3926 : location = json["location"], | |
| 3927 message = json["message"]; | |
| 3928 }'''); | |
| 3929 _updateAndValidate( | |
| 3930 r''' | |
| 3931 class Problem { | |
| 3932 final Map location; | |
| 3933 final String message; | |
| 3934 | |
| 3935 Problem(Map json) | |
| 3936 : location = json["location], | |
| 3937 message = json["message"]; | |
| 3938 }''', | |
| 3939 expectedSuccess: false); | |
| 3940 } | |
| 3941 | |
| 3942 void test_false_endOfLineComment_localFunction_inTopLevelVariable() { | |
| 3943 _resolveUnit(r''' | |
| 3944 typedef int Binary(one, two, three); | |
| 3945 | |
| 3946 int Global = f((a, b, c) { | |
| 3947 return 0; // Some comment | |
| 3948 }); | |
| 3949 '''); | |
| 3950 _updateAndValidate( | |
| 3951 r''' | |
| 3952 typedef int Binary(one, two, three); | |
| 3953 | |
| 3954 int Global = f((a, b, c) { | |
| 3955 return 0; // Some comment | |
| 3956 }); | |
| 3957 ''', | |
| 3958 expectedSuccess: false); | |
| 3959 } | |
| 3960 | |
| 3936 void test_false_expressionBody() { | 3961 void test_false_expressionBody() { |
| 3937 _resolveUnit(r''' | 3962 _resolveUnit(r''' |
| 3938 class A { | 3963 class A { |
| 3939 final f = (() => 1)(); | 3964 final f = (() => 1)(); |
| 3940 } | 3965 } |
| 3941 '''); | 3966 '''); |
| 3942 _updateAndValidate( | 3967 _updateAndValidate( |
| 3943 r''' | 3968 r''' |
| 3944 class A { | 3969 class A { |
| 3945 final f = (() => 2)(); | 3970 final f = (() => 2)(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3956 '''); | 3981 '''); |
| 3957 _updateAndValidate( | 3982 _updateAndValidate( |
| 3958 r''' | 3983 r''' |
| 3959 class A { | 3984 class A { |
| 3960 int m() => 10 * 100; | 3985 int m() => 10 * 100; |
| 3961 } | 3986 } |
| 3962 ''', | 3987 ''', |
| 3963 expectedSuccess: false); | 3988 expectedSuccess: false); |
| 3964 } | 3989 } |
| 3965 | 3990 |
| 3991 void test_false_inBody_functionExpression() { | |
| 3992 _resolveUnit(r''' | |
| 3993 class C extends D { | |
| 3994 static final f = () { | |
| 3995 var x = 0; | |
| 3996 }(); | |
| 3997 } | |
| 3998 | |
| 3999 class D {} | |
| 4000 '''); | |
| 4001 _updateAndValidate( | |
| 4002 r''' | |
| 4003 class C extends D { | |
| 4004 static final f = () { | |
| 4005 var x = 01; | |
| 4006 }(); | |
| 4007 } | |
| 4008 | |
| 4009 class D {} | |
| 4010 ''', | |
| 4011 expectedSuccess: false); | |
| 4012 } | |
| 4013 | |
| 3966 void test_false_topLevelFunction_name() { | 4014 void test_false_topLevelFunction_name() { |
| 3967 _resolveUnit(r''' | 4015 _resolveUnit(r''' |
| 3968 a() {} | 4016 a() {} |
| 3969 b() {} | 4017 b() {} |
| 3970 '''); | 4018 '''); |
| 3971 _updateAndValidate( | 4019 _updateAndValidate( |
| 3972 r''' | 4020 r''' |
| 3973 a() {} | 4021 a() {} |
| 3974 bb() {} | 4022 bb() {} |
| 3975 ''', | 4023 ''', |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4075 '''); | 4123 '''); |
| 4076 _updateAndValidate(r''' | 4124 _updateAndValidate(r''' |
| 4077 class A { | 4125 class A { |
| 4078 m() { | 4126 m() { |
| 4079 print(2 + 3); | 4127 print(2 + 3); |
| 4080 } | 4128 } |
| 4081 } | 4129 } |
| 4082 '''); | 4130 '''); |
| 4083 } | 4131 } |
| 4084 | 4132 |
| 4085 void test_inBody_functionExpression() { | |
| 4086 _resolveUnit(r''' | |
| 4087 class C extends D { | |
| 4088 static final f = () { | |
| 4089 var x = 0; | |
| 4090 }(); | |
| 4091 } | |
| 4092 | |
| 4093 class D {} | |
| 4094 '''); | |
| 4095 _updateAndValidate(r''' | |
| 4096 class C extends D { | |
| 4097 static final f = () { | |
| 4098 var x = 01; | |
| 4099 }(); | |
| 4100 } | |
| 4101 | |
| 4102 class D {} | |
| 4103 '''); | |
| 4104 } | |
| 4105 | |
| 4106 void test_inBody_insertStatement() { | 4133 void test_inBody_insertStatement() { |
| 4107 _resolveUnit(r''' | 4134 _resolveUnit(r''' |
| 4108 main() { | 4135 main() { |
| 4109 print(1); | 4136 print(1); |
| 4110 } | 4137 } |
| 4111 '''); | 4138 '''); |
| 4112 _updateAndValidate(r''' | 4139 _updateAndValidate(r''' |
| 4113 main() { | 4140 main() { |
| 4114 print(0); | 4141 print(0); |
| 4115 print(1); | 4142 print(1); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5075 @override | 5102 @override |
| 5076 void logException(Object exception, [Object stackTrace]) { | 5103 void logException(Object exception, [Object stackTrace]) { |
| 5077 hasError = true; | 5104 hasError = true; |
| 5078 } | 5105 } |
| 5079 | 5106 |
| 5080 @override | 5107 @override |
| 5081 logging.LoggingTimer startTimer() { | 5108 logging.LoggingTimer startTimer() { |
| 5082 return new logging.LoggingTimer(this); | 5109 return new logging.LoggingTimer(this); |
| 5083 } | 5110 } |
| 5084 } | 5111 } |
| OLD | NEW |