Permalink
Browse files

new instance test now passing

  • Loading branch information...
1 parent fa4c776 commit b643251b14daf74f54adb2141f369ededfa0b82b @substack committed Oct 4, 2011
Showing with 13 additions and 6 deletions.
  1. +12 −5 index.js
  2. +1 −1 package.json
View
@@ -264,11 +264,18 @@ Stack.prototype.compile = function (context, opts) {
var vars = node.value[1].join(',');
node.functionName = name;
- node.wrap('function ' + name + '(' + vars + '){'
- + ex(ix, 'return ' + names.fn
- + '(' + ix + ',%s).apply(this, arguments)'
- )
- + '}');
+ node.wrap(function (s) {
+ var src = s.replace(
+ /^function[^\(]*([^{]*\{)/,
+ function (_, x) { return 'function ' + x }
+ );
+
+ return 'function ' + name + '(' + vars + '){'
+ + ex(ix, 'return ' + names.fn
+ + '(' + ix + ',' + src + ').apply(this, arguments)'
+ )
+ + '}'
+ });
}
}
View
@@ -1,7 +1,7 @@
{
"name" : "stackedy",
"description" : "Roll your own stack traces and control program execution through AST manipulation",
- "version" : "0.1.5",
+ "version" : "0.1.6",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/node-stackedy.git"

0 comments on commit b643251

Please sign in to comment.