| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:12:7: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // foo(late int x) {} |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:15:5: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // bar(late int x) {} |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:20:28: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'. |
| // No types are needed, the first is given by 'on', the second is always 'StackTrace'. |
| // } on dynamic catch (late e, late t) {} |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:20:31: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // } on dynamic catch (late e, late t) {} |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:20:36: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'. |
| // No types are needed, the first is given by 'on', the second is always 'StackTrace'. |
| // } on dynamic catch (late e, late t) {} |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:21:8: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // for (late int i = 0; i < 10; ++i) { |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:24:8: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // for (late String s in ["baz"]) { |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:27:9: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // [for (late int i = 0; i < 10; ++i) i]; |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:31:14: Error: Can't have modifier 'late' here. |
| // Try removing 'late'. |
| // await for (late String s in new Stream.fromIterable(["hest"])) { |
| // ^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:38:20: Error: `await` expressions are not supported in late local initializers. |
| // late String s1 = await hest(); |
| // ^^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:39:30: Error: `await` expressions are not supported in late local initializers. |
| // late String s2 = '${fisk}${await hest()}${fisk}'; |
| // ^^^^^ |
| // |
| // pkg/front_end/testcases/nnbd/later.dart:44:18: Error: Can't have a late final field in a class with a const constructor. |
| // late final int x = 42; |
| // ^ |
| // pkg/front_end/testcases/nnbd/later.dart:46:9: Context: This constructor is const. |
| // const B(); |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| import "dart:_internal" as _in; |
| |
| class A extends core::Object { |
| field core::int a = 42; |
| late field core::int b = this.{self::A::a}{core::int}.{core::num::*}(2){(core::num) → core::int}.{core::int::>>}(1){(core::int) → core::int}; |
| synthetic constructor •() → self::A |
| : super core::Object::•() |
| ; |
| method foo(core::int x) → dynamic {} |
| } |
| class B extends core::Object /*hasConstConstructor*/ { |
| late final field core::int x = 42; |
| const constructor •() → self::B |
| : super core::Object::•() |
| ; |
| } |
| class C extends core::Object { |
| late final [setter] field core::int x; |
| synthetic constructor •() → self::C |
| : super core::Object::•() |
| ; |
| method initVars() → dynamic { |
| this.{self::C::x} = 42; |
| } |
| } |
| static method bar(core::int x) → dynamic {} |
| static method baz() → dynamic { |
| { |
| { |
| invalid-expression "pkg/front_end/testcases/nnbd/later.dart:20:36: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'. |
| No types are needed, the first is given by 'on', the second is always 'StackTrace'. |
| } on dynamic catch (late e, late t) {} |
| ^"; |
| } |
| try { |
| throw "baz"; |
| } |
| on dynamic catch(final dynamic late, final core::StackTrace e) { |
| } |
| } |
| for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) { |
| core::print("baz"); |
| } |
| { |
| core::Iterator<core::String> :sync-for-iterator = core::_GrowableList::_literal1<core::String>("baz").{core::Iterable::iterator}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) { |
| core::String s = :sync-for-iterator.{core::Iterator::current}; |
| { |
| core::print(s); |
| } |
| } |
| } |
| block { |
| final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0); |
| for (core::int i = 0; i.{core::num::<}(10){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) |
| #t1.{core::List::add}(i){(core::int) → void}; |
| } =>#t1; |
| } |
| static method hest() → dynamic /* originally async */ { |
| final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>(); |
| core::bool* :is_sync = false; |
| FutureOr<dynamic>? :return_value; |
| (dynamic) → dynamic :async_op_then; |
| (core::Object, core::StackTrace) → dynamic :async_op_error; |
| core::int :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: |
| { |
| { |
| asy::Stream<core::String> :stream = asy::Stream::fromIterable<core::String>(core::_GrowableList::_literal1<core::String>("hest")); |
| asy::_StreamIterator<core::String>? :for-iterator = new asy::_StreamIterator::•<core::String>(:stream); |
| try |
| #L2: |
| while (true) { |
| dynamic #t2 = asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t3 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(_in::unsafeCast<core::bool>(:result)) { |
| core::String s = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::print(s); |
| } |
| } |
| else |
| break #L2; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t4 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| :return_value = "hest"; |
| break #L1; |
| } |
| asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync); |
| return; |
| } |
| on dynamic catch(dynamic exception, core::StackTrace stack_trace) { |
| asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync); |
| } |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_op.call(); |
| :is_sync = true; |
| return :async_future; |
| } |
| static method fisk() → dynamic /* originally async */ { |
| final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>(); |
| core::bool* :is_sync = false; |
| FutureOr<dynamic>? :return_value; |
| (dynamic) → dynamic :async_op_then; |
| (core::Object, core::StackTrace) → dynamic :async_op_error; |
| core::int :await_jump_var = 0; |
| dynamic :await_ctx_var; |
| function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding |
| try { |
| #L3: |
| { |
| function #s1#initializer() → core::String |
| return invalid-expression "pkg/front_end/testcases/nnbd/later.dart:38:20: Error: `await` expressions are not supported in late local initializers. |
| late String s1 = await hest(); |
| ^^^^^"; |
| late core::String s1 = #s1#initializer.call(); |
| function #s2#initializer() → core::String |
| return "${#C1}${invalid-expression "pkg/front_end/testcases/nnbd/later.dart:39:30: Error: `await` expressions are not supported in late local initializers. |
| late String s2 = '\${fisk}\${await hest()}\${fisk}'; |
| ^^^^^"}${#C1}"; |
| late core::String s2 = #s2#initializer.call(); |
| function #f#initializer() → core::Function |
| return () → asy::Future<dynamic> /* originally async */ { |
| final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>(); |
| core::bool* :is_sync = false; |
| FutureOr<dynamic>? :return_value; |
| (dynamic) → dynamic :async_op_then; |
| (core::Object, core::StackTrace) → dynamic :async_op_error; |
| core::int :await_jump_var = 0; |
| dynamic :await_ctx_var; |
| dynamic :saved_try_context_var0; |
| function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding |
| try { |
| #L4: |
| { |
| [yield] let dynamic #t5 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null; |
| :return_value = :result; |
| break #L4; |
| } |
| asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync); |
| return; |
| } |
| on dynamic catch(dynamic exception, core::StackTrace stack_trace) { |
| asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync); |
| } |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_op.call(); |
| :is_sync = true; |
| return :async_future; |
| }; |
| late core::Function f = #f#initializer.call(); |
| } |
| asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync); |
| return; |
| } |
| on dynamic catch(dynamic exception, core::StackTrace stack_trace) { |
| asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync); |
| } |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_op.call(); |
| :is_sync = true; |
| return :async_future; |
| } |
| static method main() → dynamic {} |
| |
| constants { |
| #C1 = tearoff self::fisk |
| } |