desc-to-string-symbol.js (661B)
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-symbol-constructor 5 description: The first argument is coerced to a String value (from a Symbol) 6 info: | 7 1. If NewTarget is not undefined, throw a TypeError exception. 8 2. If description is undefined, let descString be undefined. 9 2. Else, let descString be ? ToString(description). 10 3. Return a new unique Symbol value whose [[Description]] value is 11 descString. 12 features: [Symbol] 13 ---*/ 14 15 var s = Symbol('1'); 16 17 assert.throws(TypeError, function() { 18 Symbol(s); 19 }); 20 21 reportCompare(0, 0);