made wrapper function keep current this

This commit is contained in:
satyr
2010-09-21 16:53:58 +09:00
parent 7bc91bf6c6
commit b19c004680
14 changed files with 15 additions and 15 deletions

View File

@@ -39,4 +39,4 @@
attachEvent('onload', processScripts);
}
}
})();
}).call(this);

View File

@@ -81,4 +81,4 @@
puts("No such task: \"" + (task) + "\"");
return process.exit(1);
};
})();
}).call(this);

View File

@@ -73,4 +73,4 @@
}
};
parser.yy = require('./nodes');
})();
}).call(this);

View File

@@ -245,4 +245,4 @@
puts("CoffeeScript version " + (CoffeeScript.VERSION));
return process.exit(0);
};
})();
}).call(this);

View File

@@ -644,4 +644,4 @@
operators: operators.reverse(),
startSymbol: 'Root'
});
})();
}).call(this);

View File

@@ -96,4 +96,4 @@
delete obj[key];
return val;
});
})();
}).call(this);

View File

@@ -7,4 +7,4 @@
val = _ref[key];
(exports[key] = val);
}
})();
}).call(this);

View File

@@ -654,4 +654,4 @@
'not': '!',
'===': '=='
};
})();
}).call(this);

View File

@@ -233,7 +233,7 @@
o.scope = new Scope(null, this, null);
code = this.compileWithDeclarations(o);
code = code.replace(TRAILING_WHITESPACE, '');
return o.noWrap ? code : ("(function() {\n" + (code) + "\n})();\n");
return o.noWrap ? code : ("(function() {\n" + (code) + "\n}).call(this);\n");
};
Expressions.prototype.compileWithDeclarations = function(o) {
var code;
@@ -1971,4 +1971,4 @@
Scope.root.assign(ref, UTILITIES[name]);
return ref;
};
})();
}).call(this);

View File

@@ -112,4 +112,4 @@
}
return result;
};
})();
}).call(this);

View File

@@ -35,4 +35,4 @@
});
repl.on('line', run);
repl.prompt();
})();
}).call(this);

View File

@@ -416,4 +416,4 @@
SINGLE_LINERS = ['ELSE', "->", "=>", 'TRY', 'FINALLY', 'THEN'];
SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
})();
}).call(this);

View File

@@ -134,4 +134,4 @@
};
return Scope;
}).call(this);
})();
}).call(this);

View File

@@ -210,7 +210,7 @@ exports.Expressions = class Expressions extends BaseNode
o.scope = new Scope(null, this, null)
code = @compileWithDeclarations(o)
code = code.replace(TRAILING_WHITESPACE, '')
if o.noWrap then code else "(function() {\n#{code}\n})();\n"
if o.noWrap then code else "(function() {\n#{code}\n}).call(this);\n"
# Compile the expressions body for the contents of a function, with
# declarations of all inner variables pushed up to the top.