| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.declaration_resolver_test; | 5 library engine.declaration_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/dart/ast/ast.dart'; | 9 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 main(List<String> items) { | 307 main(List<String> items) { |
| 308 items.forEach((item) {}); | 308 items.forEach((item) {}); |
| 309 } | 309 } |
| 310 '''; | 310 '''; |
| 311 CompilationUnit unit = resolveSource(code); | 311 CompilationUnit unit = resolveSource(code); |
| 312 // re-resolve | 312 // re-resolve |
| 313 _cloneResolveUnit(unit); | 313 _cloneResolveUnit(unit); |
| 314 // no other validations than built into DeclarationResolver | 314 // no other validations than built into DeclarationResolver |
| 315 } | 315 } |
| 316 | 316 |
| 317 void test_visitMethodDeclaration_unaryMinus() { |
| 318 String code = r''' |
| 319 class C { |
| 320 C operator -() => null; |
| 321 C operator -(C other) => null; |
| 322 } |
| 323 '''; |
| 324 CompilationUnit unit = resolveSource(code); |
| 325 // re-resolve |
| 326 _cloneResolveUnit(unit); |
| 327 // no other validations than built into DeclarationResolver |
| 328 } |
| 329 |
| 317 void test_visitMethodDeclaration_getter_duplicate() { | 330 void test_visitMethodDeclaration_getter_duplicate() { |
| 318 String code = r''' | 331 String code = r''' |
| 319 class C { | 332 class C { |
| 320 int get zzz => 1; | 333 int get zzz => 1; |
| 321 String get zzz => null; | 334 String get zzz => null; |
| 322 } | 335 } |
| 323 '''; | 336 '''; |
| 324 CompilationUnit unit = resolveSource(code); | 337 CompilationUnit unit = resolveSource(code); |
| 325 PropertyAccessorElement firstElement = | 338 PropertyAccessorElement firstElement = |
| 326 _findSimpleIdentifier(unit, code, 'zzz => 1').staticElement; | 339 _findSimpleIdentifier(unit, code, 'zzz => 1').staticElement; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 expect(element.type.toString(), "<T>(T, T) → T"); | 460 expect(element.type.toString(), "<T>(T, T) → T"); |
| 448 expect(t.element, same(tElement)); | 461 expect(t.element, same(tElement)); |
| 449 | 462 |
| 450 // re-resolve | 463 // re-resolve |
| 451 CompilationUnit unit2 = _cloneResolveUnit(unit); | 464 CompilationUnit unit2 = _cloneResolveUnit(unit); |
| 452 node = _findSimpleIdentifier(unit2, code, 'max').parent; | 465 node = _findSimpleIdentifier(unit2, code, 'max').parent; |
| 453 t = node.typeParameters.typeParameters[0]; | 466 t = node.typeParameters.typeParameters[0]; |
| 454 expect(t.element, same(tElement)); | 467 expect(t.element, same(tElement)); |
| 455 } | 468 } |
| 456 } | 469 } |
| OLD | NEW |