prop-expr-obj-key-err.js (839B)
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: Abrupt completion from type coercion of property key 7 info: | 8 1. Let propertyNameReference be the result of evaluating Expression. 9 2. Let propertyNameValue be ? GetValue(propertyNameReference). 10 3. Let propertyKey be ? ToPropertyKey(propertyNameValue). 11 12 7.1.14 ToPropertyKey 13 14 1. Let key be ? ToPrimitive(argument, hint String). 15 ---*/ 16 17 var thrown = new Test262Error(); 18 var badToString = { 19 toString: function() { 20 throw thrown; 21 } 22 }; 23 var caught; 24 var obj = { 25 method() { 26 try { 27 super[badToString]; 28 } catch (err) { 29 caught = err; 30 } 31 } 32 }; 33 34 obj.method(); 35 36 assert.sameValue(caught, thrown); 37 38 reportCompare(0, 0);