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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 var dart, _js_helper, _js_primitives; 5 var dart, _js_helper, _js_primitives;
6 (function (dart) { 6 (function (dart) {
7 'use strict'; 7 'use strict';
8 8
9 let defineProperty = Object.defineProperty; 9 let defineProperty = Object.defineProperty;
10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 case "number": 938 case "number":
939 case "boolean": 939 case "boolean":
940 case "string": 940 case "string":
941 throw new core.NoSuchMethodError(obj, invocation.memberName, 941 throw new core.NoSuchMethodError(obj, invocation.memberName,
942 invocation.positionalArguments, invocation.namedArguments); 942 invocation.positionalArguments, invocation.namedArguments);
943 } 943 }
944 return obj.noSuchMethod(invocation); 944 return obj.noSuchMethod(invocation);
945 } 945 }
946 dart.noSuchMethod = noSuchMethod; 946 dart.noSuchMethod = noSuchMethod;
947 947
948 class JsIterator {
949 constructor(dartIterator) {
950 this.dartIterator = dartIterator;
951 }
952 next() {
953 let i = this.dartIterator;
954 var done = !i.moveNext();
955 return { done: done, value: done ? void 0 : i.current };
956 }
957 }
958 dart.JsIterator = JsIterator;
959
948 // TODO(jmesserly): right now this is a sentinel. It should be a type object 960 // TODO(jmesserly): right now this is a sentinel. It should be a type object
949 // of some sort, assuming we keep around `dynamic` at runtime. 961 // of some sort, assuming we keep around `dynamic` at runtime.
950 dart.dynamic = { toString() { return 'dynamic'; } }; 962 dart.dynamic = { toString() { return 'dynamic'; } };
951 dart.void = { toString() { return 'void'; } }; 963 dart.void = { toString() { return 'void'; } };
952 dart.bottom = { toString() { return 'bottom'; } }; 964 dart.bottom = { toString() { return 'bottom'; } };
953 965
954 dart.global = window || global; 966 dart.global = window || global;
955 dart.JsSymbol = Symbol; 967 dart.JsSymbol = Symbol;
956 968
957 // TODO(jmesserly): hack to bootstrap the SDK 969 // TODO(jmesserly): hack to bootstrap the SDK
958 _js_helper = _js_helper || {}; 970 _js_helper = _js_helper || {};
959 _js_helper.checkNum = notNull; 971 _js_helper.checkNum = notNull;
960 972
961 _js_primitives = _js_primitives || {}; 973 _js_primitives = _js_primitives || {};
962 _js_primitives.printString = (s) => console.log(s); 974 _js_primitives.printString = (s) => console.log(s);
963 975
964 })(dart || (dart = {})); 976 })(dart || (dart = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698