| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 compareTypes(r.type, o.type, desc); | 267 compareTypes(r.type, o.type, desc); |
| 268 if (r is ClassElementImpl && o is ClassElementImpl) { | 268 if (r is ClassElementImpl && o is ClassElementImpl) { |
| 269 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); | 269 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, | 273 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, |
| 274 CompilationUnitElementImpl original) { | 274 CompilationUnitElementImpl original) { |
| 275 String desc = 'Compilation unit ${original.source.uri}'; | 275 String desc = 'Compilation unit ${original.source.uri}'; |
| 276 compareUriReferencedElements(resynthesized, original, desc); | |
| 277 expect(resynthesized.source, original.source); | 276 expect(resynthesized.source, original.source); |
| 278 expect(resynthesized.librarySource, original.librarySource); | 277 expect(resynthesized.librarySource, original.librarySource); |
| 279 compareLineInfo(resynthesized.lineInfo, original.lineInfo); | 278 compareLineInfo(resynthesized.lineInfo, original.lineInfo); |
| 280 expect(resynthesized.types.length, original.types.length, | 279 expect(resynthesized.types.length, original.types.length, |
| 281 reason: '$desc.types.length'); | 280 reason: '$desc.types.length'); |
| 282 for (int i = 0; i < resynthesized.types.length; i++) { | 281 for (int i = 0; i < resynthesized.types.length; i++) { |
| 283 compareClassElements( | 282 compareClassElements( |
| 284 resynthesized.types[i], original.types[i], original.types[i].name); | 283 resynthesized.types[i], original.types[i], original.types[i].name); |
| 285 } | 284 } |
| 286 expect(resynthesized.topLevelVariables.length, | 285 expect(resynthesized.topLevelVariables.length, |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 compareTypeParameterElements( | 755 compareTypeParameterElements( |
| 757 resynthesized.typeParameters[i], | 756 resynthesized.typeParameters[i], |
| 758 original.typeParameters[i], | 757 original.typeParameters[i], |
| 759 '$desc type parameter ${original.typeParameters[i].name}'); | 758 '$desc type parameter ${original.typeParameters[i].name}'); |
| 760 } | 759 } |
| 761 compareLocalElementsOfExecutable(resynthesized, original, desc); | 760 compareLocalElementsOfExecutable(resynthesized, original, desc); |
| 762 } | 761 } |
| 763 | 762 |
| 764 void compareExportElements(ExportElementImpl resynthesized, | 763 void compareExportElements(ExportElementImpl resynthesized, |
| 765 ExportElementImpl original, String desc) { | 764 ExportElementImpl original, String desc) { |
| 766 compareUriReferencedElements(resynthesized, original, desc); | |
| 767 expect(resynthesized.exportedLibrary.location, | 765 expect(resynthesized.exportedLibrary.location, |
| 768 original.exportedLibrary.location); | 766 original.exportedLibrary.location); |
| 769 expect(resynthesized.combinators.length, original.combinators.length); | 767 expect(resynthesized.combinators.length, original.combinators.length); |
| 770 for (int i = 0; i < resynthesized.combinators.length; i++) { | 768 for (int i = 0; i < resynthesized.combinators.length; i++) { |
| 771 compareNamespaceCombinators( | 769 compareNamespaceCombinators( |
| 772 resynthesized.combinators[i], original.combinators[i]); | 770 resynthesized.combinators[i], original.combinators[i]); |
| 773 } | 771 } |
| 774 } | 772 } |
| 775 | 773 |
| 776 void compareFieldElements( | 774 void compareFieldElements( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 compareTypeParameterElementLists(resynthesized.typeParameters, | 836 compareTypeParameterElementLists(resynthesized.typeParameters, |
| 839 original.typeParameters, '$desc.typeParameters'); | 837 original.typeParameters, '$desc.typeParameters'); |
| 840 compareParameterElementLists( | 838 compareParameterElementLists( |
| 841 resynthesized.parameters, original.parameters, '$desc.parameters'); | 839 resynthesized.parameters, original.parameters, '$desc.parameters'); |
| 842 compareTypes( | 840 compareTypes( |
| 843 resynthesized.returnType, original.returnType, '$desc.returnType'); | 841 resynthesized.returnType, original.returnType, '$desc.returnType'); |
| 844 } | 842 } |
| 845 | 843 |
| 846 void compareImportElements(ImportElementImpl resynthesized, | 844 void compareImportElements(ImportElementImpl resynthesized, |
| 847 ImportElementImpl original, String desc) { | 845 ImportElementImpl original, String desc) { |
| 848 compareUriReferencedElements(resynthesized, original, desc); | |
| 849 expect(resynthesized.importedLibrary.location, | 846 expect(resynthesized.importedLibrary.location, |
| 850 original.importedLibrary.location, | 847 original.importedLibrary.location, |
| 851 reason: '$desc importedLibrary location'); | 848 reason: '$desc importedLibrary location'); |
| 852 expect(resynthesized.prefixOffset, original.prefixOffset, | 849 expect(resynthesized.prefixOffset, original.prefixOffset, |
| 853 reason: '$desc prefixOffset'); | 850 reason: '$desc prefixOffset'); |
| 854 if (original.prefix == null) { | 851 if (original.prefix == null) { |
| 855 expect(resynthesized.prefix, isNull, reason: '$desc prefix'); | 852 expect(resynthesized.prefix, isNull, reason: '$desc prefix'); |
| 856 } else { | 853 } else { |
| 857 comparePrefixElements( | 854 comparePrefixElements( |
| 858 resynthesized.prefix, original.prefix, original.prefix.name); | 855 resynthesized.prefix, original.prefix, original.prefix.name); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 } else if (resynthesized is BottomTypeImpl && original is BottomTypeImpl) { | 1139 } else if (resynthesized is BottomTypeImpl && original is BottomTypeImpl) { |
| 1143 expect(resynthesized, same(original)); | 1140 expect(resynthesized, same(original)); |
| 1144 } else if (resynthesized.runtimeType != original.runtimeType) { | 1141 } else if (resynthesized.runtimeType != original.runtimeType) { |
| 1145 fail('Type mismatch: expected ${original.runtimeType},' | 1142 fail('Type mismatch: expected ${original.runtimeType},' |
| 1146 ' got ${resynthesized.runtimeType} ($desc)'); | 1143 ' got ${resynthesized.runtimeType} ($desc)'); |
| 1147 } else { | 1144 } else { |
| 1148 fail('Unimplemented comparison for ${original.runtimeType}'); | 1145 fail('Unimplemented comparison for ${original.runtimeType}'); |
| 1149 } | 1146 } |
| 1150 } | 1147 } |
| 1151 | 1148 |
| 1152 void compareUriReferencedElements(UriReferencedElementImpl resynthesized, | |
| 1153 UriReferencedElementImpl original, String desc) { | |
| 1154 compareElements(resynthesized, original, desc); | |
| 1155 expect(resynthesized.uri, original.uri, reason: '$desc.uri'); | |
| 1156 expect(resynthesized.uriOffset, original.uriOffset, | |
| 1157 reason: '$desc.uriOffset'); | |
| 1158 expect(resynthesized.uriEnd, original.uriEnd, reason: '$desc.uriEnd'); | |
| 1159 } | |
| 1160 | |
| 1161 void compareVariableElements( | 1149 void compareVariableElements( |
| 1162 VariableElement resynthesized, VariableElement original, String desc) { | 1150 VariableElement resynthesized, VariableElement original, String desc) { |
| 1163 compareElements(resynthesized, original, desc); | 1151 compareElements(resynthesized, original, desc); |
| 1164 compareTypes(resynthesized.type, original.type, '$desc.type'); | 1152 compareTypes(resynthesized.type, original.type, '$desc.type'); |
| 1165 VariableElementImpl resynthesizedActual = | 1153 VariableElementImpl resynthesizedActual = |
| 1166 getActualElement(resynthesized, desc); | 1154 getActualElement(resynthesized, desc); |
| 1167 VariableElementImpl originalActual = getActualElement(original, desc); | 1155 VariableElementImpl originalActual = getActualElement(original, desc); |
| 1168 compareFunctionElements(resynthesizedActual.initializer, | 1156 compareFunctionElements(resynthesizedActual.initializer, |
| 1169 originalActual.initializer, '$desc.initializer'); | 1157 originalActual.initializer, '$desc.initializer'); |
| 1170 if (originalActual is ConstVariableElement) { | 1158 if (originalActual is ConstVariableElement) { |
| (...skipping 5218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6389 '''); | 6377 '''); |
| 6390 if (isStrongMode) { | 6378 if (isStrongMode) { |
| 6391 checkElementText(library, r''' | 6379 checkElementText(library, r''' |
| 6392 export 'foo.dart'; | 6380 export 'foo.dart'; |
| 6393 '''); | 6381 '''); |
| 6394 } else { | 6382 } else { |
| 6395 checkElementText(library, r''' | 6383 checkElementText(library, r''' |
| 6396 export 'foo.dart'; | 6384 export 'foo.dart'; |
| 6397 '''); | 6385 '''); |
| 6398 } | 6386 } |
| 6399 expect(library.exports[0].uri, 'foo.dart'); | |
| 6400 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); | 6387 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); |
| 6401 } | 6388 } |
| 6402 | 6389 |
| 6403 test_export_configurations_useFirst() async { | 6390 test_export_configurations_useFirst() async { |
| 6404 context.declaredVariables.define('dart.library.io', 'true'); | 6391 context.declaredVariables.define('dart.library.io', 'true'); |
| 6405 context.declaredVariables.define('dart.library.html', 'true'); | 6392 context.declaredVariables.define('dart.library.html', 'true'); |
| 6406 addLibrarySource('/foo.dart', 'class A {}'); | 6393 addLibrarySource('/foo.dart', 'class A {}'); |
| 6407 addLibrarySource('/foo_io.dart', 'class A {}'); | 6394 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 6408 addLibrarySource('/foo_html.dart', 'class A {}'); | 6395 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 6409 var library = await checkLibrary(r''' | 6396 var library = await checkLibrary(r''' |
| 6410 export 'foo.dart' | 6397 export 'foo.dart' |
| 6411 if (dart.library.io) 'foo_io.dart' | 6398 if (dart.library.io) 'foo_io.dart' |
| 6412 if (dart.library.html) 'foo_html.dart'; | 6399 if (dart.library.html) 'foo_html.dart'; |
| 6413 '''); | 6400 '''); |
| 6414 if (isStrongMode) { | 6401 if (isStrongMode) { |
| 6415 checkElementText(library, r''' | 6402 checkElementText(library, r''' |
| 6416 export 'foo_io.dart'; | 6403 export 'foo_io.dart'; |
| 6417 '''); | 6404 '''); |
| 6418 } else { | 6405 } else { |
| 6419 checkElementText(library, r''' | 6406 checkElementText(library, r''' |
| 6420 export 'foo_io.dart'; | 6407 export 'foo_io.dart'; |
| 6421 '''); | 6408 '''); |
| 6422 } | 6409 } |
| 6423 expect(library.exports[0].uri, 'foo_io.dart'); | |
| 6424 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); | 6410 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); |
| 6425 } | 6411 } |
| 6426 | 6412 |
| 6427 test_export_configurations_useSecond() async { | 6413 test_export_configurations_useSecond() async { |
| 6428 context.declaredVariables.define('dart.library.io', 'false'); | 6414 context.declaredVariables.define('dart.library.io', 'false'); |
| 6429 context.declaredVariables.define('dart.library.html', 'true'); | 6415 context.declaredVariables.define('dart.library.html', 'true'); |
| 6430 addLibrarySource('/foo.dart', 'class A {}'); | 6416 addLibrarySource('/foo.dart', 'class A {}'); |
| 6431 addLibrarySource('/foo_io.dart', 'class A {}'); | 6417 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 6432 addLibrarySource('/foo_html.dart', 'class A {}'); | 6418 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 6433 var library = await checkLibrary(r''' | 6419 var library = await checkLibrary(r''' |
| 6434 export 'foo.dart' | 6420 export 'foo.dart' |
| 6435 if (dart.library.io) 'foo_io.dart' | 6421 if (dart.library.io) 'foo_io.dart' |
| 6436 if (dart.library.html) 'foo_html.dart'; | 6422 if (dart.library.html) 'foo_html.dart'; |
| 6437 '''); | 6423 '''); |
| 6438 if (isStrongMode) { | 6424 if (isStrongMode) { |
| 6439 checkElementText(library, r''' | 6425 checkElementText(library, r''' |
| 6440 export 'foo_html.dart'; | 6426 export 'foo_html.dart'; |
| 6441 '''); | 6427 '''); |
| 6442 } else { | 6428 } else { |
| 6443 checkElementText(library, r''' | 6429 checkElementText(library, r''' |
| 6444 export 'foo_html.dart'; | 6430 export 'foo_html.dart'; |
| 6445 '''); | 6431 '''); |
| 6446 } | 6432 } |
| 6447 ExportElement export = library.exports[0]; | 6433 ExportElement export = library.exports[0]; |
| 6448 expect(export.uri, 'foo_html.dart'); | |
| 6449 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); | 6434 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); |
| 6450 } | 6435 } |
| 6451 | 6436 |
| 6452 test_export_function() async { | 6437 test_export_function() async { |
| 6453 addLibrarySource('/a.dart', 'f() {}'); | 6438 addLibrarySource('/a.dart', 'f() {}'); |
| 6454 var library = await checkLibrary('export "a.dart";'); | 6439 var library = await checkLibrary('export "a.dart";'); |
| 6455 if (isStrongMode) { | 6440 if (isStrongMode) { |
| 6456 checkElementText(library, r''' | 6441 checkElementText(library, r''' |
| 6457 export 'a.dart'; | 6442 export 'a.dart'; |
| 6458 '''); | 6443 '''); |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7809 allowMissingFiles = true; | 7794 allowMissingFiles = true; |
| 7810 shouldCompareLibraryElements = false; | 7795 shouldCompareLibraryElements = false; |
| 7811 var library = await checkLibrary(''' | 7796 var library = await checkLibrary(''' |
| 7812 @foo | 7797 @foo |
| 7813 import ''; | 7798 import ''; |
| 7814 '''); | 7799 '''); |
| 7815 if (isStrongMode) { | 7800 if (isStrongMode) { |
| 7816 checkElementText(library, r''' | 7801 checkElementText(library, r''' |
| 7817 @ | 7802 @ |
| 7818 foo/*location: null*/ | 7803 foo/*location: null*/ |
| 7819 import ''; | 7804 import '<unresolved>'; |
| 7820 '''); | 7805 '''); |
| 7821 } else { | 7806 } else { |
| 7822 checkElementText(library, r''' | 7807 checkElementText(library, r''' |
| 7823 @ | 7808 @ |
| 7824 foo/*location: null*/ | 7809 foo/*location: null*/ |
| 7825 import ''; | 7810 import '<unresolved>'; |
| 7826 '''); | 7811 '''); |
| 7827 } | 7812 } |
| 7828 } | 7813 } |
| 7829 | 7814 |
| 7830 test_import_multiple_combinators() async { | 7815 test_import_multiple_combinators() async { |
| 7831 addLibrary('dart:async'); | 7816 addLibrary('dart:async'); |
| 7832 var library = await checkLibrary(''' | 7817 var library = await checkLibrary(''' |
| 7833 import "dart:async" hide Stream show Future; | 7818 import "dart:async" hide Stream show Future; |
| 7834 Future f; | 7819 Future f; |
| 7835 '''); | 7820 '''); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7892 | 7877 |
| 7893 test_import_short_absolute() async { | 7878 test_import_short_absolute() async { |
| 7894 testFile = '/my/project/bin/test.dart'; | 7879 testFile = '/my/project/bin/test.dart'; |
| 7895 // Note: "/a.dart" resolves differently on Windows vs. Posix. | 7880 // Note: "/a.dart" resolves differently on Windows vs. Posix. |
| 7896 var destinationPath = | 7881 var destinationPath = |
| 7897 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); | 7882 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); |
| 7898 addLibrarySource(destinationPath, 'class C {}'); | 7883 addLibrarySource(destinationPath, 'class C {}'); |
| 7899 var library = await checkLibrary('import "/a.dart"; C c;'); | 7884 var library = await checkLibrary('import "/a.dart"; C c;'); |
| 7900 if (isStrongMode) { | 7885 if (isStrongMode) { |
| 7901 checkElementText(library, r''' | 7886 checkElementText(library, r''' |
| 7902 import '/a.dart'; | 7887 import 'a.dart'; |
| 7903 C c; | 7888 C c; |
| 7904 '''); | 7889 '''); |
| 7905 } else { | 7890 } else { |
| 7906 checkElementText(library, r''' | 7891 checkElementText(library, r''' |
| 7907 import '/a.dart'; | 7892 import 'a.dart'; |
| 7908 C c; | 7893 C c; |
| 7909 '''); | 7894 '''); |
| 7910 } | 7895 } |
| 7911 } | 7896 } |
| 7912 | 7897 |
| 7913 test_import_show() async { | 7898 test_import_show() async { |
| 7914 addLibrary('dart:async'); | 7899 addLibrary('dart:async'); |
| 7915 var library = await checkLibrary(''' | 7900 var library = await checkLibrary(''' |
| 7916 import "dart:async" show Future, Stream; | 7901 import "dart:async" show Future, Stream; |
| 7917 Future f; | 7902 Future f; |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8904 | 8889 |
| 8905 test_invalidUri_part_emptyUri() async { | 8890 test_invalidUri_part_emptyUri() async { |
| 8906 allowMissingFiles = true; | 8891 allowMissingFiles = true; |
| 8907 shouldCompareLibraryElements = false; | 8892 shouldCompareLibraryElements = false; |
| 8908 var library = await checkLibrary(r''' | 8893 var library = await checkLibrary(r''' |
| 8909 part ''; | 8894 part ''; |
| 8910 class B extends A {} | 8895 class B extends A {} |
| 8911 '''); | 8896 '''); |
| 8912 if (isStrongMode) { | 8897 if (isStrongMode) { |
| 8913 checkElementText(library, r''' | 8898 checkElementText(library, r''' |
| 8914 part ''; | 8899 part '<unresolved>'; |
| 8915 class B { | 8900 class B { |
| 8916 } | 8901 } |
| 8917 -------------------- | 8902 -------------------- |
| 8918 unit: null | 8903 unit: null |
| 8919 | 8904 |
| 8920 '''); | 8905 '''); |
| 8921 } else { | 8906 } else { |
| 8922 checkElementText(library, r''' | 8907 checkElementText(library, r''' |
| 8923 part ''; | 8908 part '<unresolved>'; |
| 8924 class B { | 8909 class B { |
| 8925 } | 8910 } |
| 8926 -------------------- | 8911 -------------------- |
| 8927 unit: null | 8912 unit: null |
| 8928 | 8913 |
| 8929 '''); | 8914 '''); |
| 8930 } | 8915 } |
| 8931 } | 8916 } |
| 8932 | 8917 |
| 8933 test_invalidUris() async { | 8918 test_invalidUris() async { |
| 8934 allowMissingFiles = true; | 8919 allowMissingFiles = true; |
| 8935 shouldCompareLibraryElements = false; | 8920 shouldCompareLibraryElements = false; |
| 8936 var library = await checkLibrary(r''' | 8921 var library = await checkLibrary(r''' |
| 8937 import '[invalid uri]'; | 8922 import '[invalid uri]'; |
| 8938 import '[invalid uri]:foo.dart'; | 8923 import '[invalid uri]:foo.dart'; |
| 8939 import 'a1.dart'; | 8924 import 'a1.dart'; |
| 8940 import '[invalid uri]'; | 8925 import '[invalid uri]'; |
| 8941 import '[invalid uri]:foo.dart'; | 8926 import '[invalid uri]:foo.dart'; |
| 8942 | 8927 |
| 8943 export '[invalid uri]'; | 8928 export '[invalid uri]'; |
| 8944 export '[invalid uri]:foo.dart'; | 8929 export '[invalid uri]:foo.dart'; |
| 8945 export 'a2.dart'; | 8930 export 'a2.dart'; |
| 8946 export '[invalid uri]'; | 8931 export '[invalid uri]'; |
| 8947 export '[invalid uri]:foo.dart'; | 8932 export '[invalid uri]:foo.dart'; |
| 8948 | 8933 |
| 8949 part '[invalid uri]'; | 8934 part '[invalid uri]'; |
| 8950 part 'a3.dart'; | 8935 part 'a3.dart'; |
| 8951 part '[invalid uri]'; | 8936 part '[invalid uri]'; |
| 8952 '''); | 8937 '''); |
| 8953 if (isStrongMode) { | 8938 checkElementText(library, r''' |
| 8954 checkElementText(library, r''' | 8939 import '<unresolved>'; |
| 8955 import '[invalid uri]'; | 8940 import '<unresolved>'; |
| 8956 import '[invalid uri]:foo.dart'; | |
| 8957 import 'a1.dart'; | 8941 import 'a1.dart'; |
| 8958 import '[invalid uri]'; | 8942 import '<unresolved>'; |
| 8959 import '[invalid uri]:foo.dart'; | 8943 import '<unresolved>'; |
| 8960 export '[invalid uri]'; | 8944 export '<unresolved>'; |
| 8961 export '[invalid uri]:foo.dart'; | 8945 export '<unresolved>'; |
| 8962 export 'a2.dart'; | 8946 export 'a2.dart'; |
| 8963 export '[invalid uri]'; | 8947 export '<unresolved>'; |
| 8964 export '[invalid uri]:foo.dart'; | 8948 export '<unresolved>'; |
| 8965 part '[invalid uri]'; | 8949 part '<unresolved>'; |
| 8966 part 'a3.dart'; | 8950 part 'a3.dart'; |
| 8967 part '[invalid uri]'; | 8951 part '<unresolved>'; |
| 8968 -------------------- | 8952 -------------------- |
| 8969 unit: null | 8953 unit: null |
| 8970 | 8954 |
| 8971 -------------------- | |
| 8972 unit: a3.dart | |
| 8973 | |
| 8974 -------------------- | |
| 8975 unit: null | |
| 8976 | |
| 8977 '''); | |
| 8978 } else { | |
| 8979 checkElementText(library, r''' | |
| 8980 import '[invalid uri]'; | |
| 8981 import '[invalid uri]:foo.dart'; | |
| 8982 import 'a1.dart'; | |
| 8983 import '[invalid uri]'; | |
| 8984 import '[invalid uri]:foo.dart'; | |
| 8985 export '[invalid uri]'; | |
| 8986 export '[invalid uri]:foo.dart'; | |
| 8987 export 'a2.dart'; | |
| 8988 export '[invalid uri]'; | |
| 8989 export '[invalid uri]:foo.dart'; | |
| 8990 part '[invalid uri]'; | |
| 8991 part 'a3.dart'; | |
| 8992 part '[invalid uri]'; | |
| 8993 -------------------- | |
| 8994 unit: null | |
| 8995 | |
| 8996 -------------------- | 8955 -------------------- |
| 8997 unit: a3.dart | 8956 unit: a3.dart |
| 8998 | 8957 |
| 8999 -------------------- | 8958 -------------------- |
| 9000 unit: null | 8959 unit: null |
| 9001 | 8960 |
| 9002 '''); | 8961 '''); |
| 9003 } | |
| 9004 } | 8962 } |
| 9005 | 8963 |
| 9006 test_library() async { | 8964 test_library() async { |
| 9007 var library = await checkLibrary(''); | 8965 var library = await checkLibrary(''); |
| 9008 if (isStrongMode) { | 8966 if (isStrongMode) { |
| 9009 checkElementText(library, r''' | 8967 checkElementText(library, r''' |
| 9010 '''); | 8968 '''); |
| 9011 } else { | 8969 } else { |
| 9012 checkElementText(library, r''' | 8970 checkElementText(library, r''' |
| 9013 '''); | 8971 '''); |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11052 } | 11010 } |
| 11053 | 11011 |
| 11054 test_parts_invalidUri() async { | 11012 test_parts_invalidUri() async { |
| 11055 allowMissingFiles = true; | 11013 allowMissingFiles = true; |
| 11056 shouldCompareLibraryElements = false; | 11014 shouldCompareLibraryElements = false; |
| 11057 addSource('/foo/bar.dart', 'part of my.lib;'); | 11015 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 11058 var library = await checkLibrary('library my.lib; part "foo/";'); | 11016 var library = await checkLibrary('library my.lib; part "foo/";'); |
| 11059 if (isStrongMode) { | 11017 if (isStrongMode) { |
| 11060 checkElementText(library, r''' | 11018 checkElementText(library, r''' |
| 11061 library my.lib; | 11019 library my.lib; |
| 11062 part 'foo/'; | 11020 part '<unresolved>'; |
| 11063 -------------------- | 11021 -------------------- |
| 11064 unit: null | 11022 unit: null |
| 11065 | 11023 |
| 11066 '''); | 11024 '''); |
| 11067 } else { | 11025 } else { |
| 11068 checkElementText(library, r''' | 11026 checkElementText(library, r''' |
| 11069 library my.lib; | 11027 library my.lib; |
| 11070 part 'foo/'; | 11028 part '<unresolved>'; |
| 11071 -------------------- | 11029 -------------------- |
| 11072 unit: null | 11030 unit: null |
| 11073 | 11031 |
| 11074 '''); | 11032 '''); |
| 11075 } | 11033 } |
| 11076 } | 11034 } |
| 11077 | 11035 |
| 11078 test_parts_invalidUri_nullStringValue() async { | 11036 test_parts_invalidUri_nullStringValue() async { |
| 11079 allowMissingFiles = true; | 11037 allowMissingFiles = true; |
| 11080 shouldCompareLibraryElements = false; | 11038 shouldCompareLibraryElements = false; |
| 11081 addSource('/foo/bar.dart', 'part of my.lib;'); | 11039 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 11082 var library = await checkLibrary(r''' | 11040 var library = await checkLibrary(r''' |
| 11083 library my.lib; | 11041 library my.lib; |
| 11084 part "${foo}/bar.dart"; | 11042 part "${foo}/bar.dart"; |
| 11085 '''); | 11043 '''); |
| 11086 if (isStrongMode) { | 11044 if (isStrongMode) { |
| 11087 checkElementText(library, r''' | 11045 checkElementText(library, r''' |
| 11088 library my.lib; | 11046 library my.lib; |
| 11089 part ''; | 11047 part '<unresolved>'; |
| 11090 -------------------- | 11048 -------------------- |
| 11091 unit: null | 11049 unit: null |
| 11092 | 11050 |
| 11093 '''); | 11051 '''); |
| 11094 } else { | 11052 } else { |
| 11095 checkElementText(library, r''' | 11053 checkElementText(library, r''' |
| 11096 library my.lib; | 11054 library my.lib; |
| 11097 part ''; | 11055 part '<unresolved>'; |
| 11098 -------------------- | 11056 -------------------- |
| 11099 unit: null | 11057 unit: null |
| 11100 | 11058 |
| 11101 '''); | 11059 '''); |
| 11102 } | 11060 } |
| 11103 } | 11061 } |
| 11104 | 11062 |
| 11105 test_propagated_type_refers_to_closure() async { | 11063 test_propagated_type_refers_to_closure() async { |
| 11106 var library = await checkLibrary(''' | 11064 var library = await checkLibrary(''' |
| 11107 void f() { | 11065 void f() { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11881 } | 11839 } |
| 11882 } | 11840 } |
| 11883 | 11841 |
| 11884 test_type_reference_to_import_export_export_in_subdirs() async { | 11842 test_type_reference_to_import_export_export_in_subdirs() async { |
| 11885 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 11843 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 11886 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); | 11844 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); |
| 11887 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); | 11845 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); |
| 11888 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 11846 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 11889 if (isStrongMode) { | 11847 if (isStrongMode) { |
| 11890 checkElementText(library, r''' | 11848 checkElementText(library, r''' |
| 11891 import 'a/a.dart'; | 11849 import 'a.dart'; |
| 11892 C c; | 11850 C c; |
| 11893 E e; | 11851 E e; |
| 11894 F f; | 11852 F f; |
| 11895 '''); | 11853 '''); |
| 11896 } else { | 11854 } else { |
| 11897 checkElementText(library, r''' | 11855 checkElementText(library, r''' |
| 11898 import 'a/a.dart'; | 11856 import 'a.dart'; |
| 11899 C c; | 11857 C c; |
| 11900 E e; | 11858 E e; |
| 11901 F f; | 11859 F f; |
| 11902 '''); | 11860 '''); |
| 11903 } | 11861 } |
| 11904 } | 11862 } |
| 11905 | 11863 |
| 11906 test_type_reference_to_import_export_in_subdirs() async { | 11864 test_type_reference_to_import_export_in_subdirs() async { |
| 11907 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 11865 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 11908 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); | 11866 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); |
| 11909 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 11867 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 11910 if (isStrongMode) { | 11868 if (isStrongMode) { |
| 11911 checkElementText(library, r''' | 11869 checkElementText(library, r''' |
| 11912 import 'a/a.dart'; | 11870 import 'a.dart'; |
| 11913 C c; | 11871 C c; |
| 11914 E e; | 11872 E e; |
| 11915 F f; | 11873 F f; |
| 11916 '''); | 11874 '''); |
| 11917 } else { | 11875 } else { |
| 11918 checkElementText(library, r''' | 11876 checkElementText(library, r''' |
| 11919 import 'a/a.dart'; | 11877 import 'a.dart'; |
| 11920 C c; | 11878 C c; |
| 11921 E e; | 11879 E e; |
| 11922 F f; | 11880 F f; |
| 11923 '''); | 11881 '''); |
| 11924 } | 11882 } |
| 11925 } | 11883 } |
| 11926 | 11884 |
| 11927 test_type_reference_to_import_part() async { | 11885 test_type_reference_to_import_part() async { |
| 11928 addLibrarySource('/a.dart', 'library l; part "b.dart";'); | 11886 addLibrarySource('/a.dart', 'library l; part "b.dart";'); |
| 11929 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); | 11887 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... |
| 11964 '''); | 11922 '''); |
| 11965 } | 11923 } |
| 11966 } | 11924 } |
| 11967 | 11925 |
| 11968 test_type_reference_to_import_part_in_subdir() async { | 11926 test_type_reference_to_import_part_in_subdir() async { |
| 11969 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); | 11927 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); |
| 11970 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); | 11928 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 11971 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;'); | 11929 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;'); |
| 11972 if (isStrongMode) { | 11930 if (isStrongMode) { |
| 11973 checkElementText(library, r''' | 11931 checkElementText(library, r''' |
| 11974 import 'a/b.dart'; | 11932 import 'b.dart'; |
| 11975 C c; | 11933 C c; |
| 11976 E e; | 11934 E e; |
| 11977 F f; | 11935 F f; |
| 11978 '''); | 11936 '''); |
| 11979 } else { | 11937 } else { |
| 11980 checkElementText(library, r''' | 11938 checkElementText(library, r''' |
| 11981 import 'a/b.dart'; | 11939 import 'b.dart'; |
| 11982 C c; | 11940 C c; |
| 11983 E e; | 11941 E e; |
| 11984 F f; | 11942 F f; |
| 11985 '''); | 11943 '''); |
| 11986 } | 11944 } |
| 11987 } | 11945 } |
| 11988 | 11946 |
| 11989 test_type_reference_to_import_relative() async { | 11947 test_type_reference_to_import_relative() async { |
| 11990 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); | 11948 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); |
| 11991 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); | 11949 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... |
| 13151 fail('Unexpectedly tried to get unlinked summary for $uri'); | 13109 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 13152 } | 13110 } |
| 13153 return serializedUnit; | 13111 return serializedUnit; |
| 13154 } | 13112 } |
| 13155 | 13113 |
| 13156 @override | 13114 @override |
| 13157 bool hasLibrarySummary(String uri) { | 13115 bool hasLibrarySummary(String uri) { |
| 13158 return true; | 13116 return true; |
| 13159 } | 13117 } |
| 13160 } | 13118 } |
| OLD | NEW |