Files
sdk/pkg/dev_compiler/test/codegen/syncstar_syntax.dart
T
John Messerly 98d14b14da initial sync*, part of #221
Right now it maps straight to ES6 generators. This should handle some basic cases, but there's more work to get all of the corners working. For example: it doesn't implement Iterable yet.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1207313002.
2015-06-26 16:02:30 -07:00

33 lines
625 B
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Iterable<int> foo() sync* {
yield 1;
yield* [2, 3];
}
class Class {
Iterable<int> bar() sync* {
yield 1;
yield* [2, 3];
}
static Iterable<int> baz() sync* {
yield 1;
yield* [2, 3];
}
}
main() {
Iterable<int> qux() sync* {
yield 1;
yield* [2, 3];
}
foo().forEach(print);
new Class().bar().forEach(print);
Class.baz().forEach(print);
qux().forEach(print);
}