Debian Codegraph @

js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-strict-strict.js

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