| 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 engine.non_error_resolver_test; | 5 library engine.non_error_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 F f; | 264 F f; |
| 265 main() { | 265 main() { |
| 266 F f2 = (() => f()); | 266 F f2 = (() => f()); |
| 267 } | 267 } |
| 268 '''); | 268 '''); |
| 269 resolve(source); | 269 resolve(source); |
| 270 assertNoErrors(source); | 270 assertNoErrors(source); |
| 271 verify([source]); | 271 verify([source]); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void test_assignment_to_field_with_same_name_as_prefix() { |
| 275 // If p is an import prefix, then within a method body, p = expr should be |
| 276 // considered equivalent to this.p = expr. |
| 277 addNamedSource("/lib.dart", r''' |
| 278 library lib; |
| 279 '''); |
| 280 Source source = addSource(r''' |
| 281 import 'lib.dart' as p; |
| 282 class Base { |
| 283 var p; |
| 284 } |
| 285 class Derived extends Base { |
| 286 f() { |
| 287 p = 0; |
| 288 } |
| 289 } |
| 290 '''); |
| 291 resolve(source); |
| 292 assertErrors(source, [HintCode.UNUSED_IMPORT]); |
| 293 verify([source]); |
| 294 } |
| 295 |
| 274 void test_assignmentToFinal_prefixNegate() { | 296 void test_assignmentToFinal_prefixNegate() { |
| 275 Source source = addSource(r''' | 297 Source source = addSource(r''' |
| 276 f() { | 298 f() { |
| 277 final x = 0; | 299 final x = 0; |
| 278 -x; | 300 -x; |
| 279 }'''); | 301 }'''); |
| 280 resolve(source); | 302 resolve(source); |
| 281 assertNoErrors(source); | 303 assertNoErrors(source); |
| 282 verify([source]); | 304 verify([source]); |
| 283 } | 305 } |
| (...skipping 4866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5150 class B extends A { | 5172 class B extends A { |
| 5151 f() { | 5173 f() { |
| 5152 super.m(); | 5174 super.m(); |
| 5153 } | 5175 } |
| 5154 }'''); | 5176 }'''); |
| 5155 resolve(source); | 5177 resolve(source); |
| 5156 assertNoErrors(source); | 5178 assertNoErrors(source); |
| 5157 verify([source]); | 5179 verify([source]); |
| 5158 } | 5180 } |
| 5159 | 5181 |
| 5182 void test_unqualified_invocation_of_method_with_same_name_as_prefix() { |
| 5183 // If p is an import prefix, then within a method body, p() should be |
| 5184 // considered equivalent to this.p(). |
| 5185 addNamedSource("/lib.dart", r''' |
| 5186 library lib; |
| 5187 '''); |
| 5188 Source source = addSource(r''' |
| 5189 import 'lib.dart' as p; |
| 5190 class Base { |
| 5191 p() {} |
| 5192 } |
| 5193 class Derived extends Base { |
| 5194 f() { |
| 5195 p(); |
| 5196 } |
| 5197 } |
| 5198 '''); |
| 5199 resolve(source); |
| 5200 assertErrors(source, [HintCode.UNUSED_IMPORT]); |
| 5201 verify([source]); |
| 5202 } |
| 5203 |
| 5160 void test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() { | 5204 void test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() { |
| 5161 Source source = addSource(r''' | 5205 Source source = addSource(r''' |
| 5162 class A { | 5206 class A { |
| 5163 A() {} | 5207 A() {} |
| 5164 A.named() {} | 5208 A.named() {} |
| 5165 } | 5209 } |
| 5166 /// [new A] or [new A.named] | 5210 /// [new A] or [new A.named] |
| 5167 main() { | 5211 main() { |
| 5168 }'''); | 5212 }'''); |
| 5169 resolve(source); | 5213 resolve(source); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 resolve(source); | 5547 resolve(source); |
| 5504 assertNoErrors(source); | 5548 assertNoErrors(source); |
| 5505 verify([source]); | 5549 verify([source]); |
| 5506 reset(); | 5550 reset(); |
| 5507 } | 5551 } |
| 5508 | 5552 |
| 5509 void _check_wrongNumberOfParametersForOperator1(String name) { | 5553 void _check_wrongNumberOfParametersForOperator1(String name) { |
| 5510 _check_wrongNumberOfParametersForOperator(name, "a"); | 5554 _check_wrongNumberOfParametersForOperator(name, "a"); |
| 5511 } | 5555 } |
| 5512 } | 5556 } |
| OLD | NEW |