summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js
blob: efdb8d32990d9802cad7d679d04765d801ea3c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
  The `this` value of a null-extending class isn't automatically initialized,
  which makes it necessary to have an explicit return value in the constructor.
info: |
  Runtime Semantics: ClassDefinitionEvaluation

  [...]
  5. If ClassHeritageopt is not present, then
     [...]
  6. Else,
     [...]
     b. Let superclass be the result of evaluating ClassHeritage.
  [...]
  15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
  [...]

  9.2.2 [[Construct]]

  [...]
  15. Return ? envRec.GetThisBinding().

  8.1.1.3.4 GetThisBinding ( )
  [...]
  3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError exception.
  [...]
---*/

class Foo extends null {
  constructor() {
  }
}

assert.throws(ReferenceError, function() {
  new C();
});

reportCompare(0, 0);