Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: pkg/front_end/testcases/inference/local_return_and_yield.dart.strong.expect

Issue 2899073004: Use declared return type for inference of return and yield statements. (Closed)
Patch Set: Simpler implementation Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/testcases/inference/local_return_and_yield.dart.strong.expect
diff --git a/pkg/front_end/testcases/inference/local_return_and_yield.dart.strong.expect b/pkg/front_end/testcases/inference/local_return_and_yield.dart.strong.expect
new file mode 100644
index 0000000000000000000000000000000000000000..980010ba0b01cac1d013bd181e9a079574a15fb9
--- /dev/null
+++ b/pkg/front_end/testcases/inference/local_return_and_yield.dart.strong.expect
@@ -0,0 +1,127 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+typedef IntToInt = (core::int) → core::int;
+static method main() → dynamic {
+ function a() → (core::int) → core::int {
+ return (core::int x) → core::int => x;
+ }
+ function b() → asy::Future<(core::int) → core::int> /* originally async */ {
+ final asy::Completer<asy::FutureOr<(core::int) → core::int>> :completer = asy::Completer::sync<asy::FutureOr<(core::int) → core::int>>();
+ asy::FutureOr<(core::int) → core::int> :return_value;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :return_value = (dynamic x) → dynamic => x;
+ break #L1;
+ }
+ :completer.complete(:return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :completer.completeError(:exception, :stack_trace);
+ }
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ asy::Future::microtask<dynamic>(:async_op);
+ return :completer.future;
+ }
+ function c() → core::Iterable<(core::int) → core::int> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::Iterator<dynamic> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator._current = (core::int x) → core::int => x;
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•(:sync_op);
+ }
+ function d() → core::Iterable<(core::int) → core::int> /* originally sync* */ {
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :sync_op(core::Iterator<dynamic> :iterator) → core::bool yielding {
+ {
+ {
+ :iterator.isYieldEach = true;
+ :iterator._current = <(core::int) → core::int>[(core::int x) → core::int => x];
+ [yield] true;
+ }
+ }
+ return false;
+ }
+ return new core::_SyncIterable::•(:sync_op);
+ }
+ function e() → asy::Stream<(core::int) → core::int> /* originally async* */ {
+ dynamic :controller;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L2:
+ {
+ if(:controller.add((core::int x) → core::int => x))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.addError(:exception, :stack_trace);
+ }
+ finally {
+ :controller.close();
+ }
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•(:async_op);
+ return :controller.stream;
+ }
+ function f() → asy::Stream<(core::int) → core::int> /* originally async* */ {
+ dynamic :controller;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ dynamic :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ dynamic :saved_try_context_var1;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try
+ try {
+ #L3:
+ {
+ if(:controller.addStream(asy::Stream::fromIterable<(core::int) → core::int>(<(core::int) → core::int>[(core::int x) → core::int => x])))
+ return null;
+ else
+ [yield] null;
+ }
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :controller.addError(:exception, :stack_trace);
+ }
+ finally {
+ :controller.close();
+ }
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :controller = new asy::_AsyncStarStreamController::•(:async_op);
+ return :controller.stream;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698