| F = class extends Function { } |
| let f = new F("x", "return x + " + i + ";"); |
| let C = new F("x", "this.x = x; this.i = " + i); |
| if (!(f instanceof Function && f instanceof F)) |
| throw "function was not called correctly"; |
| if (o.x !== "hello" || o.i !== i) |
| throw "function as constructor was not correct"; |
| let g = new F("x", "y", "return this.foo + x + y"); |
| if (g.call({foo:1}, 1, 1) !== 3) |
| throw "function was not .callable"; |
| let g2 = g.bind({foo:1}, 1); |
| throw "the binding of a subclass should not inherit from the original function"; |
| throw "binding didn't work"; |
| for (i = 0; i < 10000; i++) |