ArrowFunction_restricted-properties.js (956B)
1 // Copyright (C) 2015 Caitlin Potter. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 Functions created using ArrowFunction syntactic form do not have 7 own properties "caller" or "arguments", but inherit them from 8 %FunctionPrototype%. 9 es6id: 16.1 10 ---*/ 11 12 var arrowFn = () => {}; 13 14 assert.sameValue(arrowFn.hasOwnProperty('caller'), false, 'Functions created using ArrowFunction syntactic form do not have own property "caller"'); 15 assert.sameValue(arrowFn.hasOwnProperty('arguments'), false, 'Functions created using ArrowFunction syntactic form do not have own property "arguments"'); 16 17 assert.throws(TypeError, function() { 18 return arrowFn.caller; 19 }); 20 21 assert.throws(TypeError, function() { 22 arrowFn.caller = {}; 23 }); 24 25 assert.throws(TypeError, function() { 26 return arrowFn.arguments; 27 }); 28 29 assert.throws(TypeError, function() { 30 arrowFn.arguments = {}; 31 }); 32 33 reportCompare(0, 0);