| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:analyzer/src/summary/builder.dart'; | 12 import 'package:analyzer/src/summary/builder.dart'; |
| 12 import 'package:analyzer/src/summary/format.dart'; | 13 import 'package:analyzer/src/summary/format.dart'; |
| 13 import 'package:analyzer/src/summary/summarize_elements.dart' | 14 import 'package:analyzer/src/summary/summarize_elements.dart' |
| 14 as summarize_elements; | 15 as summarize_elements; |
| 15 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 16 | 17 |
| 17 import '../../generated/resolver_test.dart'; | 18 import '../../generated/resolver_test.dart'; |
| 18 import '../../reflective_tests.dart'; | 19 import '../../reflective_tests.dart'; |
| 19 | 20 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 * that summaries need, so that this flag is no longer needed. | 89 * that summaries need, so that this flag is no longer needed. |
| 89 */ | 90 */ |
| 90 bool get checkAstDerivedData; | 91 bool get checkAstDerivedData; |
| 91 | 92 |
| 92 /** | 93 /** |
| 93 * Get access to the "unlinked" section of the summary. | 94 * Get access to the "unlinked" section of the summary. |
| 94 */ | 95 */ |
| 95 UnlinkedLibrary get unlinked => lib.unlinked; | 96 UnlinkedLibrary get unlinked => lib.unlinked; |
| 96 | 97 |
| 97 /** | 98 /** |
| 99 * Convert [path] to a suitably formatted absolute path URI for the current |
| 100 * platform. |
| 101 */ |
| 102 String absUri(String path) { |
| 103 return FileUtilities2.createFile(path).toURI().toString(); |
| 104 } |
| 105 |
| 106 /** |
| 98 * Add the given source file so that it may be referenced by the file under | 107 * Add the given source file so that it may be referenced by the file under |
| 99 * test. | 108 * test. |
| 100 */ | 109 */ |
| 101 addNamedSource(String filePath, String contents); | 110 addNamedSource(String filePath, String contents); |
| 102 | 111 |
| 103 /** | 112 /** |
| 104 * Verify that the [combinatorName] correctly represents the given [expected] | 113 * Verify that the [combinatorName] correctly represents the given [expected] |
| 105 * name. | 114 * name. |
| 106 */ | 115 */ |
| 107 void checkCombinatorName( | 116 void checkCombinatorName( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 247 } |
| 239 | 248 |
| 240 fail_test_import_missing() { | 249 fail_test_import_missing() { |
| 241 // TODO(paulberry): At the moment unresolved imports are not included in | 250 // TODO(paulberry): At the moment unresolved imports are not included in |
| 242 // the element model, so we can't pass this test. | 251 // the element model, so we can't pass this test. |
| 243 // Unresolved imports are included since this is necessary for proper | 252 // Unresolved imports are included since this is necessary for proper |
| 244 // dependency tracking. | 253 // dependency tracking. |
| 245 serializeLibraryText('import "foo.dart";', allowErrors: true); | 254 serializeLibraryText('import "foo.dart";', allowErrors: true); |
| 246 // Second import is the implicit import of dart:core | 255 // Second import is the implicit import of dart:core |
| 247 expect(unlinked.imports, hasLength(2)); | 256 expect(unlinked.imports, hasLength(2)); |
| 248 checkDependency(lib.importDependencies[0], 'file:///foo.dart', 'foo.dart'); | 257 checkDependency(lib.importDependencies[0], absUri('/foo.dart'), 'foo.dart'); |
| 249 } | 258 } |
| 250 | 259 |
| 251 /** | 260 /** |
| 252 * Find the class with the given [className] in the summary, and return its | 261 * Find the class with the given [className] in the summary, and return its |
| 253 * [UnlinkedClass] data structure. | 262 * [UnlinkedClass] data structure. |
| 254 */ | 263 */ |
| 255 UnlinkedClass findClass(String className, {bool failIfAbsent: false}) { | 264 UnlinkedClass findClass(String className, {bool failIfAbsent: false}) { |
| 256 UnlinkedClass result; | 265 UnlinkedClass result; |
| 257 for (UnlinkedClass cls in unlinked.classes) { | 266 for (UnlinkedClass cls in unlinked.classes) { |
| 258 if (cls.name == className) { | 267 if (cls.name == className) { |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 checkParamTypeRef(typeRef, 1); | 781 checkParamTypeRef(typeRef, 1); |
| 773 } | 782 } |
| 774 } | 783 } |
| 775 | 784 |
| 776 test_dependencies_export_none() { | 785 test_dependencies_export_none() { |
| 777 // Exports are not listed as dependencies since no change to the exported | 786 // Exports are not listed as dependencies since no change to the exported |
| 778 // file can change the summary of the exporting file. | 787 // file can change the summary of the exporting file. |
| 779 addNamedSource('/a.dart', 'library a; export "b.dart";'); | 788 addNamedSource('/a.dart', 'library a; export "b.dart";'); |
| 780 addNamedSource('/b.dart', 'library b;'); | 789 addNamedSource('/b.dart', 'library b;'); |
| 781 serializeLibraryText('export "a.dart";'); | 790 serializeLibraryText('export "a.dart";'); |
| 782 checkLacksDependency('file:///a.dart', 'a.dart'); | 791 checkLacksDependency(absUri('/a.dart'), 'a.dart'); |
| 783 checkLacksDependency('file:///b.dart', 'b.dart'); | 792 checkLacksDependency(absUri('/b.dart'), 'b.dart'); |
| 784 } | 793 } |
| 785 | 794 |
| 786 test_dependencies_import_to_export() { | 795 test_dependencies_import_to_export() { |
| 787 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); | 796 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); |
| 788 addNamedSource('/b.dart', 'library b;'); | 797 addNamedSource('/b.dart', 'library b;'); |
| 789 serializeLibraryText('import "a.dart"; A a;'); | 798 serializeLibraryText('import "a.dart"; A a;'); |
| 790 checkHasDependency('file:///a.dart', 'a.dart'); | 799 checkHasDependency(absUri('/a.dart'), 'a.dart'); |
| 791 // The main test library depends on b.dart, because names defined in | 800 // The main test library depends on b.dart, because names defined in |
| 792 // b.dart are exported by a.dart. | 801 // b.dart are exported by a.dart. |
| 793 checkHasDependency('file:///b.dart', 'b.dart'); | 802 checkHasDependency(absUri('/b.dart'), 'b.dart'); |
| 794 } | 803 } |
| 795 | 804 |
| 796 test_dependencies_import_to_export_in_subdirs_absolute_export() { | 805 test_dependencies_import_to_export_in_subdirs_absolute_export() { |
| 797 addNamedSource('/a/a.dart', 'library a; export "/a/b/b.dart"; class A {}'); | 806 addNamedSource('/a/a.dart', |
| 807 'library a; export "${absUri('/a/b/b.dart')}"; class A {}'); |
| 798 addNamedSource('/a/b/b.dart', 'library b;'); | 808 addNamedSource('/a/b/b.dart', 'library b;'); |
| 799 serializeLibraryText('import "a/a.dart"; A a;'); | 809 serializeLibraryText('import "a/a.dart"; A a;'); |
| 800 checkHasDependency('file:///a/a.dart', 'a/a.dart'); | 810 checkHasDependency(absUri('/a/a.dart'), 'a/a.dart'); |
| 801 // The main test library depends on b.dart, because names defined in | 811 // The main test library depends on b.dart, because names defined in |
| 802 // b.dart are exported by a.dart. | 812 // b.dart are exported by a.dart. |
| 803 checkHasDependency('file:///a/b/b.dart', '/a/b/b.dart'); | 813 checkHasDependency(absUri('/a/b/b.dart'), '/a/b/b.dart'); |
| 804 } | 814 } |
| 805 | 815 |
| 806 test_dependencies_import_to_export_in_subdirs_absolute_import() { | 816 test_dependencies_import_to_export_in_subdirs_absolute_import() { |
| 807 addNamedSource('/a/a.dart', 'library a; export "b/b.dart"; class A {}'); | 817 addNamedSource('/a/a.dart', 'library a; export "b/b.dart"; class A {}'); |
| 808 addNamedSource('/a/b/b.dart', 'library b;'); | 818 addNamedSource('/a/b/b.dart', 'library b;'); |
| 809 serializeLibraryText('import "/a/a.dart"; A a;'); | 819 serializeLibraryText('import "${absUri('/a/a.dart')}"; A a;'); |
| 810 checkHasDependency('file:///a/a.dart', '/a/a.dart'); | 820 checkHasDependency(absUri('/a/a.dart'), '/a/a.dart'); |
| 811 // The main test library depends on b.dart, because names defined in | 821 // The main test library depends on b.dart, because names defined in |
| 812 // b.dart are exported by a.dart. | 822 // b.dart are exported by a.dart. |
| 813 checkHasDependency('file:///a/b/b.dart', '/a/b/b.dart'); | 823 checkHasDependency(absUri('/a/b/b.dart'), '/a/b/b.dart'); |
| 814 } | 824 } |
| 815 | 825 |
| 816 test_dependencies_import_to_export_in_subdirs_relative() { | 826 test_dependencies_import_to_export_in_subdirs_relative() { |
| 817 addNamedSource('/a/a.dart', 'library a; export "b/b.dart"; class A {}'); | 827 addNamedSource('/a/a.dart', 'library a; export "b/b.dart"; class A {}'); |
| 818 addNamedSource('/a/b/b.dart', 'library b;'); | 828 addNamedSource('/a/b/b.dart', 'library b;'); |
| 819 serializeLibraryText('import "a/a.dart"; A a;'); | 829 serializeLibraryText('import "a/a.dart"; A a;'); |
| 820 checkHasDependency('file:///a/a.dart', 'a/a.dart'); | 830 checkHasDependency(absUri('/a/a.dart'), 'a/a.dart'); |
| 821 // The main test library depends on b.dart, because names defined in | 831 // The main test library depends on b.dart, because names defined in |
| 822 // b.dart are exported by a.dart. | 832 // b.dart are exported by a.dart. |
| 823 checkHasDependency('file:///a/b/b.dart', 'a/b/b.dart'); | 833 checkHasDependency(absUri('/a/b/b.dart'), 'a/b/b.dart'); |
| 824 } | 834 } |
| 825 | 835 |
| 826 test_dependencies_import_to_export_loop() { | 836 test_dependencies_import_to_export_loop() { |
| 827 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); | 837 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); |
| 828 addNamedSource('/b.dart', 'library b; export "a.dart";'); | 838 addNamedSource('/b.dart', 'library b; export "a.dart";'); |
| 829 serializeLibraryText('import "a.dart"; A a;'); | 839 serializeLibraryText('import "a.dart"; A a;'); |
| 830 checkHasDependency('file:///a.dart', 'a.dart'); | 840 checkHasDependency(absUri('/a.dart'), 'a.dart'); |
| 831 // Serialization should have been able to walk the transitive export | 841 // Serialization should have been able to walk the transitive export |
| 832 // dependencies to b.dart without going into an infinite loop. | 842 // dependencies to b.dart without going into an infinite loop. |
| 833 checkHasDependency('file:///b.dart', 'b.dart'); | 843 checkHasDependency(absUri('/b.dart'), 'b.dart'); |
| 834 } | 844 } |
| 835 | 845 |
| 836 test_dependencies_import_to_export_transitive_closure() { | 846 test_dependencies_import_to_export_transitive_closure() { |
| 837 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); | 847 addNamedSource('/a.dart', 'library a; export "b.dart"; class A {}'); |
| 838 addNamedSource('/b.dart', 'library b; export "c.dart";'); | 848 addNamedSource('/b.dart', 'library b; export "c.dart";'); |
| 839 addNamedSource('/c.dart', 'library c;'); | 849 addNamedSource('/c.dart', 'library c;'); |
| 840 serializeLibraryText('import "a.dart"; A a;'); | 850 serializeLibraryText('import "a.dart"; A a;'); |
| 841 checkHasDependency('file:///a.dart', 'a.dart'); | 851 checkHasDependency(absUri('/a.dart'), 'a.dart'); |
| 842 // The main test library depends on c.dart, because names defined in | 852 // The main test library depends on c.dart, because names defined in |
| 843 // c.dart are exported by b.dart and then re-exported by a.dart. | 853 // c.dart are exported by b.dart and then re-exported by a.dart. |
| 844 checkHasDependency('file:///c.dart', 'c.dart'); | 854 checkHasDependency(absUri('/c.dart'), 'c.dart'); |
| 845 } | 855 } |
| 846 | 856 |
| 847 test_dependencies_import_transitive_closure() { | 857 test_dependencies_import_transitive_closure() { |
| 848 addNamedSource( | 858 addNamedSource( |
| 849 '/a.dart', 'library a; import "b.dart"; class A extends B {}'); | 859 '/a.dart', 'library a; import "b.dart"; class A extends B {}'); |
| 850 addNamedSource('/b.dart', 'library b; class B {}'); | 860 addNamedSource('/b.dart', 'library b; class B {}'); |
| 851 serializeLibraryText('import "a.dart"; A a;'); | 861 serializeLibraryText('import "a.dart"; A a;'); |
| 852 checkHasDependency('file:///a.dart', 'a.dart'); | 862 checkHasDependency(absUri('/a.dart'), 'a.dart'); |
| 853 // The main test library doesn't depend on b.dart, because no change to | 863 // The main test library doesn't depend on b.dart, because no change to |
| 854 // b.dart can possibly affect the serialized element model for it. | 864 // b.dart can possibly affect the serialized element model for it. |
| 855 checkLacksDependency('file:///b.dart', 'b.dart'); | 865 checkLacksDependency(absUri('/b.dart'), 'b.dart'); |
| 856 } | 866 } |
| 857 | 867 |
| 858 test_elements_in_part() { | 868 test_elements_in_part() { |
| 859 addNamedSource( | 869 addNamedSource( |
| 860 '/part1.dart', | 870 '/part1.dart', |
| 861 ''' | 871 ''' |
| 862 part of my.lib; | 872 part of my.lib; |
| 863 | 873 |
| 864 class C {} | 874 class C {} |
| 865 enum E { v } | 875 enum E { v } |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 serializeLibraryText( | 1225 serializeLibraryText( |
| 1216 'import "dart:async" as a; main() { print(a.Future); }'); | 1226 'import "dart:async" as a; main() { print(a.Future); }'); |
| 1217 expect(unlinked.imports[0].isDeferred, isFalse); | 1227 expect(unlinked.imports[0].isDeferred, isFalse); |
| 1218 } | 1228 } |
| 1219 | 1229 |
| 1220 test_import_of_file_with_missing_part() { | 1230 test_import_of_file_with_missing_part() { |
| 1221 // Other references in foo.dart should be resolved even though foo.dart's | 1231 // Other references in foo.dart should be resolved even though foo.dart's |
| 1222 // part declaration for bar.dart refers to a non-existent file. | 1232 // part declaration for bar.dart refers to a non-existent file. |
| 1223 addNamedSource('/foo.dart', 'part "bar.dart"; class C {}'); | 1233 addNamedSource('/foo.dart', 'part "bar.dart"; class C {}'); |
| 1224 serializeLibraryText('import "foo.dart"; C x;'); | 1234 serializeLibraryText('import "foo.dart"; C x;'); |
| 1225 checkTypeRef(findVariable('x').type, 'file:///foo.dart', 'foo.dart', 'C'); | 1235 checkTypeRef(findVariable('x').type, absUri('/foo.dart'), 'foo.dart', 'C'); |
| 1226 } | 1236 } |
| 1227 | 1237 |
| 1228 test_import_of_missing_export() { | 1238 test_import_of_missing_export() { |
| 1229 // Other references in foo.dart should be resolved even though foo.dart's | 1239 // Other references in foo.dart should be resolved even though foo.dart's |
| 1230 // re-export of bar.dart refers to a non-existent file. | 1240 // re-export of bar.dart refers to a non-existent file. |
| 1231 addNamedSource('/foo.dart', 'export "bar.dart"; class C {}'); | 1241 addNamedSource('/foo.dart', 'export "bar.dart"; class C {}'); |
| 1232 serializeLibraryText('import "foo.dart"; C x;'); | 1242 serializeLibraryText('import "foo.dart"; C x;'); |
| 1233 checkTypeRef(findVariable('x').type, 'file:///foo.dart', 'foo.dart', 'C'); | 1243 checkTypeRef(findVariable('x').type, absUri('/foo.dart'), 'foo.dart', 'C'); |
| 1234 } | 1244 } |
| 1235 | 1245 |
| 1236 test_import_offset() { | 1246 test_import_offset() { |
| 1237 String libraryText = ' import "dart:async"; Future x;'; | 1247 String libraryText = ' import "dart:async"; Future x;'; |
| 1238 serializeLibraryText(libraryText); | 1248 serializeLibraryText(libraryText); |
| 1239 expect(unlinked.imports[0].offset, libraryText.indexOf('import')); | 1249 expect(unlinked.imports[0].offset, libraryText.indexOf('import')); |
| 1240 } | 1250 } |
| 1241 | 1251 |
| 1242 test_import_prefix_name() { | 1252 test_import_prefix_name() { |
| 1243 String libraryText = 'import "dart:async" as a; a.Future x;'; | 1253 String libraryText = 'import "dart:async" as a; a.Future x;'; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 UnlinkedTypeRef typeRef = | 1445 UnlinkedTypeRef typeRef = |
| 1436 findVariable('u', cls: cls, failIfAbsent: true).type; | 1446 findVariable('u', cls: cls, failIfAbsent: true).type; |
| 1437 checkParamTypeRef(typeRef, 1); | 1447 checkParamTypeRef(typeRef, 1); |
| 1438 } | 1448 } |
| 1439 } | 1449 } |
| 1440 | 1450 |
| 1441 test_type_reference_to_import_of_export() { | 1451 test_type_reference_to_import_of_export() { |
| 1442 addNamedSource('/a.dart', 'library a; export "b.dart";'); | 1452 addNamedSource('/a.dart', 'library a; export "b.dart";'); |
| 1443 addNamedSource('/b.dart', 'library b; class C {}'); | 1453 addNamedSource('/b.dart', 'library b; class C {}'); |
| 1444 checkTypeRef(serializeTypeText('C', otherDeclarations: 'import "a.dart";'), | 1454 checkTypeRef(serializeTypeText('C', otherDeclarations: 'import "a.dart";'), |
| 1445 'file:///b.dart', 'b.dart', 'C'); | 1455 absUri('/b.dart'), 'b.dart', 'C'); |
| 1446 } | 1456 } |
| 1447 | 1457 |
| 1448 test_type_reference_to_import_of_export_via_prefix() { | 1458 test_type_reference_to_import_of_export_via_prefix() { |
| 1449 addNamedSource('/a.dart', 'library a; export "b.dart";'); | 1459 addNamedSource('/a.dart', 'library a; export "b.dart";'); |
| 1450 addNamedSource('/b.dart', 'library b; class C {}'); | 1460 addNamedSource('/b.dart', 'library b; class C {}'); |
| 1451 checkTypeRef( | 1461 checkTypeRef( |
| 1452 serializeTypeText('p.C', otherDeclarations: 'import "a.dart" as p;'), | 1462 serializeTypeText('p.C', otherDeclarations: 'import "a.dart" as p;'), |
| 1453 'file:///b.dart', | 1463 absUri('/b.dart'), |
| 1454 'b.dart', | 1464 'b.dart', |
| 1455 'C', | 1465 'C', |
| 1456 expectedPrefix: 'p'); | 1466 expectedPrefix: 'p'); |
| 1457 } | 1467 } |
| 1458 | 1468 |
| 1459 test_type_reference_to_imported_part() { | 1469 test_type_reference_to_imported_part() { |
| 1460 addNamedSource('/a.dart', 'library my.lib; part "b.dart";'); | 1470 addNamedSource('/a.dart', 'library my.lib; part "b.dart";'); |
| 1461 addNamedSource('/b.dart', 'part of my.lib; class C {}'); | 1471 addNamedSource('/b.dart', 'part of my.lib; class C {}'); |
| 1462 checkTypeRef( | 1472 checkTypeRef( |
| 1463 serializeTypeText('C', | 1473 serializeTypeText('C', |
| 1464 otherDeclarations: 'library my.lib; import "a.dart";'), | 1474 otherDeclarations: 'library my.lib; import "a.dart";'), |
| 1465 'file:///a.dart', | 1475 absUri('/a.dart'), |
| 1466 'a.dart', | 1476 'a.dart', |
| 1467 'C'); | 1477 'C'); |
| 1468 } | 1478 } |
| 1469 | 1479 |
| 1470 test_type_reference_to_imported_part_with_prefix() { | 1480 test_type_reference_to_imported_part_with_prefix() { |
| 1471 addNamedSource('/a.dart', 'library my.lib; part "b.dart";'); | 1481 addNamedSource('/a.dart', 'library my.lib; part "b.dart";'); |
| 1472 addNamedSource('/b.dart', 'part of my.lib; class C {}'); | 1482 addNamedSource('/b.dart', 'part of my.lib; class C {}'); |
| 1473 checkTypeRef( | 1483 checkTypeRef( |
| 1474 serializeTypeText('p.C', | 1484 serializeTypeText('p.C', |
| 1475 otherDeclarations: 'library my.lib; import "a.dart" as p;'), | 1485 otherDeclarations: 'library my.lib; import "a.dart" as p;'), |
| 1476 'file:///a.dart', | 1486 absUri('/a.dart'), |
| 1477 'a.dart', | 1487 'a.dart', |
| 1478 'C', | 1488 'C', |
| 1479 expectedPrefix: 'p'); | 1489 expectedPrefix: 'p'); |
| 1480 } | 1490 } |
| 1481 | 1491 |
| 1482 test_type_reference_to_internal_class() { | 1492 test_type_reference_to_internal_class() { |
| 1483 checkTypeRef(serializeTypeText('C', otherDeclarations: 'class C {}'), null, | 1493 checkTypeRef(serializeTypeText('C', otherDeclarations: 'class C {}'), null, |
| 1484 null, 'C'); | 1494 null, 'C'); |
| 1485 } | 1495 } |
| 1486 | 1496 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 | 1532 |
| 1523 test_type_unit_counts_unreferenced_units() { | 1533 test_type_unit_counts_unreferenced_units() { |
| 1524 addNamedSource('/a.dart', 'library a; part "b.dart"; part "c.dart";'); | 1534 addNamedSource('/a.dart', 'library a; part "b.dart"; part "c.dart";'); |
| 1525 addNamedSource('/b.dart', 'part of a;'); | 1535 addNamedSource('/b.dart', 'part of a;'); |
| 1526 addNamedSource('/c.dart', 'part of a; class C {}'); | 1536 addNamedSource('/c.dart', 'part of a; class C {}'); |
| 1527 UnlinkedTypeRef typeRef = | 1537 UnlinkedTypeRef typeRef = |
| 1528 serializeTypeText('C', otherDeclarations: 'import "a.dart";'); | 1538 serializeTypeText('C', otherDeclarations: 'import "a.dart";'); |
| 1529 // The referenced unit should be 2, since unit 0 is a.dart and unit 1 is | 1539 // The referenced unit should be 2, since unit 0 is a.dart and unit 1 is |
| 1530 // b.dart. a.dart and b.dart are counted even though nothing is imported | 1540 // b.dart. a.dart and b.dart are counted even though nothing is imported |
| 1531 // from them. | 1541 // from them. |
| 1532 checkTypeRef(typeRef, 'file:///a.dart', 'a.dart', 'C'); | 1542 checkTypeRef(typeRef, absUri('/a.dart'), 'a.dart', 'C'); |
| 1533 } | 1543 } |
| 1534 | 1544 |
| 1535 test_type_unresolved() { | 1545 test_type_unresolved() { |
| 1536 UnlinkedTypeRef typeRef = serializeTypeText('Foo', allowErrors: true); | 1546 UnlinkedTypeRef typeRef = serializeTypeText('Foo', allowErrors: true); |
| 1537 checkUnresolvedTypeRef(typeRef, null, 'Foo'); | 1547 checkUnresolvedTypeRef(typeRef, null, 'Foo'); |
| 1538 } | 1548 } |
| 1539 | 1549 |
| 1540 test_typedef_name() { | 1550 test_typedef_name() { |
| 1541 UnlinkedTypedef type = serializeTypedefText('typedef F();'); | 1551 UnlinkedTypedef type = serializeTypedefText('typedef F();'); |
| 1542 expect(type.name, 'F'); | 1552 expect(type.name, 'F'); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 serializeClassText('class C { static int i; }').fields[0]; | 1660 serializeClassText('class C { static int i; }').fields[0]; |
| 1651 expect(variable.isStatic, isTrue); | 1661 expect(variable.isStatic, isTrue); |
| 1652 } | 1662 } |
| 1653 | 1663 |
| 1654 test_variable_type() { | 1664 test_variable_type() { |
| 1655 UnlinkedVariable variable = | 1665 UnlinkedVariable variable = |
| 1656 serializeVariableText('int i;', variableName: 'i'); | 1666 serializeVariableText('int i;', variableName: 'i'); |
| 1657 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); | 1667 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); |
| 1658 } | 1668 } |
| 1659 } | 1669 } |
| OLD | NEW |