Skip to content
Browse files

* Dereference functions for mixins.

  • Loading branch information...
1 parent 8fecdb2 commit a5a5e6a95a46d62c40e481a12b795a4377607aee @keeto committed Oct 19, 2011
Showing with 13 additions and 3 deletions.
  1. +13 −3 Source/Company.js
View
16 Source/Company.js
@@ -40,15 +40,25 @@ var mix = function(){
Current.$prototyping = true;
Object.append(this, new Current);
delete Current.$prototyping;
- break;
+ break;
+
case 'unit':
for (var i in Current){
if (!Current.hasOwnProperty(i)) continue;
- this[i] = Current[i];
+ var value = Current[i];
+ if (typeof value == 'function' || !value.exec){
+ this[i] = (function(fn){
+ return function(){ return fn.apply(this, arguments); };
+ })();
+ } else {
+ this[i] = value;
+ }
}
- break;
+ break;
+
default:
Object.append(this, Current);
+ break;
}
}
return this;

0 comments on commit a5a5e6a

Please sign in to comment.
Something went wrong with that request. Please try again.