Avoid binding functions in _.createCallback if they don't reference this.

Former-commit-id: d491414e7e1536d3241a607ba07120f629ff2410
This commit is contained in:
John-David Dalton
2013-05-20 09:20:51 -07:00
parent 242e8a3bd6
commit 01621f75b6
3 changed files with 116 additions and 35 deletions

View File

@@ -1385,6 +1385,9 @@
function removeRunInContext(source) {
source = removeVar(source, 'contextProps');
// replace reference in `reThis` assignment
source = source.replace(/\btest\(runInContext\)/, 'test(function() { return this; })');
// remove function scaffolding, leaving most of its content
source = source.replace(matchFunction(source, 'runInContext'), function(match) {
return match