claudepache / es-legacy-function-reflection

JavaScript: Legacy reflection features on functions needed for web compatibility
Creative Commons Zero v1.0 Universal
3 stars 2 forks source link

.arguments and .caller for `new` invocations #10

Closed claudepache closed 4 years ago

claudepache commented 4 years ago

Consider:

function f() {
  return f.arguments;
}

new f(1,2,3);

and

function f() {
     return f.caller;
}

function g() {
    return new f();
}

g();

Unsurprisingly, in tested implementations, .caller and .arguments work the same way regardless whether the receiver has been [[Call]]ed or has been [[Construct]]ed. TODO: