Created
July 12, 2010 15:54
-
-
Save StanAngeloff/472634 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/nodes.coffee b/src/nodes.coffee | |
index 275d9b3..06f2ea8 100644 | |
--- a/src/nodes.coffee | |
+++ b/src/nodes.coffee | |
@@ -447,7 +447,11 @@ exports.CallNode: class CallNode extends BaseNode | |
temp: o.scope.freeVariable() | |
obj: temp | |
meth: "($temp = ${ @variable.source })${ @variable.last }" | |
- "${@prefix()}${meth}.apply($obj, ${ @compileSplatArguments(o) })" | |
+ if @isNew | |
+ utility 'extends' | |
+ "(function() {\n${@idt(1)}var ctor = function(){ };\n${@idt(1)}__extends(ctor, $meth);\n${@idt(1)}return ${meth}.apply(new ctor, ${ @compileSplatArguments(o) });\n${@idt()}}).call(this)" | |
+ else | |
+ "${@prefix()}${meth}.apply($obj, ${ @compileSplatArguments(o) })" | |
#### ExtendsNode | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout lib/ && bin/cake build && bin/coffee -ep '@connection: new Connection(args...)' | |
(function(){ | |
var __extends = function(child, parent) { | |
var ctor = function(){ }; | |
ctor.prototype = parent.prototype; | |
child.__superClass__ = parent.prototype; | |
child.prototype = new ctor(); | |
child.prototype.constructor = child; | |
}; | |
this.connection = (function() { | |
var ctor = function(){ }; | |
__extends(ctor, Connection); | |
return Connection.apply(new ctor, args); | |
}).call(this); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment