Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Commit

Permalink
fix: top level scope do not have this var
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 26, 2018
1 parent e174064 commit 7e7a503
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function runInContext(code: string, context: Context) {
const scope = new Scope("root", null);
scope.isTopLevel = true;
scope.invasive = true;
scope.const("this", this);
scope.const("this", undefined);
scope.setContext(context);

// define module
Expand Down
2 changes: 1 addition & 1 deletion test/es2015/arrow-function/ArrowFunctionExpression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test("ArrowFunctionExpression-2", t => {

const func = vm.runInContext(
`
const func = () => "hello " + this.aabbcc;
const func = () => "hello " + this;
module.exports = func;
`,
Expand Down

0 comments on commit 7e7a503

Please sign in to comment.