Files
sdk/pkg/front_end/testcases/async_nested.dart.direct.expect
T
Daniel Hillerström 98a9adf696 Make constructor function types conform with the specification.
Prior to this CL the return type of any constructor function was
always void. According to the specification §9.3 the return type of a
constructor function ought to be its enclosing class.

Change-Id: I70d76cc354b7f118ce96bf4954daf7fe535eb7be
Reviewed-on: https://dart-review.googlesource.com/76160
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-26 09:39:11 +00:00

27 lines
1.7 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
class Node extends core::Object {
final field core::List<self::Node> nested;
final field core::String name;
constructor •(core::String name, [core::List<self::Node> nested = null]) → self::Node
: self::Node::name = name, self::Node::nested = nested, super core::Object::•() {}
method toString() → core::String
return "<${this.{self::Node::name}}:[${let final dynamic #t1 = this.{self::Node::nested} in #t1.==(null) ? null : #t1.join(", ")}]>";
method toSimpleString() → dynamic {
dynamic tmp = let final dynamic #t2 = this.{self::Node::nested} in #t2.==(null) ? null : #t2.map((dynamic child) → dynamic => child.toSimpleString());
return "${this.{self::Node::name}} ${let final dynamic #t3 = tmp in #t3.==(null) ? null : #t3.join(" ")}".trim();
}
}
static method main() → void async {
core::String expected = "1 2 3 4 5 6 7 8 9 10";
self::Node node = new self::Node::•("1", <dynamic>[new self::Node::•("2", <dynamic>[]), await asy::Future::value<dynamic>(new self::Node::•("3", <dynamic>[await asy::Future::value<dynamic>(new self::Node::•("4", <dynamic>[new self::Node::•("5", <dynamic>[await asy::Future::value<dynamic>(new self::Node::•("6", <dynamic>[await asy::Future::value<dynamic>(new self::Node::•("7", <dynamic>[]))])), await asy::Future::value<dynamic>(new self::Node::•("8", <dynamic>[])), await asy::Future::value<dynamic>(new self::Node::•("9", <dynamic>[]))])]))])), await asy::Future::value<dynamic>(new self::Node::•("10", <dynamic>[]))]);
core::String actual = node.toSimpleString();
core::print(actual);
if(!actual.==(expected)) {
throw "Expected '${expected}' but got '${actual}'";
}
}