Object-parameterNames.js (1058B)
1 load(libdir + 'array-compare.js'); 2 3 var g = newGlobal({newCompartment: true}); 4 var dbg = new Debugger; 5 var gDO = dbg.addDebuggee(g); 6 var hits = 0; 7 8 function check(expr, expected) { 9 print("checking " + JSON.stringify(expr)); 10 11 let completion = gDO.executeInGlobal(expr); 12 if (completion.throw) 13 throw completion.throw.unsafeDereference(); 14 15 let fn = completion.return; 16 if (expected === undefined) 17 assertEq(fn.parameterNames, undefined); 18 else 19 assertEq(arraysEqual(fn.parameterNames, expected), true); 20 } 21 22 check('(function () {})', []); 23 check('(function (x) {})', ["x"]); 24 check('(function (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) {})', 25 ["a","b","c","d","e","f","g","h","i","j","k","l","m", 26 "n","o","p","q","r","s","t","u","v","w","x","y","z"]); 27 check('(function (a, [b, c], {d, e:f}) { })', 28 ["a", undefined, undefined]); 29 check('({a:1})', undefined); 30 check('Math.atan2', [undefined, undefined]); 31 check('(async function (a, b, c) {})', ["a", "b", "c"]); 32 check('(async function* (d, e, f) {})', ["d", "e", "f"]);