Skip to content

Commit

Permalink
add 'var that = this;' at the start of every function
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbarabash committed Jan 21, 2016
1 parent 9dcb8c0 commit 9fd5495
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions build/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -48436,6 +48436,11 @@ var transform = function transform(code, _context, options) {
bodyList.first.value.expression.argument.properties.push(property(identifier("name"), literal(functionName)));

addScopeDict(bodyList);

bodyList.push_front(assignmentStatement(identifier("that"), {
type: "ThisExpression"
}));

scopeStack.pop();
}

Expand Down
5 changes: 5 additions & 0 deletions src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,11 @@ var transform = function(code, _context, options) {
);

addScopeDict(bodyList);

bodyList.push_front(assignmentStatement(identifier("that"), {
type: "ThisExpression"
}));

scopeStack.pop();
}

Expand Down
2 changes: 1 addition & 1 deletion test/debugger-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (typeof require !== "undefined") {

_debugger = new Debugger({
nativeGenerators: nativeGenerators,
debug: true
debug: false
});
_debugger.context = context;
});
Expand Down

0 comments on commit 9fd5495

Please sign in to comment.