| 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 library analyzer.test.generated.resolver_test_case; | 5 library analyzer.test.generated.resolver_test_case; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 verify([source]); | 468 verify([source]); |
| 469 } | 469 } |
| 470 | 470 |
| 471 /** | 471 /** |
| 472 * @param code the code that assigns the value to the variable "v", no matter
how. We check that | 472 * @param code the code that assigns the value to the variable "v", no matter
how. We check that |
| 473 * "v" has expected static and propagated type. | 473 * "v" has expected static and propagated type. |
| 474 */ | 474 */ |
| 475 Future<Null> assertPropagatedAssignedType(String code, | 475 Future<Null> assertPropagatedAssignedType(String code, |
| 476 DartType expectedStaticType, DartType expectedPropagatedType) async { | 476 DartType expectedStaticType, DartType expectedPropagatedType) async { |
| 477 SimpleIdentifier identifier = await findMarkedIdentifier(code, "v = "); | 477 SimpleIdentifier identifier = await findMarkedIdentifier(code, "v = "); |
| 478 expect(identifier.staticType, same(expectedStaticType)); | 478 expect(identifier.staticType, expectedStaticType); |
| 479 expect(identifier.propagatedType, same(expectedPropagatedType)); | 479 expect(identifier.propagatedType, expectedPropagatedType); |
| 480 } | 480 } |
| 481 | 481 |
| 482 /** | 482 /** |
| 483 * @param code the code that iterates using variable "v". We check that | 483 * @param code the code that iterates using variable "v". We check that |
| 484 * "v" has expected static and propagated type. | 484 * "v" has expected static and propagated type. |
| 485 */ | 485 */ |
| 486 Future<Null> assertPropagatedIterationType(String code, | 486 Future<Null> assertPropagatedIterationType(String code, |
| 487 DartType expectedStaticType, DartType expectedPropagatedType) async { | 487 DartType expectedStaticType, DartType expectedPropagatedType) async { |
| 488 SimpleIdentifier identifier = await findMarkedIdentifier(code, "v in "); | 488 SimpleIdentifier identifier = await findMarkedIdentifier(code, "v in "); |
| 489 expect(identifier.staticType, same(expectedStaticType)); | 489 expect(identifier.staticType, expectedStaticType); |
| 490 expect(identifier.propagatedType, same(expectedPropagatedType)); | 490 expect(identifier.propagatedType, expectedPropagatedType); |
| 491 } | 491 } |
| 492 | 492 |
| 493 /** | 493 /** |
| 494 * Check the static and propagated types of the expression marked with "; // m
arker" comment. | 494 * Check the static and propagated types of the expression marked with "; // m
arker" comment. |
| 495 * | 495 * |
| 496 * @param code source code to analyze, with the expression to check marked wit
h "// marker". | 496 * @param code source code to analyze, with the expression to check marked wit
h "// marker". |
| 497 * @param expectedStaticType if non-null, check actual static type is equal to
this. | 497 * @param expectedStaticType if non-null, check actual static type is equal to
this. |
| 498 * @param expectedPropagatedType if non-null, check actual static type is equa
l to this. | 498 * @param expectedPropagatedType if non-null, check actual static type is equa
l to this. |
| 499 * @throws Exception | 499 * @throws Exception |
| 500 */ | 500 */ |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 } | 936 } |
| 937 } | 937 } |
| 938 } | 938 } |
| 939 | 939 |
| 940 class TestAnalysisResult { | 940 class TestAnalysisResult { |
| 941 final Source source; | 941 final Source source; |
| 942 final CompilationUnit unit; | 942 final CompilationUnit unit; |
| 943 final List<AnalysisError> errors; | 943 final List<AnalysisError> errors; |
| 944 TestAnalysisResult(this.source, this.unit, this.errors); | 944 TestAnalysisResult(this.source, this.unit, this.errors); |
| 945 } | 945 } |
| OLD | NEW |