Set @@toStringTag on GeneratorFunction prototype.
authordslomov <dslomov@chromium.org>
Thu, 27 Nov 2014 16:09:31 +0000 (08:09 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 27 Nov 2014 16:09:43 +0000 (16:09 +0000)
R=caitpotter88@gmail.com
BUG=v8:3502
LOG=N

Review URL: https://codereview.chromium.org/764823002

Cr-Commit-Position: refs/heads/master@{#25550}

src/generator.js
test/mjsunit/es6/generators-objects.js

index 19e7db8..8e9ed8f 100644 (file)
@@ -101,6 +101,8 @@ function SetUpGenerators() {
   %AddNamedProperty(GeneratorObjectPrototype,
       symbolToStringTag, "Generator", DONT_ENUM | READ_ONLY);
   %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype);
+  %AddNamedProperty(GeneratorFunctionPrototype,
+      symbolToStringTag, "GeneratorFunction", DONT_ENUM | READ_ONLY);
   %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
   %AddNamedProperty(GeneratorFunctionPrototype, "constructor",
       GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
index 25bd0de..8039ca8 100644 (file)
@@ -67,6 +67,8 @@ function TestGeneratorObject() {
   assertEquals("Generator", %_ClassOf(iter));
   assertEquals("[object Generator]", String(iter));
   assertEquals("[object Generator]", Object.prototype.toString.call(iter));
+  var gf = iter.__proto__.constructor;
+  assertEquals("[object GeneratorFunction]", Object.prototype.toString.call(gf));
   assertEquals([], Object.getOwnPropertyNames(iter));
   assertTrue(iter !== new g());
 }