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

Unified Diff: lib/runtime/dart_runtime.js

Issue 1126713002: fixes #130, accept anything with `iterator` in for loops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix iterator Created 5 years, 8 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: lib/runtime/dart_runtime.js
diff --git a/lib/runtime/dart_runtime.js b/lib/runtime/dart_runtime.js
index 5a604177545aaa5ed55a9d3260f0d04d271509e2..b0e879e0a50402c807072554599b76778a1ee543 100644
--- a/lib/runtime/dart_runtime.js
+++ b/lib/runtime/dart_runtime.js
@@ -945,6 +945,18 @@ var dart, _js_helper, _js_primitives;
}
dart.noSuchMethod = noSuchMethod;
+ class JsIterator {
+ constructor(dartIterator) {
+ this.dartIterator = dartIterator;
+ }
+ next() {
+ let i = this.dartIterator;
+ var done = !i.moveNext();
+ return { done: done, value: done ? void 0 : i.current };
+ }
+ }
+ dart.JsIterator = JsIterator;
+
// TODO(jmesserly): right now this is a sentinel. It should be a type object
// of some sort, assuming we keep around `dynamic` at runtime.
dart.dynamic = { toString() { return 'dynamic'; } };

Powered by Google App Engine
This is Rietveld 408576698