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

Unified Diff: src/js/harmony-reflect.js

Issue 1397443013: [es6] Implement Reflect.enumerate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/harmony-reflect.js
diff --git a/src/js/harmony-reflect.js b/src/js/harmony-reflect.js
index f1fe8605e54b090679afb867c0de14feeb30c076..76effa1e3fd833a8c2d6b646be2a27b16a197b84 100644
--- a/src/js/harmony-reflect.js
+++ b/src/js/harmony-reflect.js
@@ -1,4 +1,4 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
+// Copyright 2013-2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,9 +12,16 @@ var GlobalReflect = global.Reflect;
var ReflectApply = utils.ImportNow("reflect_apply");
var ReflectConstruct = utils.ImportNow("reflect_construct");
+function ReflectEnumerate(obj) {
+ if (!IS_SPEC_OBJECT(obj))
+ throw MakeTypeError(kCalledOnNonObject, "Reflect.enumerate")
+ return (function* () { for (var x in obj) yield x })();
+}
+
utils.InstallFunctions(GlobalReflect, DONT_ENUM, [
"apply", ReflectApply,
- "construct", ReflectConstruct
+ "construct", ReflectConstruct,
+ "enumerate", ReflectEnumerate
]);
})
« no previous file with comments | « no previous file | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698