| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.non_error_resolver_test; | 5 library engine.non_error_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 void test_async_future_without_return() { | 480 void test_async_future_without_return() { |
| 481 Source source = addSource(''' | 481 Source source = addSource(''' |
| 482 import 'dart:async'; | 482 import 'dart:async'; |
| 483 Future f() async {} | 483 Future f() async {} |
| 484 '''); | 484 '''); |
| 485 resolve(source); | 485 resolve(source); |
| 486 assertNoErrors(source); | 486 assertNoErrors(source); |
| 487 verify([source]); | 487 verify([source]); |
| 488 } | 488 } |
| 489 | 489 |
| 490 void test_async_return_flattens_futures() { |
| 491 Source source = addSource(''' |
| 492 import 'dart:async'; |
| 493 Future<int> f() async { |
| 494 return g(); |
| 495 } |
| 496 Future<Future<int>> g() => null; |
| 497 '''); |
| 498 resolve(source); |
| 499 assertNoErrors(source); |
| 500 verify([source]); |
| 501 } |
| 502 |
| 490 void test_async_with_return() { | 503 void test_async_with_return() { |
| 491 Source source = addSource(''' | 504 Source source = addSource(''' |
| 492 f() async { | 505 f() async { |
| 493 return; | 506 return; |
| 494 } | 507 } |
| 495 '''); | 508 '''); |
| 496 resolve(source); | 509 resolve(source); |
| 497 assertNoErrors(source); | 510 assertNoErrors(source); |
| 498 verify([source]); | 511 verify([source]); |
| 499 } | 512 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 Source source = addSource(r''' | 546 Source source = addSource(r''' |
| 534 f(list) async* { | 547 f(list) async* { |
| 535 await for (var e in list) { | 548 await for (var e in list) { |
| 536 } | 549 } |
| 537 }'''); | 550 }'''); |
| 538 resolve(source); | 551 resolve(source); |
| 539 assertNoErrors(source); | 552 assertNoErrors(source); |
| 540 verify([source]); | 553 verify([source]); |
| 541 } | 554 } |
| 542 | 555 |
| 556 void test_await_flattened() { |
| 557 Source source = addSource(''' |
| 558 import 'dart:async'; |
| 559 Future<Future<int>> ffi() => null; |
| 560 f() async { |
| 561 int b = await ffi(); |
| 562 } |
| 563 '''); |
| 564 resolve(source); |
| 565 assertNoErrors(source); |
| 566 verify([source]); |
| 567 } |
| 568 |
| 569 void test_await_simple() { |
| 570 Source source = addSource(''' |
| 571 import 'dart:async'; |
| 572 Future<int> fi() => null; |
| 573 f() async { |
| 574 int a = await fi(); |
| 575 } |
| 576 '''); |
| 577 resolve(source); |
| 578 assertNoErrors(source); |
| 579 verify([source]); |
| 580 } |
| 581 |
| 543 void test_awaitInWrongContext_async() { | 582 void test_awaitInWrongContext_async() { |
| 544 Source source = addSource(r''' | 583 Source source = addSource(r''' |
| 545 f(x, y) async { | 584 f(x, y) async { |
| 546 return await x + await y; | 585 return await x + await y; |
| 547 }'''); | 586 }'''); |
| 548 resolve(source); | 587 resolve(source); |
| 549 assertNoErrors(source); | 588 assertNoErrors(source); |
| 550 verify([source]); | 589 verify([source]); |
| 551 } | 590 } |
| 552 | 591 |
| (...skipping 4748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5301 resolve(source); | 5340 resolve(source); |
| 5302 assertNoErrors(source); | 5341 assertNoErrors(source); |
| 5303 verify([source]); | 5342 verify([source]); |
| 5304 reset(); | 5343 reset(); |
| 5305 } | 5344 } |
| 5306 | 5345 |
| 5307 void _check_wrongNumberOfParametersForOperator1(String name) { | 5346 void _check_wrongNumberOfParametersForOperator1(String name) { |
| 5308 _check_wrongNumberOfParametersForOperator(name, "a"); | 5347 _check_wrongNumberOfParametersForOperator(name, "a"); |
| 5309 } | 5348 } |
| 5310 } | 5349 } |
| OLD | NEW |