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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 abstract class ResynthesizeTest extends AbstractResynthesizeTest { | 1355 abstract class ResynthesizeTest extends AbstractResynthesizeTest { |
1356 Future<LibraryElementImpl> checkLibrary(String text, | 1356 Future<LibraryElementImpl> checkLibrary(String text, |
1357 {bool allowErrors: false, bool dumpSummaries: false}); | 1357 {bool allowErrors: false, bool dumpSummaries: false}); |
1358 | 1358 |
1359 /** | 1359 /** |
1360 * Return a [SummaryResynthesizer] to resynthesize the library with the | 1360 * Return a [SummaryResynthesizer] to resynthesize the library with the |
1361 * given [librarySource]. | 1361 * given [librarySource]. |
1362 */ | 1362 */ |
1363 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource); | 1363 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource); |
1364 | 1364 |
1365 fail_library_hasExtUri() async { | |
1366 var library = await checkLibrary('import "dart-ext:doesNotExist.dart";'); | |
1367 if (isStrongMode) { | |
1368 checkElementText( | |
1369 library, | |
1370 r''' | |
1371 '''); | |
1372 } else { | |
1373 checkElementText( | |
1374 library, | |
1375 r''' | |
1376 '''); | |
1377 } | |
1378 } | |
1379 | |
1380 test_class_abstract() async { | 1365 test_class_abstract() async { |
1381 var library = await checkLibrary('abstract class C {}'); | 1366 var library = await checkLibrary('abstract class C {}'); |
1382 if (isStrongMode) { | 1367 if (isStrongMode) { |
1383 checkElementText( | 1368 checkElementText( |
1384 library, | 1369 library, |
1385 r''' | 1370 r''' |
1386 abstract class C { | 1371 abstract class C { |
1387 } | 1372 } |
1388 '''); | 1373 '''); |
1389 } else { | 1374 } else { |
(...skipping 7113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8503 library, | 8488 library, |
8504 r''' | 8489 r''' |
8505 import 'dart:async'; | 8490 import 'dart:async'; |
8506 const dynamic x = | 8491 const dynamic x = |
8507 FutureOr/*location: dart:async;FutureOr*/; | 8492 FutureOr/*location: dart:async;FutureOr*/; |
8508 '''); | 8493 '''); |
8509 } | 8494 } |
8510 var variables = library.definingCompilationUnit.topLevelVariables; | 8495 var variables = library.definingCompilationUnit.topLevelVariables; |
8511 expect(variables, hasLength(1)); | 8496 expect(variables, hasLength(1)); |
8512 var x = variables[0] as ConstTopLevelVariableElementImpl; | 8497 var x = variables[0] as ConstTopLevelVariableElementImpl; |
8513 if (createOptions().strongMode) { | 8498 if (isStrongMode) { |
8514 expect(x.type.toString(), 'Type'); | 8499 expect(x.type.toString(), 'Type'); |
8515 } else { | 8500 } else { |
8516 expect(x.type.toString(), 'dynamic'); | 8501 expect(x.type.toString(), 'dynamic'); |
8517 } | 8502 } |
8518 expect(x.constantInitializer.toString(), 'FutureOr'); | 8503 expect(x.constantInitializer.toString(), 'FutureOr'); |
8519 } | 8504 } |
8520 | 8505 |
8521 test_futureOr_inferred() async { | 8506 test_futureOr_inferred() async { |
8522 var library = await checkLibrary(''' | 8507 var library = await checkLibrary(''' |
8523 import "dart:async"; | 8508 import "dart:async"; |
(...skipping 6788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15312 fail('Unexpectedly tried to get unlinked summary for $uri'); | 15297 fail('Unexpectedly tried to get unlinked summary for $uri'); |
15313 } | 15298 } |
15314 return serializedUnit; | 15299 return serializedUnit; |
15315 } | 15300 } |
15316 | 15301 |
15317 @override | 15302 @override |
15318 bool hasLibrarySummary(String uri) { | 15303 bool hasLibrarySummary(String uri) { |
15319 return true; | 15304 return true; |
15320 } | 15305 } |
15321 } | 15306 } |
OLD | NEW |