| 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: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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 compareTypes(r.type, o.type, desc); | 272 compareTypes(r.type, o.type, desc); |
| 273 if (r is ClassElementImpl && o is ClassElementImpl) { | 273 if (r is ClassElementImpl && o is ClassElementImpl) { |
| 274 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); | 274 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, | 278 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, |
| 279 CompilationUnitElementImpl original) { | 279 CompilationUnitElementImpl original) { |
| 280 String desc = 'Compilation unit ${original.source.uri}'; | 280 String desc = 'Compilation unit ${original.source.uri}'; |
| 281 compareUriReferencedElements(resynthesized, original, desc); | |
| 282 expect(resynthesized.source, original.source); | 281 expect(resynthesized.source, original.source); |
| 283 expect(resynthesized.librarySource, original.librarySource); | 282 expect(resynthesized.librarySource, original.librarySource); |
| 284 compareLineInfo(resynthesized.lineInfo, original.lineInfo); | 283 compareLineInfo(resynthesized.lineInfo, original.lineInfo); |
| 285 expect(resynthesized.types.length, original.types.length, | 284 expect(resynthesized.types.length, original.types.length, |
| 286 reason: '$desc.types.length'); | 285 reason: '$desc.types.length'); |
| 287 for (int i = 0; i < resynthesized.types.length; i++) { | 286 for (int i = 0; i < resynthesized.types.length; i++) { |
| 288 compareClassElements( | 287 compareClassElements( |
| 289 resynthesized.types[i], original.types[i], original.types[i].name); | 288 resynthesized.types[i], original.types[i], original.types[i].name); |
| 290 } | 289 } |
| 291 expect(resynthesized.topLevelVariables.length, | 290 expect(resynthesized.topLevelVariables.length, |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 compareTypeParameterElements( | 760 compareTypeParameterElements( |
| 762 resynthesized.typeParameters[i], | 761 resynthesized.typeParameters[i], |
| 763 original.typeParameters[i], | 762 original.typeParameters[i], |
| 764 '$desc type parameter ${original.typeParameters[i].name}'); | 763 '$desc type parameter ${original.typeParameters[i].name}'); |
| 765 } | 764 } |
| 766 compareLocalElementsOfExecutable(resynthesized, original, desc); | 765 compareLocalElementsOfExecutable(resynthesized, original, desc); |
| 767 } | 766 } |
| 768 | 767 |
| 769 void compareExportElements(ExportElementImpl resynthesized, | 768 void compareExportElements(ExportElementImpl resynthesized, |
| 770 ExportElementImpl original, String desc) { | 769 ExportElementImpl original, String desc) { |
| 771 compareUriReferencedElements(resynthesized, original, desc); | |
| 772 expect(resynthesized.exportedLibrary.location, | 770 expect(resynthesized.exportedLibrary.location, |
| 773 original.exportedLibrary.location); | 771 original.exportedLibrary.location); |
| 774 expect(resynthesized.combinators.length, original.combinators.length); | 772 expect(resynthesized.combinators.length, original.combinators.length); |
| 775 for (int i = 0; i < resynthesized.combinators.length; i++) { | 773 for (int i = 0; i < resynthesized.combinators.length; i++) { |
| 776 compareNamespaceCombinators( | 774 compareNamespaceCombinators( |
| 777 resynthesized.combinators[i], original.combinators[i]); | 775 resynthesized.combinators[i], original.combinators[i]); |
| 778 } | 776 } |
| 779 } | 777 } |
| 780 | 778 |
| 781 void compareFieldElements( | 779 void compareFieldElements( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 compareTypeParameterElementLists(resynthesized.typeParameters, | 841 compareTypeParameterElementLists(resynthesized.typeParameters, |
| 844 original.typeParameters, '$desc.typeParameters'); | 842 original.typeParameters, '$desc.typeParameters'); |
| 845 compareParameterElementLists( | 843 compareParameterElementLists( |
| 846 resynthesized.parameters, original.parameters, '$desc.parameters'); | 844 resynthesized.parameters, original.parameters, '$desc.parameters'); |
| 847 compareTypes( | 845 compareTypes( |
| 848 resynthesized.returnType, original.returnType, '$desc.returnType'); | 846 resynthesized.returnType, original.returnType, '$desc.returnType'); |
| 849 } | 847 } |
| 850 | 848 |
| 851 void compareImportElements(ImportElementImpl resynthesized, | 849 void compareImportElements(ImportElementImpl resynthesized, |
| 852 ImportElementImpl original, String desc) { | 850 ImportElementImpl original, String desc) { |
| 853 compareUriReferencedElements(resynthesized, original, desc); | |
| 854 expect(resynthesized.importedLibrary.location, | 851 expect(resynthesized.importedLibrary.location, |
| 855 original.importedLibrary.location, | 852 original.importedLibrary.location, |
| 856 reason: '$desc importedLibrary location'); | 853 reason: '$desc importedLibrary location'); |
| 857 expect(resynthesized.prefixOffset, original.prefixOffset, | 854 expect(resynthesized.prefixOffset, original.prefixOffset, |
| 858 reason: '$desc prefixOffset'); | 855 reason: '$desc prefixOffset'); |
| 859 if (original.prefix == null) { | 856 if (original.prefix == null) { |
| 860 expect(resynthesized.prefix, isNull, reason: '$desc prefix'); | 857 expect(resynthesized.prefix, isNull, reason: '$desc prefix'); |
| 861 } else { | 858 } else { |
| 862 comparePrefixElements( | 859 comparePrefixElements( |
| 863 resynthesized.prefix, original.prefix, original.prefix.name); | 860 resynthesized.prefix, original.prefix, original.prefix.name); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 } else if (resynthesized is BottomTypeImpl && original is BottomTypeImpl) { | 1144 } else if (resynthesized is BottomTypeImpl && original is BottomTypeImpl) { |
| 1148 expect(resynthesized, same(original)); | 1145 expect(resynthesized, same(original)); |
| 1149 } else if (resynthesized.runtimeType != original.runtimeType) { | 1146 } else if (resynthesized.runtimeType != original.runtimeType) { |
| 1150 fail('Type mismatch: expected ${original.runtimeType},' | 1147 fail('Type mismatch: expected ${original.runtimeType},' |
| 1151 ' got ${resynthesized.runtimeType} ($desc)'); | 1148 ' got ${resynthesized.runtimeType} ($desc)'); |
| 1152 } else { | 1149 } else { |
| 1153 fail('Unimplemented comparison for ${original.runtimeType}'); | 1150 fail('Unimplemented comparison for ${original.runtimeType}'); |
| 1154 } | 1151 } |
| 1155 } | 1152 } |
| 1156 | 1153 |
| 1157 void compareUriReferencedElements(UriReferencedElementImpl resynthesized, | |
| 1158 UriReferencedElementImpl original, String desc) { | |
| 1159 compareElements(resynthesized, original, desc); | |
| 1160 expect(resynthesized.uri, original.uri, reason: '$desc.uri'); | |
| 1161 expect(resynthesized.uriOffset, original.uriOffset, | |
| 1162 reason: '$desc.uriOffset'); | |
| 1163 expect(resynthesized.uriEnd, original.uriEnd, reason: '$desc.uriEnd'); | |
| 1164 } | |
| 1165 | |
| 1166 void compareVariableElements( | 1154 void compareVariableElements( |
| 1167 VariableElement resynthesized, VariableElement original, String desc) { | 1155 VariableElement resynthesized, VariableElement original, String desc) { |
| 1168 compareElements(resynthesized, original, desc); | 1156 compareElements(resynthesized, original, desc); |
| 1169 compareTypes(resynthesized.type, original.type, '$desc.type'); | 1157 compareTypes(resynthesized.type, original.type, '$desc.type'); |
| 1170 VariableElementImpl resynthesizedActual = | 1158 VariableElementImpl resynthesizedActual = |
| 1171 getActualElement(resynthesized, desc); | 1159 getActualElement(resynthesized, desc); |
| 1172 VariableElementImpl originalActual = getActualElement(original, desc); | 1160 VariableElementImpl originalActual = getActualElement(original, desc); |
| 1173 compareFunctionElements(resynthesizedActual.initializer, | 1161 compareFunctionElements(resynthesizedActual.initializer, |
| 1174 originalActual.initializer, '$desc.initializer'); | 1162 originalActual.initializer, '$desc.initializer'); |
| 1175 if (originalActual is ConstVariableElement) { | 1163 if (originalActual is ConstVariableElement) { |
| (...skipping 5249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6425 '''); | 6413 '''); |
| 6426 if (isStrongMode) { | 6414 if (isStrongMode) { |
| 6427 checkElementText(library, r''' | 6415 checkElementText(library, r''' |
| 6428 export 'foo.dart'; | 6416 export 'foo.dart'; |
| 6429 '''); | 6417 '''); |
| 6430 } else { | 6418 } else { |
| 6431 checkElementText(library, r''' | 6419 checkElementText(library, r''' |
| 6432 export 'foo.dart'; | 6420 export 'foo.dart'; |
| 6433 '''); | 6421 '''); |
| 6434 } | 6422 } |
| 6435 expect(library.exports[0].uri, 'foo.dart'); | |
| 6436 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); | 6423 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); |
| 6437 } | 6424 } |
| 6438 | 6425 |
| 6439 test_export_configurations_useFirst() async { | 6426 test_export_configurations_useFirst() async { |
| 6440 context.declaredVariables.define('dart.library.io', 'true'); | 6427 context.declaredVariables.define('dart.library.io', 'true'); |
| 6441 context.declaredVariables.define('dart.library.html', 'true'); | 6428 context.declaredVariables.define('dart.library.html', 'true'); |
| 6442 addLibrarySource('/foo.dart', 'class A {}'); | 6429 addLibrarySource('/foo.dart', 'class A {}'); |
| 6443 addLibrarySource('/foo_io.dart', 'class A {}'); | 6430 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 6444 addLibrarySource('/foo_html.dart', 'class A {}'); | 6431 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 6445 var library = await checkLibrary(r''' | 6432 var library = await checkLibrary(r''' |
| 6446 export 'foo.dart' | 6433 export 'foo.dart' |
| 6447 if (dart.library.io) 'foo_io.dart' | 6434 if (dart.library.io) 'foo_io.dart' |
| 6448 if (dart.library.html) 'foo_html.dart'; | 6435 if (dart.library.html) 'foo_html.dart'; |
| 6449 '''); | 6436 '''); |
| 6450 if (isStrongMode) { | 6437 if (isStrongMode) { |
| 6451 checkElementText(library, r''' | 6438 checkElementText(library, r''' |
| 6452 export 'foo_io.dart'; | 6439 export 'foo_io.dart'; |
| 6453 '''); | 6440 '''); |
| 6454 } else { | 6441 } else { |
| 6455 checkElementText(library, r''' | 6442 checkElementText(library, r''' |
| 6456 export 'foo_io.dart'; | 6443 export 'foo_io.dart'; |
| 6457 '''); | 6444 '''); |
| 6458 } | 6445 } |
| 6459 expect(library.exports[0].uri, 'foo_io.dart'); | |
| 6460 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); | 6446 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); |
| 6461 } | 6447 } |
| 6462 | 6448 |
| 6463 test_export_configurations_useSecond() async { | 6449 test_export_configurations_useSecond() async { |
| 6464 context.declaredVariables.define('dart.library.io', 'false'); | 6450 context.declaredVariables.define('dart.library.io', 'false'); |
| 6465 context.declaredVariables.define('dart.library.html', 'true'); | 6451 context.declaredVariables.define('dart.library.html', 'true'); |
| 6466 addLibrarySource('/foo.dart', 'class A {}'); | 6452 addLibrarySource('/foo.dart', 'class A {}'); |
| 6467 addLibrarySource('/foo_io.dart', 'class A {}'); | 6453 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 6468 addLibrarySource('/foo_html.dart', 'class A {}'); | 6454 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 6469 var library = await checkLibrary(r''' | 6455 var library = await checkLibrary(r''' |
| 6470 export 'foo.dart' | 6456 export 'foo.dart' |
| 6471 if (dart.library.io) 'foo_io.dart' | 6457 if (dart.library.io) 'foo_io.dart' |
| 6472 if (dart.library.html) 'foo_html.dart'; | 6458 if (dart.library.html) 'foo_html.dart'; |
| 6473 '''); | 6459 '''); |
| 6474 if (isStrongMode) { | 6460 if (isStrongMode) { |
| 6475 checkElementText(library, r''' | 6461 checkElementText(library, r''' |
| 6476 export 'foo_html.dart'; | 6462 export 'foo_html.dart'; |
| 6477 '''); | 6463 '''); |
| 6478 } else { | 6464 } else { |
| 6479 checkElementText(library, r''' | 6465 checkElementText(library, r''' |
| 6480 export 'foo_html.dart'; | 6466 export 'foo_html.dart'; |
| 6481 '''); | 6467 '''); |
| 6482 } | 6468 } |
| 6483 ExportElement export = library.exports[0]; | 6469 ExportElement export = library.exports[0]; |
| 6484 expect(export.uri, 'foo_html.dart'); | |
| 6485 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); | 6470 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); |
| 6486 } | 6471 } |
| 6487 | 6472 |
| 6488 test_export_function() async { | 6473 test_export_function() async { |
| 6489 addLibrarySource('/a.dart', 'f() {}'); | 6474 addLibrarySource('/a.dart', 'f() {}'); |
| 6490 var library = await checkLibrary('export "a.dart";'); | 6475 var library = await checkLibrary('export "a.dart";'); |
| 6491 if (isStrongMode) { | 6476 if (isStrongMode) { |
| 6492 checkElementText(library, r''' | 6477 checkElementText(library, r''' |
| 6493 export 'a.dart'; | 6478 export 'a.dart'; |
| 6494 '''); | 6479 '''); |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7845 allowMissingFiles = true; | 7830 allowMissingFiles = true; |
| 7846 shouldCompareLibraryElements = false; | 7831 shouldCompareLibraryElements = false; |
| 7847 var library = await checkLibrary(''' | 7832 var library = await checkLibrary(''' |
| 7848 @foo | 7833 @foo |
| 7849 import ''; | 7834 import ''; |
| 7850 '''); | 7835 '''); |
| 7851 if (isStrongMode) { | 7836 if (isStrongMode) { |
| 7852 checkElementText(library, r''' | 7837 checkElementText(library, r''' |
| 7853 @ | 7838 @ |
| 7854 foo/*location: null*/ | 7839 foo/*location: null*/ |
| 7855 import ''; | 7840 import '<unresolved>'; |
| 7856 '''); | 7841 '''); |
| 7857 } else { | 7842 } else { |
| 7858 checkElementText(library, r''' | 7843 checkElementText(library, r''' |
| 7859 @ | 7844 @ |
| 7860 foo/*location: null*/ | 7845 foo/*location: null*/ |
| 7861 import ''; | 7846 import '<unresolved>'; |
| 7862 '''); | 7847 '''); |
| 7863 } | 7848 } |
| 7864 } | 7849 } |
| 7865 | 7850 |
| 7866 test_import_multiple_combinators() async { | 7851 test_import_multiple_combinators() async { |
| 7867 addLibrary('dart:async'); | 7852 addLibrary('dart:async'); |
| 7868 var library = await checkLibrary(''' | 7853 var library = await checkLibrary(''' |
| 7869 import "dart:async" hide Stream show Future; | 7854 import "dart:async" hide Stream show Future; |
| 7870 Future f; | 7855 Future f; |
| 7871 '''); | 7856 '''); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7928 | 7913 |
| 7929 test_import_short_absolute() async { | 7914 test_import_short_absolute() async { |
| 7930 testFile = '/my/project/bin/test.dart'; | 7915 testFile = '/my/project/bin/test.dart'; |
| 7931 // Note: "/a.dart" resolves differently on Windows vs. Posix. | 7916 // Note: "/a.dart" resolves differently on Windows vs. Posix. |
| 7932 var destinationPath = | 7917 var destinationPath = |
| 7933 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); | 7918 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); |
| 7934 addLibrarySource(destinationPath, 'class C {}'); | 7919 addLibrarySource(destinationPath, 'class C {}'); |
| 7935 var library = await checkLibrary('import "/a.dart"; C c;'); | 7920 var library = await checkLibrary('import "/a.dart"; C c;'); |
| 7936 if (isStrongMode) { | 7921 if (isStrongMode) { |
| 7937 checkElementText(library, r''' | 7922 checkElementText(library, r''' |
| 7938 import '/a.dart'; | 7923 import 'a.dart'; |
| 7939 C c; | 7924 C c; |
| 7940 '''); | 7925 '''); |
| 7941 } else { | 7926 } else { |
| 7942 checkElementText(library, r''' | 7927 checkElementText(library, r''' |
| 7943 import '/a.dart'; | 7928 import 'a.dart'; |
| 7944 C c; | 7929 C c; |
| 7945 '''); | 7930 '''); |
| 7946 } | 7931 } |
| 7947 } | 7932 } |
| 7948 | 7933 |
| 7949 test_import_show() async { | 7934 test_import_show() async { |
| 7950 addLibrary('dart:async'); | 7935 addLibrary('dart:async'); |
| 7951 var library = await checkLibrary(''' | 7936 var library = await checkLibrary(''' |
| 7952 import "dart:async" show Future, Stream; | 7937 import "dart:async" show Future, Stream; |
| 7953 Future f; | 7938 Future f; |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8940 | 8925 |
| 8941 test_invalidUri_part_emptyUri() async { | 8926 test_invalidUri_part_emptyUri() async { |
| 8942 allowMissingFiles = true; | 8927 allowMissingFiles = true; |
| 8943 shouldCompareLibraryElements = false; | 8928 shouldCompareLibraryElements = false; |
| 8944 var library = await checkLibrary(r''' | 8929 var library = await checkLibrary(r''' |
| 8945 part ''; | 8930 part ''; |
| 8946 class B extends A {} | 8931 class B extends A {} |
| 8947 '''); | 8932 '''); |
| 8948 if (isStrongMode) { | 8933 if (isStrongMode) { |
| 8949 checkElementText(library, r''' | 8934 checkElementText(library, r''' |
| 8950 part ''; | 8935 part '<unresolved>'; |
| 8951 class B { | 8936 class B { |
| 8952 } | 8937 } |
| 8953 -------------------- | 8938 -------------------- |
| 8954 unit: null | 8939 unit: null |
| 8955 | 8940 |
| 8956 '''); | 8941 '''); |
| 8957 } else { | 8942 } else { |
| 8958 checkElementText(library, r''' | 8943 checkElementText(library, r''' |
| 8959 part ''; | 8944 part '<unresolved>'; |
| 8960 class B { | 8945 class B { |
| 8961 } | 8946 } |
| 8962 -------------------- | 8947 -------------------- |
| 8963 unit: null | 8948 unit: null |
| 8964 | 8949 |
| 8965 '''); | 8950 '''); |
| 8966 } | 8951 } |
| 8967 } | 8952 } |
| 8968 | 8953 |
| 8969 test_invalidUris() async { | 8954 test_invalidUris() async { |
| 8970 allowMissingFiles = true; | 8955 allowMissingFiles = true; |
| 8971 shouldCompareLibraryElements = false; | 8956 shouldCompareLibraryElements = false; |
| 8972 var library = await checkLibrary(r''' | 8957 var library = await checkLibrary(r''' |
| 8973 import '[invalid uri]'; | 8958 import '[invalid uri]'; |
| 8974 import '[invalid uri]:foo.dart'; | 8959 import '[invalid uri]:foo.dart'; |
| 8975 import 'a1.dart'; | 8960 import 'a1.dart'; |
| 8976 import '[invalid uri]'; | 8961 import '[invalid uri]'; |
| 8977 import '[invalid uri]:foo.dart'; | 8962 import '[invalid uri]:foo.dart'; |
| 8978 | 8963 |
| 8979 export '[invalid uri]'; | 8964 export '[invalid uri]'; |
| 8980 export '[invalid uri]:foo.dart'; | 8965 export '[invalid uri]:foo.dart'; |
| 8981 export 'a2.dart'; | 8966 export 'a2.dart'; |
| 8982 export '[invalid uri]'; | 8967 export '[invalid uri]'; |
| 8983 export '[invalid uri]:foo.dart'; | 8968 export '[invalid uri]:foo.dart'; |
| 8984 | 8969 |
| 8985 part '[invalid uri]'; | 8970 part '[invalid uri]'; |
| 8986 part 'a3.dart'; | 8971 part 'a3.dart'; |
| 8987 part '[invalid uri]'; | 8972 part '[invalid uri]'; |
| 8988 '''); | 8973 '''); |
| 8989 if (isStrongMode) { | 8974 checkElementText(library, r''' |
| 8990 checkElementText(library, r''' | 8975 import '<unresolved>'; |
| 8991 import '[invalid uri]'; | 8976 import '<unresolved>'; |
| 8992 import '[invalid uri]:foo.dart'; | |
| 8993 import 'a1.dart'; | 8977 import 'a1.dart'; |
| 8994 import '[invalid uri]'; | 8978 import '<unresolved>'; |
| 8995 import '[invalid uri]:foo.dart'; | 8979 import '<unresolved>'; |
| 8996 export '[invalid uri]'; | 8980 export '<unresolved>'; |
| 8997 export '[invalid uri]:foo.dart'; | 8981 export '<unresolved>'; |
| 8998 export 'a2.dart'; | 8982 export 'a2.dart'; |
| 8999 export '[invalid uri]'; | 8983 export '<unresolved>'; |
| 9000 export '[invalid uri]:foo.dart'; | 8984 export '<unresolved>'; |
| 9001 part '[invalid uri]'; | 8985 part '<unresolved>'; |
| 9002 part 'a3.dart'; | 8986 part 'a3.dart'; |
| 9003 part '[invalid uri]'; | 8987 part '<unresolved>'; |
| 9004 -------------------- | 8988 -------------------- |
| 9005 unit: null | 8989 unit: null |
| 9006 | 8990 |
| 9007 -------------------- | |
| 9008 unit: a3.dart | |
| 9009 | |
| 9010 -------------------- | |
| 9011 unit: null | |
| 9012 | |
| 9013 '''); | |
| 9014 } else { | |
| 9015 checkElementText(library, r''' | |
| 9016 import '[invalid uri]'; | |
| 9017 import '[invalid uri]:foo.dart'; | |
| 9018 import 'a1.dart'; | |
| 9019 import '[invalid uri]'; | |
| 9020 import '[invalid uri]:foo.dart'; | |
| 9021 export '[invalid uri]'; | |
| 9022 export '[invalid uri]:foo.dart'; | |
| 9023 export 'a2.dart'; | |
| 9024 export '[invalid uri]'; | |
| 9025 export '[invalid uri]:foo.dart'; | |
| 9026 part '[invalid uri]'; | |
| 9027 part 'a3.dart'; | |
| 9028 part '[invalid uri]'; | |
| 9029 -------------------- | |
| 9030 unit: null | |
| 9031 | |
| 9032 -------------------- | 8991 -------------------- |
| 9033 unit: a3.dart | 8992 unit: a3.dart |
| 9034 | 8993 |
| 9035 -------------------- | 8994 -------------------- |
| 9036 unit: null | 8995 unit: null |
| 9037 | 8996 |
| 9038 '''); | 8997 '''); |
| 9039 } | |
| 9040 } | 8998 } |
| 9041 | 8999 |
| 9042 test_library() async { | 9000 test_library() async { |
| 9043 var library = await checkLibrary(''); | 9001 var library = await checkLibrary(''); |
| 9044 if (isStrongMode) { | 9002 if (isStrongMode) { |
| 9045 checkElementText(library, r''' | 9003 checkElementText(library, r''' |
| 9046 '''); | 9004 '''); |
| 9047 } else { | 9005 } else { |
| 9048 checkElementText(library, r''' | 9006 checkElementText(library, r''' |
| 9049 '''); | 9007 '''); |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11088 } | 11046 } |
| 11089 | 11047 |
| 11090 test_parts_invalidUri() async { | 11048 test_parts_invalidUri() async { |
| 11091 allowMissingFiles = true; | 11049 allowMissingFiles = true; |
| 11092 shouldCompareLibraryElements = false; | 11050 shouldCompareLibraryElements = false; |
| 11093 addSource('/foo/bar.dart', 'part of my.lib;'); | 11051 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 11094 var library = await checkLibrary('library my.lib; part "foo/";'); | 11052 var library = await checkLibrary('library my.lib; part "foo/";'); |
| 11095 if (isStrongMode) { | 11053 if (isStrongMode) { |
| 11096 checkElementText(library, r''' | 11054 checkElementText(library, r''' |
| 11097 library my.lib; | 11055 library my.lib; |
| 11098 part 'foo/'; | 11056 part '<unresolved>'; |
| 11099 -------------------- | 11057 -------------------- |
| 11100 unit: null | 11058 unit: null |
| 11101 | 11059 |
| 11102 '''); | 11060 '''); |
| 11103 } else { | 11061 } else { |
| 11104 checkElementText(library, r''' | 11062 checkElementText(library, r''' |
| 11105 library my.lib; | 11063 library my.lib; |
| 11106 part 'foo/'; | 11064 part '<unresolved>'; |
| 11107 -------------------- | 11065 -------------------- |
| 11108 unit: null | 11066 unit: null |
| 11109 | 11067 |
| 11110 '''); | 11068 '''); |
| 11111 } | 11069 } |
| 11112 } | 11070 } |
| 11113 | 11071 |
| 11114 test_parts_invalidUri_nullStringValue() async { | 11072 test_parts_invalidUri_nullStringValue() async { |
| 11115 allowMissingFiles = true; | 11073 allowMissingFiles = true; |
| 11116 shouldCompareLibraryElements = false; | 11074 shouldCompareLibraryElements = false; |
| 11117 addSource('/foo/bar.dart', 'part of my.lib;'); | 11075 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 11118 var library = await checkLibrary(r''' | 11076 var library = await checkLibrary(r''' |
| 11119 library my.lib; | 11077 library my.lib; |
| 11120 part "${foo}/bar.dart"; | 11078 part "${foo}/bar.dart"; |
| 11121 '''); | 11079 '''); |
| 11122 if (isStrongMode) { | 11080 if (isStrongMode) { |
| 11123 checkElementText(library, r''' | 11081 checkElementText(library, r''' |
| 11124 library my.lib; | 11082 library my.lib; |
| 11125 part ''; | 11083 part '<unresolved>'; |
| 11126 -------------------- | 11084 -------------------- |
| 11127 unit: null | 11085 unit: null |
| 11128 | 11086 |
| 11129 '''); | 11087 '''); |
| 11130 } else { | 11088 } else { |
| 11131 checkElementText(library, r''' | 11089 checkElementText(library, r''' |
| 11132 library my.lib; | 11090 library my.lib; |
| 11133 part ''; | 11091 part '<unresolved>'; |
| 11134 -------------------- | 11092 -------------------- |
| 11135 unit: null | 11093 unit: null |
| 11136 | 11094 |
| 11137 '''); | 11095 '''); |
| 11138 } | 11096 } |
| 11139 } | 11097 } |
| 11140 | 11098 |
| 11141 test_propagated_type_refers_to_closure() async { | 11099 test_propagated_type_refers_to_closure() async { |
| 11142 var library = await checkLibrary(''' | 11100 var library = await checkLibrary(''' |
| 11143 void f() { | 11101 void f() { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11917 } | 11875 } |
| 11918 } | 11876 } |
| 11919 | 11877 |
| 11920 test_type_reference_to_import_export_export_in_subdirs() async { | 11878 test_type_reference_to_import_export_export_in_subdirs() async { |
| 11921 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 11879 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 11922 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); | 11880 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); |
| 11923 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); | 11881 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); |
| 11924 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 11882 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 11925 if (isStrongMode) { | 11883 if (isStrongMode) { |
| 11926 checkElementText(library, r''' | 11884 checkElementText(library, r''' |
| 11927 import 'a/a.dart'; | 11885 import 'a.dart'; |
| 11928 C c; | 11886 C c; |
| 11929 E e; | 11887 E e; |
| 11930 F f; | 11888 F f; |
| 11931 '''); | 11889 '''); |
| 11932 } else { | 11890 } else { |
| 11933 checkElementText(library, r''' | 11891 checkElementText(library, r''' |
| 11934 import 'a/a.dart'; | 11892 import 'a.dart'; |
| 11935 C c; | 11893 C c; |
| 11936 E e; | 11894 E e; |
| 11937 F f; | 11895 F f; |
| 11938 '''); | 11896 '''); |
| 11939 } | 11897 } |
| 11940 } | 11898 } |
| 11941 | 11899 |
| 11942 test_type_reference_to_import_export_in_subdirs() async { | 11900 test_type_reference_to_import_export_in_subdirs() async { |
| 11943 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 11901 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 11944 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); | 11902 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); |
| 11945 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 11903 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 11946 if (isStrongMode) { | 11904 if (isStrongMode) { |
| 11947 checkElementText(library, r''' | 11905 checkElementText(library, r''' |
| 11948 import 'a/a.dart'; | 11906 import 'a.dart'; |
| 11949 C c; | 11907 C c; |
| 11950 E e; | 11908 E e; |
| 11951 F f; | 11909 F f; |
| 11952 '''); | 11910 '''); |
| 11953 } else { | 11911 } else { |
| 11954 checkElementText(library, r''' | 11912 checkElementText(library, r''' |
| 11955 import 'a/a.dart'; | 11913 import 'a.dart'; |
| 11956 C c; | 11914 C c; |
| 11957 E e; | 11915 E e; |
| 11958 F f; | 11916 F f; |
| 11959 '''); | 11917 '''); |
| 11960 } | 11918 } |
| 11961 } | 11919 } |
| 11962 | 11920 |
| 11963 test_type_reference_to_import_part() async { | 11921 test_type_reference_to_import_part() async { |
| 11964 addLibrarySource('/a.dart', 'library l; part "b.dart";'); | 11922 addLibrarySource('/a.dart', 'library l; part "b.dart";'); |
| 11965 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); | 11923 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12000 '''); | 11958 '''); |
| 12001 } | 11959 } |
| 12002 } | 11960 } |
| 12003 | 11961 |
| 12004 test_type_reference_to_import_part_in_subdir() async { | 11962 test_type_reference_to_import_part_in_subdir() async { |
| 12005 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); | 11963 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); |
| 12006 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); | 11964 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 12007 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;'); | 11965 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;'); |
| 12008 if (isStrongMode) { | 11966 if (isStrongMode) { |
| 12009 checkElementText(library, r''' | 11967 checkElementText(library, r''' |
| 12010 import 'a/b.dart'; | 11968 import 'b.dart'; |
| 12011 C c; | 11969 C c; |
| 12012 E e; | 11970 E e; |
| 12013 F f; | 11971 F f; |
| 12014 '''); | 11972 '''); |
| 12015 } else { | 11973 } else { |
| 12016 checkElementText(library, r''' | 11974 checkElementText(library, r''' |
| 12017 import 'a/b.dart'; | 11975 import 'b.dart'; |
| 12018 C c; | 11976 C c; |
| 12019 E e; | 11977 E e; |
| 12020 F f; | 11978 F f; |
| 12021 '''); | 11979 '''); |
| 12022 } | 11980 } |
| 12023 } | 11981 } |
| 12024 | 11982 |
| 12025 test_type_reference_to_import_relative() async { | 11983 test_type_reference_to_import_relative() async { |
| 12026 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); | 11984 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); |
| 12027 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); | 11985 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13187 fail('Unexpectedly tried to get unlinked summary for $uri'); | 13145 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 13188 } | 13146 } |
| 13189 return serializedUnit; | 13147 return serializedUnit; |
| 13190 } | 13148 } |
| 13191 | 13149 |
| 13192 @override | 13150 @override |
| 13193 bool hasLibrarySummary(String uri) { | 13151 bool hasLibrarySummary(String uri) { |
| 13194 return true; | 13152 return true; |
| 13195 } | 13153 } |
| 13196 } | 13154 } |
| OLD | NEW |