default-proto.js (1163B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-generator-function-definitions-runtime-semantics-evaluatebody 5 es6id: 14.4.11 6 description: Intrinsic default prototype of GeneratorFunctions 7 info: | 8 1. Let G be ? OrdinaryCreateFromConstructor(functionObject, 9 "%GeneratorPrototype%", « [[GeneratorState]], [[GeneratorContext]] »). 10 [...] 11 12 9.1.13 OrdinaryCreateFromConstructor 13 14 [...] 15 2. Let proto be ? GetPrototypeFromConstructor(constructor, 16 intrinsicDefaultProto). 17 3. Return ObjectCreate(proto, internalSlotsList). 18 19 9.1.14 GetPrototypeFromConstructor 20 21 [...] 22 3. Let proto be ? Get(constructor, "prototype"). 23 4. If Type(proto) is not Object, then 24 a. Let realm be ? GetFunctionRealm(constructor). 25 b. Let proto be realm's intrinsic object named intrinsicDefaultProto. 26 [...] 27 features: [generators] 28 ---*/ 29 30 function* g() {} 31 var GeneratorPrototype = Object.getPrototypeOf(g).prototype; 32 g.prototype = null; 33 34 assert.sameValue(Object.getPrototypeOf(g()), GeneratorPrototype); 35 36 reportCompare(0, 0);