Closed simoami closed 10 years ago
This function assignment:
Class.extend = function() {};
gets resolved into:
new Function(function() {
})
which doesn't work since you cannot pass anonymous function expressions as argument into new Function
. To fix it just replace
Class.extend = function() {};
with
Class.extend = function extend() {};
I will implement a fix later that will handles such situations and will explain it in more detail. Thank you!
Thanks for the quick feedback!
As you may know, there are two types of function expressions:
named
var func = function myFunc() {}
anonymous
var func = function() {}
But there is only one type of function declaration:
function func() {}
By passing an anonymous function expression into the function constructor the actual value of the parameter within the constructor would be
function() {}
which is neither a function expression nor a function declaration. It's just a syntax error. I don't know why chainit
has assigned static functions to the chain via new Function
before, but I removed it and just assigning the actual value now. I added some tests to make sure that static and prototype function get chained properly.
fixed and published (v2.1.0
)
index.js: Line 82
The error is:
To reproduce: