Debian Codegraph @

js/src/tests/test262/annexB/language/statements/class/subclass/superclass-emulates-undefined.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. 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 description: >
6 [[IsHTMLDDA]] object as superclass: `null` check uses strict equality.
7 IsConstructor check is performed before "prototype" lookup.
8 info: |
9 ClassDefinitionEvaluation
10
11 [...]
12 5. Else,
13 [...]
14 d. Let superclass be ? GetValue(superclassRef).
15 e. If superclass is null, then
16 [...]
17 f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
18 features: [class, IsHTMLDDA]
19 ---*/
20
21 var superclass = $262.IsHTMLDDA;
22 var prototypeGets = 0;
23 Object.defineProperty(superclass, "prototype", {
24 get: function() {
25 prototypeGets += 1;
26 },
27 });
28
29 assert.throws(TypeError, function() {
30 class C extends superclass {}
31 });
32
33 assert.sameValue(prototypeGets, 0);
34
35 reportCompare(0, 0);