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

Unified Diff: test/mjsunit/es6/generators-runtime.js

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unneeded bits Created 5 years, 9 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: test/mjsunit/es6/generators-runtime.js
diff --git a/test/mjsunit/es6/generators-runtime.js b/test/mjsunit/es6/generators-runtime.js
index 8fa70b62e0f5a691ed84e55be3d6e661ee428013..dcae06c2a68f46a9bce914c4e60d118191fba9b4 100644
--- a/test/mjsunit/es6/generators-runtime.js
+++ b/test/mjsunit/es6/generators-runtime.js
@@ -36,10 +36,18 @@ var GeneratorFunctionPrototype = Object.getPrototypeOf(g);
var GeneratorFunction = GeneratorFunctionPrototype.constructor;
var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
+
+function removePoisoned(a) {
+ return a.filter(function(k) {
+ return k !== "arguments" && k !== "caller";
+ });
+}
+
+
// A generator function should have the same set of properties as any
// other function.
function TestGeneratorFunctionInstance() {
- var f_own_property_names = Object.getOwnPropertyNames(f);
+ var f_own_property_names = removePoisoned(Object.getOwnPropertyNames(f));
arv (Not doing code reviews) 2015/03/25 13:36:47 Would this test be cleaner if f was strict?
caitp (gmail) 2015/03/25 13:58:09 a strict ordinary function still has the propertie
var g_own_property_names = Object.getOwnPropertyNames(g);
f_own_property_names.sort();
@@ -52,16 +60,7 @@ function TestGeneratorFunctionInstance() {
var f_desc = Object.getOwnPropertyDescriptor(f, prop);
var g_desc = Object.getOwnPropertyDescriptor(g, prop);
assertEquals(f_desc.configurable, g_desc.configurable, prop);
- if (prop === 'arguments' || prop === 'caller') {
- // Unlike sloppy functions, which have read-only data arguments and caller
- // properties, sloppy generators have a poison pill implemented via
- // accessors
- assertFalse('writable' in g_desc, prop);
- assertTrue(g_desc.get instanceof Function, prop);
- assertEquals(g_desc.get, g_desc.set, prop);
- } else {
- assertEquals(f_desc.writable, g_desc.writable, prop);
- }
+ assertEquals(f_desc.writable, g_desc.writable, prop);
assertEquals(f_desc.enumerable, g_desc.enumerable, prop);
}
}

Powered by Google App Engine
This is Rietveld 408576698