Skip to content

Commit 2673fb3

Browse files
committed
Ensure no strict-mode issues when referencing arguments.
Fixes #28
1 parent a4e395b commit 2673fb3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ var asyncToGenVisitor = {
200200
var envRecord = currentScope(ast);
201201
if (envRecord.async) {
202202
envRecord.referencesArgs = true;
203+
editor.overwrite(node.start, node.end, 'argument$');
203204
}
204205
}
205206
}
@@ -335,7 +336,7 @@ function createAsyncWrapping(node) {
335336
}
336337

337338
if (node.referencesArgs) {
338-
argNames.push('arguments');
339+
argNames.push('argument$');
339340
argValues.push('arguments');
340341
}
341342

test/expected.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ function normalThis() {
132132
}
133133

134134
// async function referencing arguments
135-
function asyncThis() {return __async(function*(arguments){
136-
return arguments;
135+
function asyncThis() {return __async(function*(argument$){
136+
return argument$;
137137
}(arguments))}
138138

139139
// async arrow function referencing arguments
140-
function within1() {return __async(function*(arguments){
141-
() => () =>__async(function*(arguments){ return arguments}(arguments))
140+
function within1() {return __async(function*(argument$){
141+
() => () =>__async(function*(argument$){ return argument$}(arguments))
142142
}(arguments))}
143143

144144

0 commit comments

Comments
 (0)