prop-expr-obj-null-proto.js (1118B)
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: > 7 SuperProperty evaluation when the "home" object's prototype is not 8 object-coercible. 9 info: | 10 [...] 11 4. If the code matched by the syntactic production that is being evaluated is 12 strict mode code, let strict be true, else let strict be false. 13 5. Return ? MakeSuperPropertyReference(propertyKey, strict). 14 15 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference 16 17 1. Let env be GetThisEnvironment( ). 18 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. 19 3. Let actualThis be ? env.GetThisBinding(). 20 4. Let baseValue be ? env.GetSuperBase(). 21 5. Let bv be ? RequireObjectCoercible(baseValue). 22 ---*/ 23 24 var caught; 25 var obj = { 26 method() { 27 try { 28 super['x']; 29 } catch (err) { 30 caught = err; 31 } 32 } 33 }; 34 Object.setPrototypeOf(obj, null); 35 36 obj.method(); 37 38 assert.sameValue(typeof caught, 'object'); 39 assert.sameValue(caught.constructor, TypeError); 40 41 reportCompare(0, 0);