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

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

Issue 1982203003: [runtime] Fix effect of setting .prototype on generator functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ignition test rebaseline Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/CallRuntime.golden ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/generators-objects.js
diff --git a/test/mjsunit/es6/generators-objects.js b/test/mjsunit/es6/generators-objects.js
index a0c3b809be522cd83641a186d413696bae6d2d83..2d238412ca5c8716097000edba2fd1f651f1bbb9 100644
--- a/test/mjsunit/es6/generators-objects.js
+++ b/test/mjsunit/es6/generators-objects.js
@@ -87,3 +87,29 @@ function TestGeneratorObjectMethods() {
TestNonGenerator(g.prototype);
}
TestGeneratorObjectMethods();
+
+
+function TestPrototype() {
+ function* g() { }
+
+ let g_prototype = g.prototype;
+ assertEquals([], Reflect.ownKeys(g_prototype));
+
+ let generator_prototype = Object.getPrototypeOf(g_prototype);
+ assertSame(generator_prototype, Object.getPrototypeOf(g).prototype);
+
+ // Unchanged .prototype
+ assertSame(g_prototype, Object.getPrototypeOf(g()));
+
+ // Custom object as .prototype
+ {
+ let proto = {};
+ g.prototype = proto;
+ assertSame(proto, Object.getPrototypeOf(g()));
+ }
+
+ // Custom non-object as .prototype
+ g.prototype = null;
+ assertSame(generator_prototype, Object.getPrototypeOf(g()));
+}
+TestPrototype();
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/CallRuntime.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698