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

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

Issue 2908973002: Add type inference logic for "for-in" loops. (Closed)
Patch Set: 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/downwards_inference_for_each.dart.strong.expect
diff --git a/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.expect
new file mode 100644
index 0000000000000000000000000000000000000000..8d4b963187f9e87d9d136dc7b9fa8651259a4e1e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.expect
@@ -0,0 +1,229 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+abstract class MyStream<T extends core::Object> extends asy::Stream<self::MyStream::T> {
+ static factory •<T extends core::Object>() → dynamic
+ return null;
+}
+static method F<T extends core::Object>() → self::F::T
+ return null;
+static method f() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<asy::FutureOr<dynamic>> :completer = asy::Completer::sync<asy::FutureOr<dynamic>>();
+ asy::FutureOr<dynamic> :return_value;
+ 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;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ dynamic d;
+ core::Object o;
+ for (dynamic x in self::F<dynamic>()) {
+ }
+ for (dynamic x in self::F<core::Iterable<dynamic>>()) {
+ }
+ for (core::Object x in self::F<core::Iterable<core::Object>>()) {
+ }
+ for (final dynamic #t1 in self::F<dynamic>()) {
+ d = #t1;
+ }
+ for (final dynamic #t2 in self::F<dynamic>()) {
+ o = #t2;
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L2:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ dynamic x = :for-iterator.current;
+ {}
+ }
+ else
+ break #L2;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<asy::Stream<dynamic>>());
+ try
+ #L3:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ dynamic x = :for-iterator.current;
+ {}
+ }
+ else
+ break #L3;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<asy::Stream<core::Object>>());
+ try
+ #L4:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ core::Object x = :for-iterator.current;
+ {}
+ }
+ else
+ break #L4;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L5:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ final dynamic #t3 = :for-iterator.current;
+ {
+ d = #t3;
+ }
+ }
+ else
+ break #L5;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::F<dynamic>());
+ try
+ #L6:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ final dynamic #t4 = :for-iterator.current;
+ {
+ o = #t4;
+ }
+ }
+ else
+ break #L6;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ }
+ :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;
+}
+static method main() → asy::Future<dynamic> /* originally async */ {
+ final asy::Completer<asy::FutureOr<dynamic>> :completer = asy::Completer::sync<asy::FutureOr<dynamic>>();
+ asy::FutureOr<dynamic> :return_value;
+ 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;
+ dynamic :exception0;
+ dynamic :stack_trace0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L7:
+ {
+ for (core::int x in <core::int>[1, 2, 3]) {
+ }
+ for (core::num x in <core::num>[1, 2, 3]) {
+ }
+ for (core::int x in <core::int>[1, 2, 3]) {
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::MyStream::•<core::int>());
+ try
+ #L8:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ core::int x = :for-iterator.current;
+ {}
+ }
+ else
+ break #L8;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ {
+ dynamic :for-iterator = new asy::_StreamIterator::•<dynamic>(self::MyStream::•<core::int>());
+ try
+ #L9:
+ while (true) {
+ asy::_awaitHelper(:for-iterator.moveNext(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ if(:result) {
+ core::int x = :for-iterator.current;
+ {}
+ }
+ else
+ break #L9;
+ }
+ finally {
+ asy::_awaitHelper(:for-iterator.cancel(), :async_op_then, :async_op_error, :async_op);
+ [yield] null;
+ :result;
+ }
+ }
+ }
+ :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;
+}

Powered by Google App Engine
This is Rietveld 408576698