-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from danez/fix-async-arrow-rest
Fix hoisting of arguments
- Loading branch information
Showing
4 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2017, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An | ||
* additional grant of patent rights can be found in the PATENTS file in | ||
* the same directory. | ||
*/ | ||
|
||
var assert = require("assert"); | ||
|
||
describe("regressions", function() { | ||
it("should correctly hoist arguments", async function () { | ||
function test(fn) { | ||
return async (...args) => { | ||
return fn(...args); | ||
}; | ||
} | ||
const result = []; | ||
await test((arg1, arg2) => { result.push(arg1, arg2); })(1, "foo"); | ||
|
||
assert.deepEqual(result, [1, "foo"]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters