| 1 |
// single reference |
| 2 |
function r(...rest){ |
| 3 |
if (noNeedToWork) return 0; |
| 4 |
return rest; |
| 5 |
} |
| 6 |
|
| 7 |
// multiple references |
| 8 |
function r(...rest){ |
| 9 |
if (noNeedToWork) return 0; |
| 10 |
|
| 11 |
rest; |
| 12 |
rest; |
| 13 |
} |
| 14 |
|
| 15 |
// multiple nested references |
| 16 |
function r(...rest){ |
| 17 |
if (noNeedToWork) return 0; |
| 18 |
|
| 19 |
if (true) { |
| 20 |
return rest; |
| 21 |
} else { |
| 22 |
return rest; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
// deeply nested |
| 27 |
function r(...rest){ |
| 28 |
if (true) { |
| 29 |
if (true) { |
| 30 |
return rest; |
| 31 |
} else { |
| 32 |
return rest; |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
// nested reference with root reference |
| 38 |
function r(...rest){ |
| 39 |
if (noNeedToWork) return 0; |
| 40 |
|
| 41 |
if (lol) rest; |
| 42 |
rest; |
| 43 |
} |
| 44 |
|
| 45 |
// nested functions |
| 46 |
function a(...args) { |
| 47 |
return function() { |
| 48 |
function b() {} |
| 49 |
|
| 50 |
console.log("Shouldn't args be from a's scope?", args); |
| 51 |
}; |
| 52 |
} |
| 53 |
|
| 54 |
// loop |
| 55 |
function runQueue(queue, ...args) { |
| 56 |
for (let i = 0; i < queue.length; i++) { |
| 57 |
queue[i](...args) |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
// nested loop |
| 62 |
function runQueue(queue, ...args) { |
| 63 |
if (foo) { |
| 64 |
for (let i = 0; i < queue.length; i++) { |
| 65 |
queue[i](...args) |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
function r(...rest){ |
| 71 |
if (noNeedToWork) return 0; |
| 72 |
[rest[0]] = x; |
| 73 |
return rest; |
| 74 |
} |