Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/super/prop-expr-cls-ref-strict.js

raw
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-super-keyword
5 es6id: 12.3.5
6 description: SuperProperty's behavior as a strict reference
7 info: |
8 [...]
9 4. If the code matched by the syntactic production that is being evaluated is
10 strict mode code, let strict be true, else let strict be false.
11 5. Return ? MakeSuperPropertyReference(propertyKey, strict).
12
13 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference
14
15 1. Let env be GetThisEnvironment( ).
16 2. If env.HasSuperBinding() is false, throw a ReferenceError exception.
17 3. Let actualThis be ? env.GetThisBinding().
18 4. Let baseValue be ? env.GetSuperBase().
19 5. Let bv be ? RequireObjectCoercible(baseValue).
20 6. Return a value of type Reference that is a Super Reference whose base
21 value component is bv, whose referenced name component is propertyKey,
22 whose thisValue component is actualThis, and whose strict reference flag
23 is strict.
24
25 6.2.3.2 PutValue
26
27 [...]
28 5. If IsUnresolvableReference(V) is true, then
29 [...]
30 6. Else if IsPropertyReference(V) is true, then
31 a. If HasPrimitiveBase(V) is true, then
32 [...]
33 b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W,
34 GetThisValue(V)).
35 c. If succeeded is false and IsStrictReference(V) is true, throw a
36 TypeError exception.
37 features: [class]
38 ---*/
39
40 var caught;
41 class C {
42 method() {
43 super['x'] = 8;
44 Object.freeze(C.prototype);
45 try {
46 super['y'] = 9;
47 } catch (err) {
48 caught = err;
49 }
50 }
51 }
52
53 C.prototype.method();
54
55 assert.sameValue(typeof caught, 'object');
56 assert.sameValue(caught.constructor, TypeError);