| 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 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/error/error.dart'; | 11 import 'package:analyzer/error/error.dart'; |
| 12 import 'package:analyzer/file_system/memory_file_system.dart'; | 12 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 13 import 'package:analyzer/file_system/physical_file_system.dart'; | |
| 14 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
| 15 import 'package:analyzer/src/dart/element/type.dart'; | 14 import 'package:analyzer/src/dart/element/type.dart'; |
| 16 import 'package:analyzer/src/error/codes.dart'; | 15 import 'package:analyzer/src/error/codes.dart'; |
| 17 import 'package:analyzer/src/generated/engine.dart'; | 16 import 'package:analyzer/src/generated/engine.dart'; |
| 18 import 'package:analyzer/src/generated/java_engine.dart'; | 17 import 'package:analyzer/src/generated/java_engine.dart'; |
| 19 import 'package:analyzer/src/generated/resolver.dart'; | 18 import 'package:analyzer/src/generated/resolver.dart'; |
| 20 import 'package:analyzer/src/generated/source_io.dart'; | 19 import 'package:analyzer/src/generated/source_io.dart'; |
| 21 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 20 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 22 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 21 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 23 import 'package:unittest/unittest.dart'; | 22 import 'package:unittest/unittest.dart'; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 expect(identifier.staticType, expectedStaticType); | 473 expect(identifier.staticType, expectedStaticType); |
| 475 } | 474 } |
| 476 expect(identifier.propagatedType, expectedPropagatedType); | 475 expect(identifier.propagatedType, expectedPropagatedType); |
| 477 } | 476 } |
| 478 | 477 |
| 479 /** | 478 /** |
| 480 * Cache the [contents] for the file at the given [filePath] but don't add the | 479 * Cache the [contents] for the file at the given [filePath] but don't add the |
| 481 * source to the analysis context. The file path must be absolute. | 480 * source to the analysis context. The file path must be absolute. |
| 482 */ | 481 */ |
| 483 Source cacheSource(String filePath, String contents) { | 482 Source cacheSource(String filePath, String contents) { |
| 484 Source source = | 483 Source source = resourceProvider.getFile(filePath).createSource(); |
| 485 PhysicalResourceProvider.INSTANCE.getFile(filePath).createSource(); | |
| 486 analysisContext2.setContents(source, contents); | 484 analysisContext2.setContents(source, contents); |
| 487 return source; | 485 return source; |
| 488 } | 486 } |
| 489 | 487 |
| 490 /** | 488 /** |
| 491 * Change the contents of the given [source] to the given [contents]. | 489 * Change the contents of the given [source] to the given [contents]. |
| 492 */ | 490 */ |
| 493 void changeSource(Source source, String contents) { | 491 void changeSource(Source source, String contents) { |
| 494 analysisContext2.setContents(source, contents); | 492 analysisContext2.setContents(source, contents); |
| 495 ChangeSet changeSet = new ChangeSet(); | 493 ChangeSet changeSet = new ChangeSet(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 513 * @return the library element that was created | 511 * @return the library element that was created |
| 514 */ | 512 */ |
| 515 LibraryElementImpl createDefaultTestLibrary() => | 513 LibraryElementImpl createDefaultTestLibrary() => |
| 516 createTestLibrary(AnalysisContextFactory.contextWithCore(), "test"); | 514 createTestLibrary(AnalysisContextFactory.contextWithCore(), "test"); |
| 517 | 515 |
| 518 /** | 516 /** |
| 519 * Create a source object representing a file with the given [fileName] and | 517 * Create a source object representing a file with the given [fileName] and |
| 520 * give it an empty content. Return the source that was created. | 518 * give it an empty content. Return the source that was created. |
| 521 */ | 519 */ |
| 522 Source createNamedSource(String fileName) { | 520 Source createNamedSource(String fileName) { |
| 523 Source source = | 521 Source source = resourceProvider.getFile(fileName).createSource(); |
| 524 PhysicalResourceProvider.INSTANCE.getFile(fileName).createSource(); | |
| 525 analysisContext2.setContents(source, ''); | 522 analysisContext2.setContents(source, ''); |
| 526 return source; | 523 return source; |
| 527 } | 524 } |
| 528 | 525 |
| 529 /** | 526 /** |
| 530 * Create a library element that represents a library with the given name cont
aining a single | 527 * Create a library element that represents a library with the given name cont
aining a single |
| 531 * empty compilation unit. | 528 * empty compilation unit. |
| 532 * | 529 * |
| 533 * @param libraryName the name of the library to be created | 530 * @param libraryName the name of the library to be created |
| 534 * @return the library element that was created | 531 * @return the library element that was created |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. | 835 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. |
| 839 */ | 836 */ |
| 840 _expectType(DartType type, expected) { | 837 _expectType(DartType type, expected) { |
| 841 if (expected is String) { | 838 if (expected is String) { |
| 842 expect(type.toString(), expected); | 839 expect(type.toString(), expected); |
| 843 } else { | 840 } else { |
| 844 expect(type, expected); | 841 expect(type, expected); |
| 845 } | 842 } |
| 846 } | 843 } |
| 847 } | 844 } |
| OLD | NEW |