tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

class-definition-null-proto.js (985B)


      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-runtime-semantics-classdefinitionevaluation
      5 es6id: 14.5.14
      6 description: >
      7  The prototype of a null-extending class is %FunctionPrototype%, the prototype of
      8  its "prototype" property is `null`.
      9 info: |
     10  Runtime Semantics: ClassDefinitionEvaluation
     11 
     12  [...]
     13  5. If ClassHeritageopt is not present, then
     14     [...]
     15  6. Else,
     16     [...]
     17     b. Let superclass be the result of evaluating ClassHeritage.
     18     [...]
     19     e. If superclass is null, then
     20         i. Let protoParent be null.
     21        ii. Let constructorParent be the intrinsic object %FunctionPrototype%.
     22  [...]
     23 ---*/
     24 
     25 class Foo extends null {}
     26 
     27 assert.sameValue(Object.getPrototypeOf(Foo.prototype), null);
     28 assert.sameValue(Object.getPrototypeOf(Foo.prototype.constructor), Function.prototype);
     29 assert.sameValue(Foo, Foo.prototype.constructor);
     30 
     31 reportCompare(0, 0);